Rémi Lapeyre <[email protected]> added the comment:
This is related to issue 16180, it may be possible to improve the situation by
trying to determine whether the SyntaxError is in the file or came during its
execution by looking at the filename but it's probably very brittle:
# In most cases SystemExit does not warrant a post-mortem session.
print("The program exited via sys.exit(). Exit status:", end=' ')
print(sys.exc_info()[1])
- except SyntaxError:
- traceback.print_exc()
- sys.exit(1)
- except:
+ except Exception as e:
+ if (type(e) is SyntaxError and
+ e.filename == os.path.abspath(mainpyfile)):
+ traceback.print_exc()
+ sys.exit(1)
traceback.print_exc()
print("Uncaught exception. Entering post mortem debugging")
print("Running 'cont' or 'step' will restart the program")
----------
nosy: +terry.reedy, xdegaye
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue40403>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com