[New-bugs-announce] [issue4067] ast.fix_missing_locations() breaks if node doesn't have "_attributes" variable
Marcin Bachry
report at bugs.python.org
Tue Oct 7 16:37:56 CEST 2008
New submission from Marcin Bachry <hegel666 at gmail.com>:
ast.fix_missing_locations() fails if any node is missing "_attributes"
instance variable - but it's the case of some fundamental nodes like
"alias" or "identifier". When I run simple test:
import ast
with open(__file__) as fp:
tree = ast.parse(fp.read())
ast.fix_missing_locations(tree)
I get:
$ python2.6 /tmp/test.py
Traceback (most recent call last):
File "/tmp/test.py", line 5, in <module>
ast.fix_missing_locations(tree)
File "/usr/local/lib/python2.6/ast.py", line 133, in
fix_missing_locations
_fix(node, 1, 0)
File "/usr/local/lib/python2.6/ast.py", line 132, in _fix
_fix(child, lineno, col_offset)
File "/usr/local/lib/python2.6/ast.py", line 132, in _fix
_fix(child, lineno, col_offset)
File "/usr/local/lib/python2.6/ast.py", line 121, in _fix
if 'lineno' in node._attributes:
AttributeError: 'alias' object has no attribute '_attributes'
----------
components: Library (Lib)
files: ast.diff
keywords: patch
messages: 74453
nosy: marcin.bachry
severity: normal
status: open
title: ast.fix_missing_locations() breaks if node doesn't have "_attributes" variable
type: behavior
versions: Python 2.6
Added file: http://bugs.python.org/file11730/ast.diff
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue4067>
_______________________________________
More information about the New-bugs-announce
mailing list