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 BTaskaya
Recipients BTaskaya
Date 2020-03-29.15:24:48
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1585495488.9.0.817562542084.issue40101@roundup.psfhosted.org>
In-reply-to
Content
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'
History
Date User Action Args
2020-03-29 15:24:48BTaskayasetrecipients: + BTaskaya
2020-03-29 15:24:48BTaskayasetmessageid: <1585495488.9.0.817562542084.issue40101@roundup.psfhosted.org>
2020-03-29 15:24:48BTaskayalinkissue40101 messages
2020-03-29 15:24:48BTaskayacreate