From 2b6f5c3483597abcb8422508aeffab04f500f568 Mon Sep 17 00:00:00 2001 From: chgnrdv <52372310+chgnrdv@users.noreply.github.com> Date: Sat, 15 Apr 2023 08:53:31 +0300 Subject: gh-102114: Make dis print more concise tracebacks for syntax errors in str inputs (#102115) --- Lib/dis.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'Lib/dis.py') 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. -- cgit v1.2.1