[Python-checkins] r55174 - in python/branches/release25-maint: Modules/itertoolsmodule.c Objects/longobject.c

kristjan.jonsson python-checkins at python.org
Mon May 7 20:30:54 CEST 2007


Author: kristjan.jonsson
Date: Mon May  7 20:30:48 2007
New Revision: 55174

Modified:
   python/branches/release25-maint/Modules/itertoolsmodule.c
   python/branches/release25-maint/Objects/longobject.c
Log:
Fix two problems that emerged when the testsuite was run with an x64 build:  PyLong_FromSSize_t incorrectly assumed an unsigned object, and itertools.count() had the wrong upper limit for the iterator.

Modified: python/branches/release25-maint/Modules/itertoolsmodule.c
==============================================================================
--- python/branches/release25-maint/Modules/itertoolsmodule.c	(original)
+++ python/branches/release25-maint/Modules/itertoolsmodule.c	Mon May  7 20:30:48 2007
@@ -2073,9 +2073,9 @@
 static PyObject *
 count_next(countobject *lz)
 {
-        if (lz->cnt == LONG_MAX) {
+        if (lz->cnt == PY_SSIZE_T_MAX) {
                 PyErr_SetString(PyExc_OverflowError,
-                        "cannot count beyond LONG_MAX");                
+                        "cannot count beyond PY_SSIZE_T_MAX");                
                 return NULL;         
         }
 	return PyInt_FromSsize_t(lz->cnt++);

Modified: python/branches/release25-maint/Objects/longobject.c
==============================================================================
--- python/branches/release25-maint/Objects/longobject.c	(original)
+++ python/branches/release25-maint/Objects/longobject.c	Mon May  7 20:30:48 2007
@@ -893,7 +893,7 @@
 	int one = 1;
 	return _PyLong_FromByteArray(
 			(unsigned char *)&bytes,
-			SIZEOF_SIZE_T, IS_LITTLE_ENDIAN, 0);
+			SIZEOF_SIZE_T, IS_LITTLE_ENDIAN, 1);
 }
 
 /* Create a new long int object from a C size_t. */


More information about the Python-checkins mailing list