[Python-checkins] r71059 - in python/trunk: Lib/test/test_sys.py Objects/longobject.c

mark.dickinson python-checkins at python.org
Thu Apr 2 20:39:37 CEST 2009


Author: mark.dickinson
Date: Thu Apr 2 20:39:37 2009
New Revision: 71059
Log:
sys.long_info attributes should be ints, not longs
Modified:
 python/trunk/Lib/test/test_sys.py
 python/trunk/Objects/longobject.c
Modified: python/trunk/Lib/test/test_sys.py
==============================================================================
--- python/trunk/Lib/test/test_sys.py	(original)
+++ python/trunk/Lib/test/test_sys.py	Thu Apr 2 20:39:37 2009
@@ -340,6 +340,8 @@
 self.assertEqual(len(sys.long_info), 2)
 self.assert_(sys.long_info.bits_per_digit % 5 == 0)
 self.assert_(sys.long_info.sizeof_digit >= 1)
+ self.assertEqual(type(sys.long_info.bits_per_digit), int)
+ self.assertEqual(type(sys.long_info.sizeof_digit), int)
 self.assert_(isinstance(sys.hexversion, int))
 self.assert_(isinstance(sys.maxint, int))
 if test.test_support.have_unicode:
@@ -606,9 +608,9 @@
 check(1L, size(vh) + self.longdigit)
 check(-1L, size(vh) + self.longdigit)
 PyLong_BASE = 2**sys.long_info.bits_per_digit
- check(PyLong_BASE, size(vh) + 2*self.longdigit)
- check(PyLong_BASE**2-1, size(vh) + 2*self.longdigit)
- check(PyLong_BASE**2, size(vh) + 3*self.longdigit)
+ check(long(PyLong_BASE), size(vh) + 2*self.longdigit)
+ check(long(PyLong_BASE**2-1), size(vh) + 2*self.longdigit)
+ check(long(PyLong_BASE**2), size(vh) + 3*self.longdigit)
 # module
 check(unittest, size(h + 'P'))
 # None
Modified: python/trunk/Objects/longobject.c
==============================================================================
--- python/trunk/Objects/longobject.c	(original)
+++ python/trunk/Objects/longobject.c	Thu Apr 2 20:39:37 2009
@@ -3736,8 +3736,10 @@
 	long_info = PyStructSequence_New(&Long_InfoType);
 	if (long_info == NULL)
 		return NULL;
-	PyStructSequence_SET_ITEM(long_info, field++, PyLong_FromLong(PyLong_SHIFT));
-	PyStructSequence_SET_ITEM(long_info, field++, PyLong_FromLong(sizeof(digit)));
+	PyStructSequence_SET_ITEM(long_info, field++,
+				 PyInt_FromLong(PyLong_SHIFT));
+	PyStructSequence_SET_ITEM(long_info, field++,
+				 PyInt_FromLong(sizeof(digit)));
 	if (PyErr_Occurred()) {
 		Py_CLEAR(long_info);
 		return NULL;


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /