[Patches] [ python-Patches-1642547 ] Fix error/crash in AST: syntaxerror in complex ifs

SourceForge.net noreply at sourceforge.net
Tue Jan 23 15:02:33 CET 2007


Patches item #1642547, was opened at 2007-01-23 15:02
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1642547&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: Core (C code)
Group: None
Status: Open
Resolution: None
Priority: 9
Private: No
Submitted By: Thomas Wouters (twouters)
Assigned to: Neal Norwitz (nnorwitz)
Summary: Fix error/crash in AST: syntaxerror in complex ifs

Initial Comment:
Fix a bug in Python/ast.c, where a particular syntaxerror in an 'if' with one or more 'elif's would be ignored or mishandled:

timberwolf:~/python/python/trunk > cat test2.py
def bug():
    if w:
        dir()=1
    elif v:
        pass

timberwolf:~/python/python/trunk > python2.4 test2.py
  File "test2.py", line 3
    dir()=1
SyntaxError: can't assign to function call

timberwolf:~/python/python/trunk > python2.5 test2.py
Exception exceptions.SyntaxError: ("can't assign to function call", 3) in 'garbage collection' ignored
Fatal Python error: unexpected exception during garbage collection
Aborted

The actual problem is the lack of error checks on the return values of ast_for_expr() and ast_for_suite, in ast_for_if_stmt. Attached patch fixes.


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

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


More information about the Patches mailing list