[Zope-dev] Linux x86_64 [Was: Zope Tests: 3 OK, 5 Failed]

Martijn Pieters mj at zopatista.com
Fri Aug 7 10:08:01 EDT 2009


On Fri, Aug 7, 2009 at 14:55, Martijn Pieters <mj at zopatista.com> wrote:
> Here is the simple test case:
>
> from Acquisition import Implicit
>
> class Root(Implicit):
>    pass
>
> class Slicer(Implicit):
>    def __getslice__(self, start, end):
>        return [start, end]
>
> root = Root()
> slicer = Slicer().__of__(root)
> print slicer[1:]
>
> Run this as bin/zopepy acquisition.py and verify that [1, -1] is
> printed on 64-bit platforms as opposed to [1, 2147483647] on 32-bit
> platforms.

Further datapoints, the following extra lines for the above script
give more context to compare:

import sys
print slicer[sys.maxint:]
print slicer[sys.maxint-1:]
print Slicer()[1:]

So we pass in sys.maxint and sys.maxint-1 as start values, and also
run the Slicer without acquisition wrapping to demonstrate that the
wrapper is the culprit, not python itself. Python passes in sys.maxint
for the end value for the slice if you omit it, and these high values
overflow somewhere in the wraper.

-- 
Martijn Pieters


More information about the Zope-Dev mailing list