[Zope-dev] zope.security failure [WAS Re: zope-tests - FAILED: 59]

Jason Madden jason.madden at nextthought.com
Sat Jun 4 15:17:38 CEST 2016


> On Jun 4, 2016, at 07:40, Marius Gedminas <marius at gedmin.as> wrote:
> 
>> [43]   FAILED  winbot / zope.security_py_340_win64
>>       https://mail.zope.org/pipermail/zope-tests/2016-June/095171.html
> 
> Unexpected 64-bitness:
> 
>    - <security proxied builtins.object instance at 0x0000000000C88610>
>    ?                                                 --------
>    + <security proxied builtins.object instance at 0x00C88610>
> 
> Probably because it tries to distinguish 32- and 64-bit Pythons by inspecting
> the size of ctypes.long, forgetting that on 64-bit Windows a C 'long' is
> 32-bits still.  A similar bug was recently fixed in, uh, ZODB?  persistent?
> zope.interface?  I don't recall.

I suspect you're thinking of https://github.com/zopefoundation/persistent/issues/38. There it turned out the bug was that the C code was simply returning the wrong type for __hash__ on Py3 (and getting away with it on non-64-bit-Windows).

Here (https://github.com/zopefoundation/zope.security/blame/master/src/zope/security/tests/test_proxy.py#L187), it looks like there's simply no accounting for pointer size at all on windows (the length of the address repr is hardcoded to 8 digits when the platform is 'win32': https://github.com/zopefoundation/zope.security/commit/e1d5f7cf375ccdfb8f6207c2bf813ca64c1d7bda).

I worked on the persistent bug, but because the error ended up being in C code, I never had to figure out how best to distinguish the two 'win32' cases in Python...but since this fails in ProxyCTests but passes in ProxyPyTests maybe this is a similar bug in the C extension?

Jason


More information about the Zope-Dev mailing list