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-18.09:46:11
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1584524771.97.0.157412190348.issue40000@roundup.psfhosted.org>
In-reply-to
Content
When something that isn't constant found in a ast.Constant node's body, python reports errors like this

>>> e = ast.Expression(body=ast.Constant(value=type))
>>> ast.fix_missing_locations(e)
<_ast.Expression object at 0x7fc2c23981c0>
>>> compile(e, "<test>", "eval")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: got an invalid type in Constant: type

But if something is part of constant tuple and frozenset isn't constant, the error reporting is wrong 

>>> e = ast.Expression(body=ast.Constant(value=(1,2,type)))
>>> compile(e, "<test>", "eval")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: got an invalid type in Constant: tuple

This should've been 

TypeError: got an invalid type in Constant: type
History
Date User Action Args
2020-03-18 09:46:12BTaskayasetrecipients: + BTaskaya
2020-03-18 09:46:11BTaskayasetmessageid: <1584524771.97.0.157412190348.issue40000@roundup.psfhosted.org>
2020-03-18 09:46:11BTaskayalinkissue40000 messages
2020-03-18 09:46:11BTaskayacreate