diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2014-02-23 15:50:07 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2014-02-23 15:50:07 (GMT) |
commit | f0b5a7c0f646d74265f1977154c829c8df79f76c (patch) | |
tree | e8eba8a0adfa380b11c6a1a80296ee0081c4caf3 /Objects | |
parent | 32f30a8d9b84009910ae541f8ac23bfa9b64af6a (diff) | |
download | cpython-f0b5a7c0f646d74265f1977154c829c8df79f76c.zip cpython-f0b5a7c0f646d74265f1977154c829c8df79f76c.tar.gz cpython-f0b5a7c0f646d74265f1977154c829c8df79f76c.tar.bz2 |
Issue #20637: Key-sharing now also works for instance dictionaries of subclasses. Patch by Peter Ingebretson.
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/typeobject.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/Objects/typeobject.c b/Objects/typeobject.c index f58960d..5a41387 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(); } |