[Zope-dev] zope.proxy explanation?

Lennart Regebro regebro at gmail.com
Sat Nov 20 15:57:04 EST 2010


I'm trying to port zope.proxy to Python 3, and most tests seem to
work, but investigating those two who doesn't is confusing. The first
one is the test to prevent pickling. This works under Python 2, but as
I understand it it should work by implementing a __reduce__ function
that throws an exception. But that method is never called under Python
2. Instead a pickling error is thrown, but this is because the pickler
has no special knowledge about proxies, and then tries to find
__reduce__ and fails. Apparently the __reduce__of the proxy isn't
found, weirdly enough.

In Python 3, the base object now *has* __reduce__, so it *is* found
and used, so the test fails.

So there is something I'm missing here. It seems to be that two bugs
cancel each other out under Python 2, and under Python 3 they don't,
and the test fails.

//Lennart


More information about the Zope-Dev mailing list