https://github.com/python/cpython/commit/4be1d35d02c56df71d35d790c54496768ecfaad6
commit: 4be1d35d02c56df71d35d790c54496768ecfaad6
branch: main
author: Hood Chatham <[email protected]>
committer: freakboy3742 <[email protected]>
date: 2026-10-22T14:03:02-07:00
summary:

Emscripten: Only call DumpTraceback if it exists (#160305)

Prevents an error-inside-of-error situation. Since we know that something has
gone wrong already, the runtime might be in a bad state.

files:
M Platforms/emscripten/node_entry.mjs

diff --git a/Platforms/emscripten/node_entry.mjs 
b/Platforms/emscripten/node_entry.mjs
index 110aadc5de1014..9e790583f5eb9f 100644
--- a/Platforms/emscripten/node_entry.mjs
+++ b/Platforms/emscripten/node_entry.mjs
@@ -57,6 +57,11 @@ try {
   // Show JavaScript exception and traceback
   console.warn(e);
   // Show Python exception and traceback
-  Module.PyUnstable_DumpTraceback(2, Module._PyGILState_GetThisThreadState());
+  try {
+    Module.PyUnstable_DumpTraceback?.(2, 
Module._PyGILState_GetThisThreadState());
+  } catch(e) {
+    console.warn("Error occurred while attempting to format a Python 
traceback:");
+    console.warn(e);
+  }
   process.exit(1);
 }

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to