[Checkins] SVN: Zope/ It's not possible to use xrange inside __getslice__ in 64bit python on

Nikolay Kim fafhrd91 at gmail.com
Mon Sep 27 14:35:34 EDT 2010


Log message for revision 116989:
  It's not possible to use xrange inside __getslice__ in 64bit python on
  Windows, because xrange uses 32bit integers and __getslice__ gets 64bit integers
  
  
  

Changed:
  U   Zope/branches/2.12/doc/CHANGES.rst
  U   Zope/branches/2.12/src/Products/ZCatalog/Lazy.py
  U   Zope/trunk/doc/CHANGES.rst
  U   Zope/trunk/src/Products/ZCatalog/Lazy.py

-=-
Modified: Zope/branches/2.12/doc/CHANGES.rst
===================================================================
--- Zope/branches/2.12/doc/CHANGES.rst	2010-09-27 17:45:55 UTC (rev 116988)
+++ Zope/branches/2.12/doc/CHANGES.rst	2010-09-27 18:35:34 UTC (rev 116989)
@@ -13,6 +13,9 @@
 
 - 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

Modified: Zope/branches/2.12/src/Products/ZCatalog/Lazy.py
===================================================================
--- Zope/branches/2.12/src/Products/ZCatalog/Lazy.py	2010-09-27 17:45:55 UTC (rev 116988)
+++ Zope/branches/2.12/src/Products/ZCatalog/Lazy.py	2010-09-27 18:35:34 UTC (rev 116989)
@@ -13,7 +13,9 @@
 __doc__='''$Id$'''
 __version__='$Revision: 1.9 $'[11:-2]
 
+from itertools import islice, count
 
+
 class Lazy:
 
     # Allow (reluctantly) access to unprotected attributes
@@ -44,7 +46,7 @@
 
     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

Modified: Zope/trunk/doc/CHANGES.rst
===================================================================
--- Zope/trunk/doc/CHANGES.rst	2010-09-27 17:45:55 UTC (rev 116988)
+++ Zope/trunk/doc/CHANGES.rst	2010-09-27 18:35:34 UTC (rev 116989)
@@ -13,6 +13,9 @@
 
 - Fixed two unit tests that failed on fast Windows machines.
 
+- Fixed OverflowError in Products.ZCatalog.Lazy on 64bit python
+  on Windows.
+
 - Fixed ``testZODBCompat`` tests in ZopeTestCase to match modern ZODB
   semantics.
 

Modified: Zope/trunk/src/Products/ZCatalog/Lazy.py
===================================================================
--- Zope/trunk/src/Products/ZCatalog/Lazy.py	2010-09-27 17:45:55 UTC (rev 116988)
+++ Zope/trunk/src/Products/ZCatalog/Lazy.py	2010-09-27 18:35:34 UTC (rev 116989)
@@ -11,6 +11,9 @@
 #
 ##############################################################################
 
+from itertools import islice, count
+
+
 class Lazy(object):
 
     # Allow (reluctantly) access to unprotected attributes
@@ -43,7 +46,7 @@
 
     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:



More information about the checkins mailing list