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 by hoodmane · Pull Request #131158 · python/cpython

Conversation

@hoodmane

@hoodmane hoodmane commented Mar 12, 2025 •
edited by bedevere-app Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

This PR solves two problems:

  1. No Python traceback shown on segfault/trap
  2. The JavaScript source line is shown

The JavaScript source line is super long and completely unenlightening, whereas the Python traceback is very helpful.

  • Issue: Emscripten: Make python.sh function as proper Python CLI #127503

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@hoodmane
hoodmane requested review from brettcannon, corona10, erlend-aasland and freakboy3742 as code owners March 12, 2025 16:40
@bedevere-app bedevere-app Bot added the awaiting review label Mar 12, 2025
@bedevere-app bedevere-app Bot mentioned this pull request Mar 12, 2025
Emscripten: Make python.sh function as proper Python CLI #127503
Closed
@hoodmane
pythongh-127503: Improve tracebacks on Emscripten when there is a trap
19a197c
This PR solves two problems:
1. No Python traceback shown on segfault/trap
2. The JavaScript source line is shown

The JavaScript source line is super long and completely unenlightening,
whereas the Python traceback is very helpful.
@hoodmane
hoodmane force-pushed the emscripten-better-tracebacks branch from f173d1f to 19a197c Compare March 12, 2025 16:41
@hoodmane hoodmane added the skip news label Mar 12, 2025
@hoodmane

hoodmane commented Mar 12, 2025

Copy link
Copy Markdown
Contributor Author

After this change a trap in the test suite looks as follows:

Details

