diff options
author | Benjamin Peterson <benjamin@python.org> | 2012-04-23 15:50:47 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2012-04-23 15:50:47 (GMT) |
commit | 53b977127fe8192f8bdf6a400de81086e128e936 (patch) | |
tree | 1df86df7bdd10a7da1be122f260ab710d0dea130 /Objects/dictobject.c | |
parent | 99e6f87586cd11d0d881891851c831a8d7ebb902 (diff) | |
download | cpython-53b977127fe8192f8bdf6a400de81086e128e936.zip cpython-53b977127fe8192f8bdf6a400de81086e128e936.tar.gz cpython-53b977127fe8192f8bdf6a400de81086e128e936.tar.bz2 |
don't make shared keys with dict subclasses
Diffstat (limited to 'Objects/dictobject.c')
-rw-r--r-- | Objects/dictobject.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Objects/dictobject.c b/Objects/dictobject.c index 2e45c8d..2afbbae 100644 --- a/Objects/dictobject.c +++ b/Objects/dictobject.c @@ -3686,7 +3686,7 @@ _PyObjectDict_SetItem(PyTypeObject *tp, PyObject **dictptr, res = PyDict_SetItem(dict, key, value); if (cached != ((PyDictObject *)dict)->ma_keys) { /* Either update tp->ht_cached_keys or delete it */ - if (cached->dk_refcnt == 1) { + if (cached->dk_refcnt == 1 && PyDict_CheckExact(dict)) { CACHED_KEYS(tp) = make_keys_shared(dict); if (CACHED_KEYS(tp) == NULL) return -1; |