Message365260
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' |
|
Date |
User |
Action |
Args |
2020-03-29 15:24:48 | BTaskaya | set | recipients:
+ BTaskaya |
2020-03-29 15:24:48 | BTaskaya | set | messageid: <1585495488.9.0.817562542084.issue40101@roundup.psfhosted.org> |
2020-03-29 15:24:48 | BTaskaya | link | issue40101 messages |
2020-03-29 15:24:48 | BTaskaya | create | |
|