After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 659113 - AST pattern for with statements does not match in Python 2.6
AST pattern for with statements does not match in Python 2.6
Status: RESOLVED FIXED
Product: reinteract
Classification: Other
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: reinteract-maint
reinteract-maint
Depends on:
Blocks:
 
 
Reported: 2011-09-15 02:02 UTC by Robert Schroll
Modified: 2011-09-17 17:38 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Add compatibility for Python 2.6 AST for with statement. (7.68 KB, patch)
2011-09-15 02:02 UTC, Robert Schroll
none Details | Review

Description Robert Schroll 2011-09-15 02:02:29 UTC
It appears that the AST for with statements changed between Python 2.6 
and 2.7.  The existing code is written for 2.7 (I believe) and doesn't 
work on 2.6.  This adds patterns for 2.6 and switches between them based 
on the existance of symbol.with_item.  I tried not to mess anything up 
for 2.7, but I don't have things set up to test that.
Comment 1 Robert Schroll 2011-09-15 02:02:31 UTC
Created attachment 196576 [details] [review]
Add compatibility for Python 2.6 AST for with statement.

Python 2.6 has a slightly different AST for with statments than
Python 2.7 does.  We choose the relevant AST pattern py testing
for the existance of symbol.with_item, which exists in 2.7 but
not in 2.6.
Comment 2 Owen Taylor 2011-09-17 17:38:51 UTC
This was fixed in a different way by:

commit ce2dfcc6eeac01384b0b2156a52c42d5d29aced1
Author: Owen W. Taylor <otaylor@fishsoup.net>
Date:   Fri Sep 16 13:18:03 2011 -0400

    rewrite.py: Rewrite to use the AST rather tha the parse tree
    
    In Python-2.5, the 'ast' module was introduced that is remarkably
    easier to use than the 'parser' module, since we're working in
    terms of the logical syntax of Python rather than the detailed
    grammar. Rewrite rewrite.py to use this instead, removing a lot
    of code and simplifying maintenance.