[Python-bugs-list] [ python-Bugs-567538 ] Generator can crash the interpreter.

noreply@sourceforge.net noreply@sourceforge.net
Tue, 11 Jun 2002 20:46:40 -0700


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

Category: Python Interpreter Core
Group: Python 2.3
>Status: Closed
>Resolution: Fixed
Priority: 5
Submitted By: Finn Bock (bckfnn)
>Assigned to: Guido van Rossum (gvanrossum)
Summary: Generator can crash the interpreter.

Initial Comment:
Tested with:

Python 2.3a0 (#4, Jun 11 2002, 13:35:00)
[GCC 2.95.3-5 (cygwin special)] on cygwin

and with:

Python 2.2.1 (#34, Apr  9 2002, 19:34:33) [MSC 32 bit
(Intel)] on win32

Running the example cause a hard crash (seg fault).


Python 2.3a0 (#4, Jun 11 2002, 13:35:00)
[GCC 2.95.3-5 (cygwin special)] on cygwin
Type "help", "copyright", "credits" or "license" for
more information.
>>> from __future__ import generators
>>>
>>> def f():
...     for i in range(3):
...         try:
...             continue
...         finally:
...             yield 1
...
>>> g = f()
>>> print g.next()
1
>>> print g.next()
Segmentation fault (core dumped)

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

>Comment By: Guido van Rossum (gvanrossum)
Date: 2002-06-11 23:46

Message:
Logged In: YES 
user_id=6380

I was afraid that this would be a major undertaking, but
while running the sample through the debugger, I noticed
that it was comparing the 'why' variable to CONTINUE_LOOP,
which isn't a why enum but an opcode. Replacing this with
WHY_CONTINUE fixed the problem. Added a testcase. Will fix
in 2.2 too.

Thanks for reporting!

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

Comment By: Guido van Rossum (gvanrossum)
Date: 2002-06-11 17:03

Message:
Logged In: YES 
user_id=6380

I'll have a look at this.

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

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