summaryrefslogtreecommitdiff
path: root/Objects/dictobject.c
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2008-08-11 09:13:26 +0000
committerGeorg Brandl <georg@python.org>2008-08-11 09:13:26 +0000
commit45c33ce62d4d9a70083c4e0197c0af75bbef1fb2 (patch)
tree403c7522942a4a2140e25325eaa23ff32f45f94f /Objects/dictobject.c
parent78813dccd84c6f36fdf9d4e00b35e4f43b0867a2 (diff)
downloadcpython-git-45c33ce62d4d9a70083c4e0197c0af75bbef1fb2.tar.gz
- Issue #3537: Fix an assertion failure when an empty but presized dict
object was stored in the freelist. (backport from r65637.)
Diffstat (limited to 'Objects/dictobject.c')
-rw-r--r--Objects/dictobject.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/Objects/dictobject.c b/Objects/dictobject.c
index 412d5f2e31..8c8a2f92e7 100644
--- a/Objects/dictobject.c
+++ b/Objects/dictobject.c
@@ -208,6 +208,10 @@ PyDict_New(void)
_Py_NewReference((PyObject *)mp);
if (mp->ma_fill) {
EMPTY_TO_MINSIZE(mp);
+ } else {
+ /* At least set ma_table and ma_mask; these are wrong
+ if an empty but presized dict is added to freelist */
+ INIT_NONZERO_DICT_SLOTS(mp);
}
assert (mp->ma_used == 0);
assert (mp->ma_table == mp->ma_smalltable);