[Python-checkins] r84321 - in python/branches/release27-maint: Lib/test/test_types.py Misc/NEWS Objects/typeobject.c

benjamin.peterson python-checkins at python.org
Thu Aug 26 01:17:42 CEST 2010


Author: benjamin.peterson
Date: Thu Aug 26 01:17:42 2010
New Revision: 84321

Log:
Merged revisions 84320 via svnmerge from 
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r84320 | benjamin.peterson | 2010-08-25 18:13:17 -0500 (Wed, 25 Aug 2010) | 1 line
  
  basicsize and itemsize are Py_ssize_t #9688
........


Modified:
   python/branches/release27-maint/   (props changed)
   python/branches/release27-maint/Lib/test/test_types.py
   python/branches/release27-maint/Misc/NEWS
   python/branches/release27-maint/Objects/typeobject.c

Modified: python/branches/release27-maint/Lib/test/test_types.py
==============================================================================
--- python/branches/release27-maint/Lib/test/test_types.py	(original)
+++ python/branches/release27-maint/Lib/test/test_types.py	Thu Aug 26 01:17:42 2010
@@ -741,6 +741,11 @@
         for code in 'xXobns':
             self.assertRaises(ValueError, format, 0, ',' + code)
 
+    def test_internal_sizes(self):
+        self.assertGreater(object.__basicsize__, 0)
+        self.assertGreater(tuple.__itemsize__, 0)
+
+
 def test_main():
     with check_py3k_warnings(
             ("buffer.. not supported", DeprecationWarning),

Modified: python/branches/release27-maint/Misc/NEWS
==============================================================================
--- python/branches/release27-maint/Misc/NEWS	(original)
+++ python/branches/release27-maint/Misc/NEWS	Thu Aug 26 01:17:42 2010
@@ -14,6 +14,8 @@
 
 - Restore GIL in nis_cat in case of error.
 
+- Issue #9688: __basicsize__ and __itemsize__ must be accessed as Py_ssize_t.
+
 - Issue #8530: Prevent stringlib fastsearch from reading beyond the front
   of an array.
 

Modified: python/branches/release27-maint/Objects/typeobject.c
==============================================================================
--- python/branches/release27-maint/Objects/typeobject.c	(original)
+++ python/branches/release27-maint/Objects/typeobject.c	Thu Aug 26 01:17:42 2010
@@ -188,8 +188,8 @@
 
 
 static PyMemberDef type_members[] = {
-    {"__basicsize__", T_INT, offsetof(PyTypeObject,tp_basicsize),READONLY},
-    {"__itemsize__", T_INT, offsetof(PyTypeObject, tp_itemsize), READONLY},
+    {"__basicsize__", T_PYSSIZET, offsetof(PyTypeObject,tp_basicsize),READONLY},
+    {"__itemsize__", T_PYSSIZET, offsetof(PyTypeObject, tp_itemsize), READONLY},
     {"__flags__", T_LONG, offsetof(PyTypeObject, tp_flags), READONLY},
     {"__weakrefoffset__", T_LONG,
      offsetof(PyTypeObject, tp_weaklistoffset), READONLY},


More information about the Python-checkins mailing list