diff options
author | Vinay Sajip <vinay_sajip@yahoo.co.uk> | 2017-01-27 13:05:09 +0000 |
---|---|---|
committer | Vinay Sajip <vinay_sajip@yahoo.co.uk> | 2017-01-27 13:05:09 +0000 |
commit | d45d8652710e51576367db00b226b8465e6c5ce6 (patch) | |
tree | eeb12605abc98507852e82848382c2e739991708 /Modules/_struct.c | |
parent | 6ccbbb38caa79f9eb9b93b5767f3787fc80cbac1 (diff) | |
parent | bbbab3c96168cea9f872f90da0a385b50f62ca70 (diff) | |
download | cpython-d45d8652710e51576367db00b226b8465e6c5ce6.tar.gz |
Closes #28784: Merged update from 3.6.
Diffstat (limited to 'Modules/_struct.c')
-rw-r--r-- | Modules/_struct.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/Modules/_struct.c b/Modules/_struct.c index 796d1682f0..d621789d6b 100644 --- a/Modules/_struct.c +++ b/Modules/_struct.c @@ -1650,7 +1650,7 @@ unpackiter_iternext(unpackiterobject *self) } static PyTypeObject unpackiter_type = { - PyVarObject_HEAD_INIT(&PyType_Type, 0) + PyVarObject_HEAD_INIT(NULL, 0) "unpack_iterator", /* tp_name */ sizeof(unpackiterobject), /* tp_basicsize */ 0, /* tp_itemsize */ @@ -2048,7 +2048,7 @@ cache_struct(PyObject *fmt) s_object = PyObject_CallFunctionObjArgs((PyObject *)(&PyStructType), fmt, NULL); if (s_object != NULL) { - if (PyDict_Size(cache) >= MAXCACHE) + if (PyDict_GET_SIZE(cache) >= MAXCACHE) PyDict_Clear(cache); /* Attempt to cache the result */ if (PyDict_SetItem(cache, fmt, s_object) == -1) @@ -2301,6 +2301,9 @@ PyInit__struct(void) if (PyType_Ready(&PyStructType) < 0) return NULL; + if (PyType_Ready(&unpackiter_type) < 0) + return NULL; + /* Check endian and swap in faster functions */ { const formatdef *native = native_table; |