Skip to content

Commit

Permalink
It's not possible to use xrange inside __getslice__ in 64bit python on
Browse files Browse the repository at this point in the history
Windows, because xrange uses 32bit integers and __getslice__ gets 64bit integers
  • Loading branch information
fafhrd91 committed Sep 27, 2010
1 parent 01d1b9b commit 395668f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 3 additions & 0 deletions doc/CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ Bugs Fixed

- Fixed unit test that failed on fast Windows machines.

- Fixed OverflowError in Products.ZCatalog.Lazy on 64bit python
on Windows.

- LP #642728: Fixed TypeError on nested multi part messages in MailHost.

Features Added
Expand Down
4 changes: 3 additions & 1 deletion src/Products/ZCatalog/Lazy.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
__doc__='''$Id$'''
__version__='$Revision: 1.9 $'[11:-2]

from itertools import islice, count


class Lazy:

Expand Down Expand Up @@ -44,7 +46,7 @@ def __add__(self, other):

def __getslice__(self,i1,i2):
r=[]
for i in xrange(i1,i2):
for i in islice(count(i1), i2-i1):
try: r.append(self[i])
except IndexError: return r
return r
Expand Down

0 comments on commit 395668f

Please sign in to comment.