This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2008年08月10日 18:10 by rupole, last changed 2022年04月11日 14:56 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| dictobj.diff | georg.brandl, 2008年08月10日 18:47 | |||
| Messages (4) | |||
|---|---|---|---|
| msg70990 - (view) | Author: Roger Upole (rupole) | Date: 2008年08月10日 18:10 | |
If the first item can't be inserted the interpreter will crash
eventually.
while 1:
try:
d = { 'a':a,
'b':'b',
'c':'c',
'd':'d',
'e':'e',
'f':'f',
'g':'g',
'h':'h',
'i':'i',
'j':'j',
'k':'k',
'l':'l',
'm':'m',
'n':'n',
'o':'o'
}
except:
pass
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.
|
|||
| msg70991 - (view) | Author: Georg Brandl (georg.brandl) * (Python committer) | Date: 2008年08月10日 18:32 | |
Also happens in trunk. |
|||
| msg70992 - (view) | Author: Georg Brandl (georg.brandl) * (Python committer) | Date: 2008年08月10日 18:47 | |
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. |
|||
| msg71004 - (view) | Author: Georg Brandl (georg.brandl) * (Python committer) | Date: 2008年08月11日 09:08 | |
Applied and added test in r65637. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:56:37 | admin | set | github: 47787 |
| 2008年08月11日 09:08:20 | georg.brandl | set | status: open -> closed resolution: fixed messages: + msg71004 |
| 2008年08月10日 18:47:24 | georg.brandl | set | files:
+ dictobj.diff keywords: + patch messages: + msg70992 |
| 2008年08月10日 18:32:51 | georg.brandl | set | nosy:
+ georg.brandl messages: + msg70991 versions: + Python 2.6 |
| 2008年08月10日 18:10:23 | rupole | create | |