summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2008-08-11 09:07:59 (GMT)
committerGeorg Brandl <georg@python.org>2008-08-11 09:07:59 (GMT)
commit1e13ea94a3da9fa2b60c24ff201c5ae69791572d (patch)
treeb5e06ec816e047ea89c5dcd6ad5575d16c2141d0 /Objects
parent14646337bff978f5eba7f2add21ffbe89e894c7c (diff)
downloadcpython-1e13ea94a3da9fa2b60c24ff201c5ae69791572d.zip
cpython-1e13ea94a3da9fa2b60c24ff201c5ae69791572d.tar.gz
cpython-1e13ea94a3da9fa2b60c24ff201c5ae69791572d.tar.bz2
- Issue #3537: Fix an assertion failure when an empty but presized dict
object was stored in the freelist.
Diffstat (limited to 'Objects')
-rw-r--r--Objects/dictobject.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/Objects/dictobject.c b/Objects/dictobject.c
index 038f373..cc083f1 100644
--- a/Objects/dictobject.c
+++ b/Objects/dictobject.c
@@ -241,6 +241,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);