Issue #20637: Key-sharing now also works for instance dictionaries of subclasses. Patch by Peter Ingebretson.

This commit is contained in:
Antoine Pitrou 2014-02-23 16:50:07 +01:00
parent 32f30a8d9b
commit f0b5a7c0f6
4 changed files with 34 additions and 2 deletions

View file

@ -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();
}