[issue3537] dict creation failure causes crash

2008-08-11 Thread Georg Brandl

Georg Brandl <[EMAIL PROTECTED]> added the comment:

Applied and added test in r65637.

--
resolution:  -> fixed
status: open -> closed

___
Python tracker <[EMAIL PROTECTED]>

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3537] dict creation failure causes crash

2008-08-10 Thread Georg Brandl

Georg Brandl <[EMAIL PROTECTED]> added the comment:

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.

--
keywords: +patch
Added file: http://bugs.python.org/file11095/dictobj.diff

___
Python tracker <[EMAIL PROTECTED]>

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3537] dict creation failure causes crash

2008-08-10 Thread Georg Brandl

Georg Brandl <[EMAIL PROTECTED]> added the comment:

Also happens in trunk.

--
nosy: +georg.brandl
versions: +Python 2.6

___
Python tracker <[EMAIL PROTECTED]>

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3537] dict creation failure causes crash

2008-08-10 Thread Roger Upole

New submission from Roger Upole <[EMAIL PROTECTED]>:

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.

--
messages: 70990
nosy: rupole
severity: normal
status: open
title: dict creation failure causes crash
versions: Python 3.0

___
Python tracker <[EMAIL PROTECTED]>

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com