You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee=Noneclosed_at=<Date2021-10-20.22:52:24.270>created_at=<Date2021-05-28.10:19:27.232>labels= ['type-bug', 'expert-2to3', '3.9']
title='lib2to3 does not accept "exec" as name'updated_at=<Date2021-10-20.22:52:24.270>user='https://github.com/Mulugruntz'
It was failing and for a while I thought I was doing something wrong. But when I did dig deeper, I realized that it was failing because I has a method named "exec".
The reason why I want to use "exec" is to make it obvious whether I'm executing the subprocess in shell mode or not (there's also a "shell" method).
'exec' was a keyword in 2.x, but that should not matter in 3.9. What OS? Did you get an actual crash (core dump on *nix), or a python exception and traceback (not a crash)? If the latter, copy and paste it.
Mulugruntz commented on May 29, 2021
Mulugruntzmannequin
MannequinAuthor
More actions
Traceback (most recent call last):
File "/Users/sgiffard/Library/Application Support/JetBrains/PyCharm2020.3/scratches/scratch_24.py", line 9, in <module>
driver.parse_string("""class C:\n def exec(self): pass\n""")
File "/usr/local/Cellar/python@3.9/3.9.5/Frameworks/Python.framework/Versions/3.9/lib/python3.9/lib2to3/pgen2/driver.py", line 103, in parse_stringreturnself.parse_tokens(tokens, debug)
File "/usr/local/Cellar/python@3.9/3.9.5/Frameworks/Python.framework/Versions/3.9/lib/python3.9/lib2to3/pgen2/driver.py", line 71, in parse_tokensif p.addtoken(type, value, (prefix, start)):
File "/usr/local/Cellar/python@3.9/3.9.5/Frameworks/Python.framework/Versions/3.9/lib/python3.9/lib2to3/pgen2/parse.py", line 162, in addtokenraise ParseError("bad input", type, value, context)
lib2to3.pgen2.parse.ParseError: bad input: type=1, value='exec', context=(' ', (2, 8))
Mulugruntz commented on May 29, 2021
Mulugruntzmannequin
MannequinAuthor
More actions
Sorry, I forgot to mention:
macOS Mojave 10.14.5 (18F132)
Activity
Mulugruntz commentedon May 28, 2021
I was trying to use https://github.com/NiklasRosenstein/pydoc-markdown to generate some doc for https://github.com/Mulugruntz/aiosubprocess
It was failing and for a while I thought I was doing something wrong. But when I did dig deeper, I realized that it was failing because I has a method named "exec".
The reason why I want to use "exec" is to make it obvious whether I'm executing the subprocess in shell mode or not (there's also a "shell" method).
As we can see here https://docs.python.org/3.9/reference/lexical_analysis.html#keywords
"exec" is not reserved.
Moreover, it's pretty counterintuitive that the code parses and runs correctly (cpython 3.9.5) but the lib2to3 parser crashes.
See below a working example:
terryjreedy commentedon May 28, 2021
'exec' was a keyword in 2.x, but that should not matter in 3.9. What OS? Did you get an actual crash (core dump on *nix), or a python exception and traceback (not a crash)? If the latter, copy and paste it.
Mulugruntz commentedon May 29, 2021
Mulugruntz commentedon May 29, 2021
Sorry, I forgot to mention:
macOS Mojave 10.14.5 (18F132)
iritkatriel commentedon Sep 7, 2021
Changing type as crash typically refers to segfault and not an exception.
Mulugruntz commentedon Apr 15, 2022
Hi @iritkatriel , do we know the readon why it was closed?
iritkatriel commentedon Apr 15, 2022
lib2to3 is deprecated, core devs will not be working on it anymore.