Message360754
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"? |
|
Date |
User |
Action |
Args |
2020-01-27 11:40:03 | Tal Ben-Nun | set | recipients:
+ Tal Ben-Nun |
2020-01-27 11:40:03 | Tal Ben-Nun | set | messageid: <1580125203.43.0.757991294489.issue39463@roundup.psfhosted.org> |
2020-01-27 11:40:03 | Tal Ben-Nun | link | issue39463 messages |
2020-01-27 11:40:03 | Tal Ben-Nun | create | |
|