This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author collinwinter
Recipients
Date 2007-02-14.00:44:45
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
This patch implements these changes, as discussed in http://mail.python.org/pipermail/python-dev/2007-February/071006.html and following.

"""
1) There are times when the _fields attribute on some AST nodes is None; if this was done to indicate that a given node has no AST-related attributes, it would be much easier if _fields was [] in this case. As it is, I had to special-case "node._fields is None" in the visitor so that I don't accidentally iterate over it.
"""

asdl_c.py is changed to always set _fields to a tuple.

"""
2) {BinOp,AugAssign,BoolOp,etc}.op is an instance of, eg, Add, Sub, Mult, Mod, meaning you have to dispatch based on tests like "isinstance(node.op, x)" or "type(node.op) is x". I would much, much prefer to spell this "node.op is x", ie, use "node.op = Add" rather than the current "node.op = Add()" when constructing the nodes.
"""

asdl_c.py is changed so that it no longer emits the *_singleton objects and uses the corresponding *_type objects in their place.

"""
3) I'd like there to be an Else() node for If.orelse, While.orelse, etc. My motivation is that I need the lineno and col_offset values of the "else" statement for a code-coverage utility; as it is, I have to find the last lineno of the if/while/etc suite and the first lineno of the "else" suite and then search between those two for the "else" statement.
"""

An Else node is added to the ASDL file, impacting TryExcept, While, For and If nodes. The compiler, symtable and other files are adjusted to deal with these new nodes.

The patch is against r53772.
History
Date User Action Args
2007-08-23 15:56:33adminlinkissue1659410 messages
2007-08-23 15:56:33admincreate