summaryrefslogtreecommitdiff
path: root/Lib/dis.py
diff options
context:
space:
mode:
authorchgnrdv <52372310+chgnrdv@users.noreply.github.com>2023-04-15 08:53:31 +0300
committerGitHub <noreply@github.com>2023-04-15 06:53:31 +0100
commit2b6f5c3483597abcb8422508aeffab04f500f568 (patch)
tree6b2d4905acf15014f334c287b5c5f7bf498c48bc /Lib/dis.py
parent8af8f52d175959f03cf4a2786b6a81ec09e15e95 (diff)
downloadcpython-git-2b6f5c3483597abcb8422508aeffab04f500f568.tar.gz
gh-102114: Make dis print more concise tracebacks for syntax errors in str inputs (#102115)
Diffstat (limited to 'Lib/dis.py')
-rw-r--r--Lib/dis.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/Lib/dis.py b/Lib/dis.py
index b39b283533..6a7fcb8a1a 100644
--- a/Lib/dis.py
+++ b/Lib/dis.py
@@ -64,10 +64,10 @@ def _try_compile(source, name):
expect code objects
"""
try:
- c = compile(source, name, 'eval')
+ return compile(source, name, 'eval')
except SyntaxError:
- 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.