mirror of
https://github.com/python/cpython.git
synced 2025-07-19 09:15:34 +00:00
Issue #20637: Key-sharing now also works for instance dictionaries of subclasses. Patch by Peter Ingebretson.
This commit is contained in:
parent
32f30a8d9b
commit
f0b5a7c0f6
4 changed files with 34 additions and 2 deletions
|
@ -2472,6 +2472,9 @@ type_new(PyTypeObject *metatype, PyObject *args, PyObject *kwds)
|
|||
type->tp_dictoffset = slotoffset;
|
||||
slotoffset += sizeof(PyObject *);
|
||||
}
|
||||
else if (!type->tp_dictoffset) {
|
||||
type->tp_dictoffset = base->tp_dictoffset;
|
||||
}
|
||||
if (type->tp_dictoffset) {
|
||||
et->ht_cached_keys = _PyDict_NewKeysForClass();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue