mirror of
https://github.com/python/cpython.git
synced 2025-08-22 09:45:06 +00:00
GH-95707: Fix uses of Py_TPFLAGS_MANAGED_DICT
(GH-95854)
* Make sure that tp_dictoffset is correct with Py_TPFLAGS_MANAGED_DICT is set. * Avoid traversing managed dict twice when subclassing class with Py_TPFLAGS_MANAGED_DICT set.
This commit is contained in:
parent
4a7f5a55dc
commit
3ef3c6306d
7 changed files with 137 additions and 25 deletions
|
@ -1064,6 +1064,7 @@ _PyObject_ComputedDictPointer(PyObject *obj)
|
|||
if (dictoffset == 0)
|
||||
return NULL;
|
||||
if (dictoffset < 0) {
|
||||
assert(dictoffset != -1);
|
||||
Py_ssize_t tsize = Py_SIZE(obj);
|
||||
if (tsize < 0) {
|
||||
tsize = -tsize;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue