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 daishiharada
Recipients daishiharada
Date 2008-08-09.02:26:11
SpamBayes Score 2.2929e-06
Marked as misclassified No
Message-id <>
I am testing python 2.6 from SVN version: 40110

I tried the following, based on the documentation
and example in the ast module. I would expect the
second 'compile' to succeed also, instead of
throwing an exception.

Python 2.6b2+ (unknown, Aug  6 2008, 18:05:08) 
[GCC 4.2.3 (Ubuntu 4.2.3-2ubuntu7)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import ast
>>> a = ast.parse('foo', mode='eval')
>>> x = compile(a, '<unknown>', mode='eval')
>>> class RewriteName(ast.NodeTransformer):
...     def visit_Name(self, node):
...         return ast.copy_location(ast.Subscript(
...             value=ast.Name(id='data', ctx=ast.Load()),
...             slice=ast.Index(value=ast.Str(,
...             ctx=node.ctx
...         ), node)
>>> a2 = RewriteName().visit(a)
>>> x2 = compile(a2, '<unknown>', mode='eval')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: required field "lineno" missing from expr
Date User Action Args
2008-08-09 02:26:16daishiharadasetrecipients: + daishiharada
2008-08-09 02:26:14daishiharadasetmessageid: <>
2008-08-09 02:26:13daishiharadalinkissue3530 messages
2008-08-09 02:26:12daishiharadacreate