You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As best I can tell, this only happens for the first item.
In a debug build, this assert fails on the second time thru
the loop (dictobject.c, line 247):
assert (mp->ma_table == mp->ma_smalltable);
Apparently something is leaving one of the entries in the list
of preallocated dict objects in an inconsistent state.
The problem is that PyDict_New doesn't reinitialize the fields of a dict
from the free list when the number of entries is zero. For a
preconstructed dict (like created by BUILD_MAP) of size >=8, however,
there will be an allocated ma_table and ma_mask will be 16-1, not 8-1.
Activity
rupole commentedon Aug 10, 2008
If the first item can't be inserted the interpreter will crash
eventually.
As best I can tell, this only happens for the first item.
In a debug build, this assert fails on the second time thru
the loop (dictobject.c, line 247):
assert (mp->ma_table == mp->ma_smalltable);
Apparently something is leaving one of the entries in the list
of preallocated dict objects in an inconsistent state.
birkenfeld commentedon Aug 10, 2008
Also happens in trunk.
birkenfeld commentedon Aug 10, 2008
The problem is that PyDict_New doesn't reinitialize the fields of a dict
from the free list when the number of entries is zero. For a
preconstructed dict (like created by BUILD_MAP) of size >=8, however,
there will be an allocated ma_table and ma_mask will be 16-1, not 8-1.
I propose the attached patch.
birkenfeld commentedon Aug 11, 2008
Applied and added test in r65637.