[Python-bugs-list] [ python-Bugs-436207 ] "if 0: yield x" is ignored

noreply@sourceforge.net noreply@sourceforge.net
Mon, 25 Jun 2001 19:48:06 -0700


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

Category: Parser/Compiler
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Guido van Rossum (gvanrossum)
Assigned to: Jeremy Hylton (jhylton)
>Summary: "if 0: yield x" is ignored

Initial Comment:
The parser doesn't descend into blocks that start with
"if 0:" and a few other special cases like "if
__debug__:".

This breaks the semantics of the yield statement, which
states that the mere *presence* of a yield in a
function makes the function a generator.

It's a bug that needs to be fixed before 2.2 is
released.

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

>Comment By: Tim Peters (tim_one)
Date: 2001-06-25 19:48

Message:
Logged In: YES 
user_id=31435

Attached is a dirt-simple patch that addresses yield in 
these cases, but nothing else.

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

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