GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-127503: Improve tracebacks on Emscripten when there is a trap · python/cpython@f173d1f

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • Tools/wasm/emscripten
    • node_entry.mjs
  • configure.ac
  • configure
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎Tools/wasm/emscripten/node_entry.mjs‎

Copy file name to clipboardExpand all lines: Tools/wasm/emscripten/node_entry.mjs
+14-1Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,16 @@ const thisProgramIndex = process.argv.findIndex((x) =>
3232

3333
const settings = {
3434
preRun(Module) {
35+
// Globally expose API object so we can access it if we raise on startup.
36+
globalThis.Module = Module;
3537
mountDirectories(Module);
3638
Module.FS.chdir(process.cwd());
3739
Object.assign(Module.ENV, process.env);
3840
delete Module.ENV.PATH;
3941
},
42+
onExit(x) {
43+
console.log("onExit", ...arguments);
44+
},
4045
// Ensure that sys.executable, sys._base_executable, etc point to python.sh
4146
// not to this file. To properly handle symlinks, python.sh needs to compute
4247
// its own path.
@@ -45,4 +50,12 @@ const settings = {
4550
arguments: process.argv.slice(thisProgramIndex + 1),
4651
};
4752

48-
await EmscriptenModule(settings);
53+
try {
54+
await EmscriptenModule(settings);
55+
} catch(e) {
56+
// Show JavaScript exception and traceback
57+
console.warn(e);
58+
// Show Python exception and traceback
59+
Module.__Py_DumpTraceback(2, Module._PyGILState_GetThisThreadState());
60+
process.exit(1);
61+
}
Collapse file

‎configure‎

Copy file name to clipboardExpand all lines: configure
+1-1Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Collapse file

‎configure.ac‎

Copy file name to clipboardExpand all lines: configure.ac
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2370,7 +2370,7 @@ AS_CASE([$ac_sys_system],
23702370
dnl Include file system support
23712371
AS_VAR_APPEND([LINKFORSHARED], [" -sFORCE_FILESYSTEM -lidbfs.js -lnodefs.js -lproxyfs.js -lworkerfs.js"])
23722372
AS_VAR_APPEND([LINKFORSHARED], [" -sEXPORTED_RUNTIME_METHODS=FS,callMain,ENV"])
2373-
AS_VAR_APPEND([LINKFORSHARED], [" -sEXPORTED_FUNCTIONS=_main,_Py_Version,__PyRuntime,__PyEM_EMSCRIPTEN_COUNT_ARGS_OFFSET"])
2373+
AS_VAR_APPEND([LINKFORSHARED], [" -sEXPORTED_FUNCTIONS=_main,_Py_Version,__PyRuntime,__PyEM_EMSCRIPTEN_COUNT_ARGS_OFFSET,_PyGILState_GetThisThreadState,__Py_DumpTraceback"])
23742374
AS_VAR_APPEND([LINKFORSHARED], [" -sSTACK_SIZE=5MB"])
23752375
23762376
AS_VAR_IF([enable_wasm_dynamic_linking], [yes], [

0 commit comments

Comments
0 (0)
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.