[Python-bugs-list] [Bug #111690] Bug: dictionary with >= 8192 keys not initialized correctly

noreply@sourceforge.net noreply@sourceforge.net
Fri, 11 Aug 2000 09:37:29 -0700


Bug #111690, was updated on 2000-Aug-11 09:37
Here is a current snapshot of the bug.

Project: Python
Category: Parser/Compiler
Status: Open
Resolution: None
Bug Group: None
Priority: 5
Summary: Bug: dictionary with >= 8192 keys not initialized correctly

Details: Original posting to comp.lang.python:

Save this to a file dictbug.py:
 
print 'd1 = {'
for i in xrange(8191):
  print str(i) + ': None,'
print '}'
print 'd2 = {'
for i in xrange(8192):
  print str(i) + ': None,'
print '}'
print 'print len(d1)'
print 'print len(d2)'
 
Then run:
 
python dictbug.py > tmp.py
python tmp.py
 
The output is:
 
8191
0
 
I tested this with:
Python 1.5.2 (#1, Apr 28 2000, 11:50:55) [C] on osf1V5
Python 1.6b1 (#1, Aug  4 2000, 22:34:57) [C] on osf1V5
Python 1.5.2 (#1, Sep 17 1999, 20:15:36)  [GCC egcs-2.91.66
19990314/Linux (egcs- on linux-i386
 
If a dictionary is generated dynamically, e.g. by adding keys
in a loop, there is no problem if there are >= 8192 keys.
 
If there is an inherent problem with large dictionaries, it would be good if Python could at least raise an exception, e.g. SystemError. 
 
Ralf



A reply to that posting:


That's strange. I get a SyntaxError because the limit of
subnodes for an expression was set to 8192:
 
Python 2.0b1 (#2, Aug  7 2000, 10:06:00)  [GCC 2.95.2 19991024
(release)] on linux2
  File "dumm3.py", line 16386
    8191: None,
              ^
SyntaxError: expression too long
 
But then this probably was fixed after the 1.6b1 fork ...
You should submit this to the bug tracker at sourceforge:
 
http://sourceforge.net/bugs/?group_id=5470
 
Peter
--
Peter Schneider-Kamp          ++47-7388-7331
Herman Krags veg 51-11        mailto:peter@schneider-kamp.de
N-7050 Trondheim              http://schneider-kamp.de


For detailed info, follow this link:
http://sourceforge.net/bugs/?func=detailbug&bug_id=111690&group_id=5470