Aborted(Assertion failed: callable != NULL, at: ../../../../Include/internal/pycore_call.h,116,_PyVectorcall_FunctionInline)
RuntimeError: Aborted(Assertion failed: callable != NULL, at: ../../../../Include/internal/pycore_call.h,116,_PyVectorcall_FunctionInline). Build with -sASSERTIONS for more info.
    at abort (file:///home/rchatham/cpython/cross-build/wasm32-emscripten/build/python/python.mjs:261:15)
    at ___assert_fail (file:///home/rchatham/cpython/cross-build/wasm32-emscripten/build/python/python.mjs:1735:7)
    at wasm://wasm/02f678e6:wasm-function[787]:0x1c26ed
    at wasm://wasm/02f678e6:wasm-function[798]:0x1c35ad
    at wasm://wasm/02f678e6:wasm-function[3560]:0x3575f2
    at wasm://wasm/02f678e6:wasm-function[3558]:0x30d1f8
    at wasm://wasm/02f678e6:wasm-function[3557]:0x30cfca
    at wasm://wasm/02f678e6:wasm-function[3519]:0x3084d2
    at wasm://wasm/02f678e6:wasm-function[3560]:0x318045
    at wasm://wasm/02f678e6:wasm-function[3558]:0x30d1f8
Stack (most recent call first):
  File "<frozen __hello__>", line 0 in <module>
  File "<frozen importlib._bootstrap>", line 1176 in exec_module
  File "<frozen importlib._bootstrap>", line 935 in _load_unlocked
  File "<frozen importlib._bootstrap>", line 1339 in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 1368 in _find_and_load
  File "/home/rchatham/cpython/Lib/importlib/util.py", line 90 in find_spec
  File "/home/rchatham/cpython/Lib/test/test_ctypes/test_values.py", line 85 in test_frozentable
  File "/home/rchatham/cpython/Lib/unittest/case.py", line 606 in _callTestMethod
  File "/home/rchatham/cpython/Lib/unittest/case.py", line 660 in run
  File "/home/rchatham/cpython/Lib/unittest/case.py", line 716 in __call__
  File "/home/rchatham/cpython/Lib/unittest/suite.py", line 122 in run
  File "/home/rchatham/cpython/Lib/unittest/suite.py", line 84 in __call__
  File "/home/rchatham/cpython/Lib/unittest/suite.py", line 122 in run
  File "/home/rchatham/cpython/Lib/unittest/suite.py", line 84 in __call__
  File "/home/rchatham/cpython/Lib/unittest/suite.py", line 122 in run
  File "/home/rchatham/cpython/Lib/unittest/suite.py", line 84 in __call__
  File "/home/rchatham/cpython/Lib/unittest/suite.py", line 122 in run
  File "/home/rchatham/cpython/Lib/unittest/suite.py", line 84 in __call__
  File "/home/rchatham/cpython/Lib/test/libregrtest/testresult.py", line 148 in run
  File "/home/rchatham/cpython/Lib/test/libregrtest/single.py", line 84 in _run_suite
  File "/home/rchatham/cpython/Lib/test/libregrtest/single.py", line 42 in run_unittest
  File "/home/rchatham/cpython/Lib/test/libregrtest/single.py", line 162 in test_func
  File "/home/rchatham/cpython/Lib/test/libregrtest/single.py", line 118 in regrtest_runner
  File "/home/rchatham/cpython/Lib/test/libregrtest/single.py", line 165 in _load_run_test
  File "/home/rchatham/cpython/Lib/test/libregrtest/single.py", line 210 in _runtest_env_changed_exc
  File "/home/rchatham/cpython/Lib/test/libregrtest/single.py", line 319 in _runtest
  File "/home/rchatham/cpython/Lib/test/libregrtest/single.py", line 348 in run_single_test
  File "/home/rchatham/cpython/Lib/test/libregrtest/main.py", line 378 in run_test
  File "/home/rchatham/cpython/Lib/test/libregrtest/main.py", line 408 in run_tests_sequentially
  File "/home/rchatham/cpython/Lib/test/libregrtest/main.py", line 550 in _run_tests
  File "/home/rchatham/cpython/Lib/test/libregrtest/main.py", line 585 in run_tests
  File "/home/rchatham/cpython/Lib/test/libregrtest/main.py", line 757 in main
  File "/home/rchatham/cpython/Lib/test/libregrtest/main.py", line 765 in main
  File "/home/rchatham/cpython/Lib/test/__main__.py", line 2 in <module>
  File "/home/rchatham/cpython/Lib/runpy.py", line 88 in _run_code
  File "/home/rchatham/cpython/Lib/runpy.py", line 198 in _run_module_as_main

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@hoodmane
hoodmane removed request for brettcannon, corona10 and erlend-aasland March 12, 2025 16:42
hoodmane added 2 commits March 12, 2025 18:02
@hoodmane
Add @support.skip_emscripten_stack_overflow to test_infinite_cycle_in…
5e2f70e
…_bases
@hoodmane
Fix configure
6feebef
freakboy3742
freakboy3742 approved these changes Mar 13, 2025
View reviewed changes

@freakboy3742 freakboy3742 left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Definitely a nicer stack track than the previous behaviour 👍

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@bedevere-app bedevere-app Bot added awaiting merge and removed awaiting review labels Mar 13, 2025
@freakboy3742
freakboy3742 merged commit db1e582 into python:main Mar 13, 2025
@bedevere-app bedevere-app Bot removed the awaiting merge label Mar 13, 2025
@freakboy3742 freakboy3742 mentioned this pull request Mar 13, 2025
GH-130396: Work around for broken pthread_get_stackaddr_np on Emscripten #131088
Merged
plashchynski pushed a commit to plashchynski/cpython that referenced this pull request Mar 17, 2025
@hoodmane @plashchynski
pythongh-127503: Improve tracebacks on Emscripten when there is a trap (
23c17ba
python#131158)

Modifies the behavior of the interpreter on crash under Emscripten:
1. No Python traceback shown on segfault/trap
2. The JavaScript source line is shown

The JavaScript source line is super long and completely unenlightening,
whereas the Python traceback is very helpful.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@freakboy3742 freakboy3742 freakboy3742 approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

skip news

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@hoodmane @freakboy3742
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — 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.