8000 gh-102114: Make dis print more concise tracebacks for syntax errors in str inputs by chgnrdv · Pull Request #102115 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-102114: Make dis print more concise tracebacks for syntax errors in str inputs #102115

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Apr 15, 2023
Prev Previous commit
get rid of 'c' variable
  • Loading branch information
chgnrdv committed Apr 14, 2023
commit 5ff58bbe9ec634204b2925216d50b17d0fc0029a
8 changes: 3 additions & 5 deletions Lib/dis.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,10 @@ def _try_compile(source, name):
expect code objects
"""
try:
c = compile(source, name, 'eval')
return compile(source, name, 'eval')
except SyntaxError:
c = None
if not c:
c = compile(source, name, 'exec')
return c
pass
return compile(source, name, 'exec')

def dis(x=None, *, file=None, depth=None, show_caches=False, adaptive=False):
"""Disassemble classes, methods, functions, and other compiled objects.
Expand Down
0