New submission from Batuhan Taskaya <[email protected]>:
When using driver/parser without a custom convert function (like
pyconvert.convert), it tries to assign used_names to the root node, which can
be anything depending on the given convert function. If none given, it will be
a tuple.
>>> from lib2to3.pygram import python_grammar
>>> from lib2to3.pgen2.driver import Driver
>>>
>>> d = Driver(grammar=python_grammar)
>>> d.parse_string("test\n")
Traceback (most recent call la
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.9/lib2to3/pgen2/driver.py", line 103, in
parse_string
return self.parse_tokens(tokens, debug)
File "/usr/local/lib/python3.9/lib2to3/pgen2/driver.py", line 71, in
parse_tokens
if p.addtoken(type, value, (prefix, start)):
File "/usr/local/lib/python3.9/lib2to3/pgen2/parse.py", line 136, in addtoken
self.pop()
File "/usr/local/lib/python3.9/lib2to3/pgen2/parse.py", line 204, in pop
self.rootnode.used_names = self.used_names
AttributeError: 'tuple' object has no attribute 'used_names'
----------
components: Library (Lib)
messages: 365260
nosy: BTaskaya
priority: normal
severity: normal
status: open
title: lib2to3 fails on default convert functionality
versions: Python 3.9
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue40101>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com