[Python-bugs-list] [ python-Bugs-561858 ] Assertion with very long lists

noreply@sourceforge.net noreply@sourceforge.net
Fri, 31 May 2002 15:32:36 -0700


Bugs item #561858, was opened at 2002-05-29 06:12
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=561858&group_id=5470

Category: Python Interpreter Core
Group: Python 2.1.2
Status: Open
Resolution: None
Priority: 5
Submitted By: Jerome Alet (jalet)
Assigned to: Nobody/Anonymous (nobody)
Summary: Assertion with very long lists

Initial Comment:
I've tried to import a module which only define a list
of 170000 elements (a word list) which defines an
element per line, so the module also has 170000 lines
in it. Here's the error :

--- CUT ---
Python 2.1.3 (#1, Apr 20 2002, 10:14:34) 
[GCC 2.95.4 20011002 (Debian prerelease)] on linux2
Type "copyright", "credits" or "license" for more
information.
>>> import dictionnaire
python: ../Python/ceval.c:695: eval_code2: Assertion
`(stack_pointer - f->f_valuestack) <= f->f_stacksize'
failed.
Abandon
--- CUT ---

this seems to be the same problem as bug id 210647 but
there's no segfault.

the module is attached to this bug report.

----------------------------------------------------------------------

>Comment By: Neal Norwitz (nnorwitz)
Date: 2002-05-31 18:32

Message:
Logged In: YES 
user_id=33168

I think there are several problems here.
I was able to narrow down at least one problem to a long list.
It doesn't seem to have anything to do w/backslashes.

There seems to be an interaction with importing the module.
If the long list is in __main__, the problem does not occur.
The problem only occurs when the list is in an imported module
and only after importing it the second time (after the .pyc
is created).

If a list has 32768+ items there seems to be a memory problem.
There is an exception, then a crash.  Here's the exception:

TypeError: unsupported operand type(s) for &: 'str' and 'str'

Here's a stack trace against CVS version:

#0  chunk_free (ar_ptr=0x401b1620, p=0x8156a10) at malloc.c:3180
#1  0x400fdbf4 in __libc_free (mem=0x8156a18) at malloc.c:3154
#2  0x0805c0db in list_dealloc (op=0x401c4eac) at
Objects/listobject.c:214
#3  0x080c7618 in PyDict_SetItem (op=0x401bd79c,
key=0x401c4ec0, 
    value=0x80e185c) at Objects/dictobject.c:373
#4  0x080c93f9 in PyDict_SetItemString (v=0x401bd79c,
key=0x80d9070 "path", 
    item=0x80e185c) at Objects/dictobject.c:1895
#5  0x08099ad8 in PyImport_Cleanup () at Python/import.c:286
#6  0x080a266d in Py_Finalize () at Python/pythonrun.c:228
#7  0x08053766 in Py_Main (argc=2, argv=0xbffff904) at
Modules/main.c:379


----------------------------------------------------------------------

Comment By: Jerome Alet (jalet)
Date: 2002-05-29 08:42

Message:
Logged In: YES 
user_id=97214

I've done more tests, the bug only occurs if every line has
a backslash at its end :

liste = [ \
            "item0", \
            "item1", \
            # ... many many lines
            "itemN" ]

and it works if I remove the \ from each end of line.

hth.

----------------------------------------------------------------------

Comment By: Jerome Alet (jalet)
Date: 2002-05-29 06:14

Message:
Logged In: YES 
user_id=97214

module too long to be attached. ask it by email at
alet@librelogiciel.com if needed.

----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=561858&group_id=5470