aboutsummaryrefslogtreecommitdiff
path: root/Objects/typeobject.c
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2014-02-23 16:50:07 +0100
committerAntoine Pitrou <solipsis@pitrou.net>2014-02-23 16:50:07 +0100
commitf0b5a7c0f646d74265f1977154c829c8df79f76c (patch)
treee8eba8a0adfa380b11c6a1a80296ee0081c4caf3 /Objects/typeobject.c
parent32f30a8d9b84009910ae541f8ac23bfa9b64af6a (diff)
downloadcpython3-f0b5a7c0f646d74265f1977154c829c8df79f76c.tar.gz
Issue #20637: Key-sharing now also works for instance dictionaries of subclasses. Patch by Peter Ingebretson.
Diffstat (limited to 'Objects/typeobject.c')
-rw-r--r--Objects/typeobject.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/Objects/typeobject.c b/Objects/typeobject.c
index f58960d28c..5a41387bc1 100644
--- a/Objects/typeobject.c
+++ b/Objects/typeobject.c
@@ -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();
}