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 Tal Ben-Nun
Recipients Tal Ben-Nun
Date 2020-01-27.11:40:03
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1580125203.43.0.757991294489.issue39463@roundup.psfhosted.org>
In-reply-to
Content
In Python 3.8, the "kind" field was introduced into the Constant AST class. This brings about a problem when unparsing the AST for various packages. First, it breaks backward compatibility for older code that creates ast.Num without specifying kind (which is optional anyway and does not exist in its fields). Second, since bytes are parsed as a Constant without a kind, one can create the following (valid as of now) AST and unparse it:

ast.unparse(ast.Constant(value=b"bad", kind="u"))

Getting "ub'bad'", which is invalid Python syntax AFAIU.

Could something be done with the classes that extend ast.Constant and with bytes being a Constant with a "kind" of "b"?
History
Date User Action Args
2020-01-27 11:40:03Tal Ben-Nunsetrecipients: + Tal Ben-Nun
2020-01-27 11:40:03Tal Ben-Nunsetmessageid: <1580125203.43.0.757991294489.issue39463@roundup.psfhosted.org>
2020-01-27 11:40:03Tal Ben-Nunlinkissue39463 messages
2020-01-27 11:40:03Tal Ben-Nuncreate