On Fri, Aug 7, 2009 at 14:55, Martijn Pieters <m...@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
Zope-Dev maillist  -  Zope-Dev@zope.org
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope )

Reply via email to