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
........
This commit is contained in:
Benjamin Peterson 2010-08-25 23:17:42 +00:00
parent 7c4bf55ffd
commit 6f3d6a9b23
3 changed files with 9 additions and 2 deletions

View file

@ -741,6 +741,11 @@ class TypesTests(unittest.TestCase):
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),

View file

@ -14,6 +14,8 @@ Core and Builtins
- 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.

View file

@ -188,8 +188,8 @@ assign_version_tag(PyTypeObject *type)
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},