PY-37212 Show traceback when terminating on uncaught exception

GitOrigin-RevId: 0c2772e0449a5ff5be06d1b0398e70abeae56dfd
This commit is contained in:
Andrey Lisin
2019-09-03 15:34:42 +00:00
committed by intellij-monorepo-bot
parent b5e998646f
commit bfe9d87d54
2 changed files with 11 additions and 0 deletions
+7
View File
@@ -1189,6 +1189,13 @@ class PyDB(object):
pydev_log.debug("We are stopping in post-mortem\n")
thread_id = get_thread_id(thread)
pydevd_vars.add_additional_frame_by_id(thread_id, frames_byid)
exctype, value, tb = arg
while tb:
if self.is_top_level_trace_in_project_scope(tb):
break
tb = tb.tb_next
sys.__excepthook__(exctype, value, tb)
sys.excepthook = lambda type, value, traceback: None # Avoid printing the exception for the second time.
try:
try:
add_exception_to_frame(frame, arg)
@@ -456,6 +456,10 @@ public class PythonDebuggerTest extends PyEnvTestCase {
public void testing() throws Exception {
waitForPause();
waitForOutput("message=\"python-exceptions.ZeroDivisionError\"", "message=\"python-builtins.ZeroDivisionError\"");
waitForOutput("Traceback (most recent call last):");
waitForOutput("line 7, in foo");
waitForOutput("return 1 / x");
waitForOutput("ZeroDivisionError: ");
eval("__exception__[0].__name__").hasValue("'ZeroDivisionError'");
resume();
waitForTerminate();