[ python-Bugs-1069092 ] segfault on printing nested sequences of None/Ellipsis

SourceForge.net noreply at sourceforge.net
Thu Sep 15 12:56:30 CEST 2005


Bugs item #1069092, was opened at 2004-11-19 00:31
Message generated for change (Comment added) made by birkenfeld
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1069092&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Interpreter Core
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Jonas Kölker (jonaskoelker)
Assigned to: Nobody/Anonymous (nobody)
Summary: segfault on printing nested sequences of None/Ellipsis

Initial Comment:
## bug1.py
loop = None,
while True: loop = loop, None

bash$ python -i bug1.py
(I press C-c)
>>> print loop
((((((((((((((((( <skipping a large amount of parens
for brevity> (((((((((segfault
bash$ 

bash$ python -i bug1.py
(I press C-c)
>>> str(loop)
segfault
bash$ 

bash$ python -i bug1.py
(I press C-c)
>>> repr(loop)
segfault
bash$

--- ---
the results are the same for bug2.py, bug3.py and
bug.py4 which have the same contents, except that loop
is a list, None is replaced by Ellipsis or both. The
behavior (i.e. segfaulting) is the same.
also, when pressing C-c, python's memory usage remains
constant. gc.garbage is empty; gc.collect() returns 0
and doesn't free memory.

my python and uname:

bash$ python
Python 2.3.4 (#2, Sep 24 2004, 08:39:09)
[GCC 3.3.4 (Debian 1:3.3.4-12)] on linux2

bash$ uname --all
Linux koelker 2.4.18-bf2.4 #1 Son Apr 14 09:53:28 CEST
2002 i686 GNU/Linux

I have also reproduced it on
Python 2.3.3 (#1, May 7 2004, 10:31:40)
[GCC 3.3.3 20040412 (Red Hat Linux 3.3.3-7)] on linux2

bash$ uname --all
Linux horse09 2.6.8-1.521smp #1 SMP Man Aug 16 09:25:06
EDT 2004 i686 i686 i386 GNU/Linux

and on
Python 2.4a3 (#1, Oct  3 2004, 12:05:12)
[GCC 3.3.2] on linux2
(on the same machine)

it didn't reproduce on
Python 1.5.2 (#1, Mar  9 2000, 17:40:34)  [GCC 2.95.2
19991024 (release)] on hp-uxB

bash$ uname -a
HP-UX aragorn B.11.11 U 9000/782 2006786478
unlimited-user license

but it did on
Python 1.5.2 (#1, Jul  5 2001, 03:02:19)  [GCC 2.96
20000731] (Red Hat Linux 7.1 2 on linux-i386

bash$ uname
Linux legolas 2.4.20-20.7smp #1 SMP Mon Aug 18 14:46:14
EDT 2003 i686 unknown

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

>Comment By: Reinhold Birkenfeld (birkenfeld)
Date: 2005-09-15 12:56

Message:
Logged In: YES 
user_id=1188172

I can reproduce this here on Linux with 100000x None. Will
try to investigate.

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

Comment By: Terry J. Reedy (tjreedy)
Date: 2004-11-24 08:43

Message:
Logged In: YES 
user_id=593130

On <<<Python 2.2.1 (#34, Apr  9 2002, 19:34:33) [MSC 32 
bit (Intel)] on win32>>> I got (interactive mode, about 5 
sec before ^C)  appropriate output:

((((((((((((((((((((((((((((((((((((((((((((((((((((((
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
MemoryError: stack overflow

The nested depth was
>>> i=0
>>> while loop: loop,i = loop[0], i+1
...
>>> i
50695

Note: a test case would need a finite loop such as:
for i in range(100000) 
instead of while True (until ^C pressed).

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

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


More information about the Python-bugs-list mailing list