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-145559: Add PyUnstable_DumpTraceback() and PyUnstable_DumpTracebackThreads() by alexmalyshev · Pull Request #145560 · python/cpython

Conversation

@alexmalyshev

@alexmalyshev alexmalyshev commented Mar 5, 2026 •
edited by bedevere-app Bot
Loading

Uh oh!

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

Copy link
Copy Markdown
Contributor

These functions stopped being exported in #107215. However, they are the only way to print a Python stacktrace safely from a signal handler, making them very useful for extensions. Re-export them.

  • Issue: Expose signal-safe way to print stacktraces #145559

Sorry, something went wrong.

Uh oh!

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

All reactions
@bedevere-app

bedevere-app Bot commented Mar 5, 2026

Copy link
Copy Markdown

Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool.

If this change has little impact on Python users, wait for a maintainer to apply the skip news label instead.

All reactions

Sorry, something went wrong.

Uh oh!

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

@bedevere-app bedevere-app Bot mentioned this pull request Mar 5, 2026
Expose signal-safe way to print stacktraces #145559
Closed
@bedevere-app bedevere-app Bot added the awaiting review label Mar 5, 2026
@vstinner

vstinner commented Mar 5, 2026

Copy link
Copy Markdown
Member

Rather than exporting internal C API functions, I would prefer to promote them as public or PyUnstable functions.

alexmalyshev reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

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

@alexmalyshev
alexmalyshev force-pushed the dump-traceback branch from cb5cf36 to d7f6643 Compare March 5, 2026 18:27
@alexmalyshev
alexmalyshev requested review from AA-Turner, FFY00, ZeroIntensity, corona10, emmatyping, ericsnowcurrently, erlend-aasland and freakboy3742 as code owners March 5, 2026 18:27
@bedevere-app

bedevere-app Bot commented Mar 5, 2026

Copy link
Copy Markdown

Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool.

If this change has little impact on Python users, wait for a maintainer to apply the skip news label instead.

All reactions

Sorry, something went wrong.

Uh oh!

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

@alexmalyshev

alexmalyshev commented Mar 5, 2026

Copy link
Copy Markdown
Contributor Author

Made them PyUnsafe_ functions. I believe that the mentions to them in the configure and emscripten files can just be deleted now that they'll be public.

All reactions

Sorry, something went wrong.

Uh oh!

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

@sergey-miryanov

sergey-miryanov commented Mar 5, 2026

Copy link
Copy Markdown
Contributor

I believe they should have PyUnstable_ prefix, not PyUnsafe_.

vstinner and alexmalyshev reacted with thumbs up emoji
All reactions
  • 👍 2 reactions

Sorry, something went wrong.

Uh oh!

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

@alexmalyshev

alexmalyshev commented Mar 5, 2026

Copy link
Copy Markdown
Contributor Author

I believe they should have PyUnstable_ prefix, not PyUnsafe_.

Ack I always make this mistake...

All reactions

Sorry, something went wrong.

Uh oh!

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

@alexmalyshev
alexmalyshev force-pushed the dump-traceback branch from d7f6643 to 28803eb Compare March 5, 2026 19:12
@alexmalyshev
Export _Py_DumpTraceback and _Py_DumpTracebackThreads as PyUnstable_ …
d0c95ed
…functions

These functions stopped being exported in python#107215.  However, they are the only
way to print a Python stacktrace safely from a signal handler, making them very
useful for extensions.  Re-export them as PyUnstable functions.
@alexmalyshev
alexmalyshev force-pushed the dump-traceback branch from 28803eb to d0c95ed Compare March 5, 2026 20:39
@sergey-miryanov

sergey-miryanov commented Mar 5, 2026

Copy link
Copy Markdown
Contributor

Please, try to avoid force-push.

alexmalyshev reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

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

@alexmalyshev
Add written docs, move decls to cpython/traceback.h to avoid modifyin…
538a1cd
…g Limited API
@freakboy3742

freakboy3742 commented Mar 5, 2026

Copy link
Copy Markdown
Contributor

!buildbot emscripten

All reactions

Sorry, something went wrong.

Uh oh!

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

@bedevere-bot

bedevere-bot commented Mar 5, 2026

Copy link
Copy Markdown

🤖 New build scheduled with the buildbot fleet by @freakboy3742 for commit 538a1cd 🤖

Results will be shown at:

https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F145560%2Fmerge

The command will test the builders whose names match following regular expression: emscripten

The builders matched are:

  • WASM Emscripten PR
All reactions

Sorry, something went wrong.

Uh oh!

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

ZeroIntensity
ZeroIntensity reviewed Mar 6, 2026
View reviewed changes

@ZeroIntensity ZeroIntensity left a comment

Copy link
Copy Markdown
Member

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.

Note that PyUnstable_DumpTracebackThreads does not work well on the free-threaded build, because other threads may exit and delete their PyThreadState *. I think it's worth adding a warning for that. Here's an example:

.. warning::
    On the :term:`free-threaded build`, this function is not thread-safe. If
    another thread deletes its :term:`thread state` while this function is being
    called, the process will likely crash.

Sorry, something went wrong.

Uh oh!

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

All reactions
Comment thread Doc/c-api/exceptions.rst Resolved

Uh oh!

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

Comment thread Doc/c-api/exceptions.rst Resolved

Uh oh!

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

Comment thread Doc/c-api/exceptions.rst Resolved

Uh oh!

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

Comment thread Doc/c-api/exceptions.rst Resolved

Uh oh!

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

Comment thread Doc/c-api/exceptions.rst Resolved

Uh oh!

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

vstinner
vstinner reviewed Mar 6, 2026
View reviewed changes
Comment thread Include/cpython/traceback.h Resolved

Uh oh!

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

Comment thread Doc/c-api/exceptions.rst Resolved

Uh oh!

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

Comment thread Doc/c-api/exceptions.rst Resolved

Uh oh!

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

@vstinner vstinner changed the title gh-145559: Re-export _Py_DumpTraceback and _Py_DumpTracebackThreads gh-145559: Add PyUnstable_DumpTraceback() and PyUnstable_DumpTracebackThreads() Mar 6, 2026
@alexmalyshev
Move comments into Doc/c-api, fix documented string length
e497d2e
Comment says 100, but it appears to have been 500 since 2012,
54f939b.
ZeroIntensity
ZeroIntensity reviewed Mar 6, 2026
View reviewed changes

@ZeroIntensity ZeroIntensity left a comment

Copy link
Copy Markdown
Member

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.

Please also add an entry to the changelog and "What's New in Python 3.15".

For the changelog, you can use blurb_it.
For the "What's New in Python 3.15" page, please add a note under the "C API changes" section (here).

Sorry, something went wrong.

Uh oh!

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

alexmalyshev reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
Comment thread Doc/c-api/exceptions.rst Resolved

Uh oh!

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

Comment thread Doc/c-api/exceptions.rst Resolved

Uh oh!

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

Comment thread Doc/c-api/exceptions.rst Resolved

Uh oh!

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

@alexmalyshev
Address comments on C API docs, add whatsnew entry
50e6501
@alexmalyshev
alexmalyshev requested review from a team, DinoV, Fidget-Spinner, Yhg1s, brandtbucher, brettcannon, diegorusso, ezio-melotti, iritkatriel, methane, mhsmith, ncoghlan, sethmlarson, tomasr8 and webknjaz as code owners April 5, 2026 20:55
@python-cla-bot

python-cla-bot Bot commented Apr 5, 2026 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown

The following commit authors need to sign the Contributor License Agreement:

  • [email protected]
  • [email protected]

CLA not signed

All reactions

Sorry, something went wrong.

Uh oh!

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

@StanFromIreland StanFromIreland closed this Apr 5, 2026
@StanFromIreland
StanFromIreland removed request for a team, ambv, berkerpeksag, brettcannon, freakboy3742, gpshead, mhsmith and vsajip April 5, 2026 21:11
@pablogsal

pablogsal commented Apr 5, 2026

Copy link
Copy Markdown
Member

Something really bad happened here. Can you try to reset the PR? :)

alexmalyshev reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

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

@alexmalyshev

alexmalyshev commented Apr 5, 2026

Copy link
Copy Markdown
Contributor Author

Yeah I screwed something up badly, my bad!

All reactions

Sorry, something went wrong.

Uh oh!

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

@alexmalyshev alexmalyshev mentioned this pull request Apr 5, 2026
gh-145559: Add PyUnstable_DumpTraceback() and PyUnstable_DumpTracebackThreads() #148145
Merged
@vstinner vstinner mentioned this pull request Jul 19, 2026
gh-145559: Make PyUnstable_DumpTraceback return void again #154131
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@vstinner vstinner vstinner approved these changes
@encukou encukou encukou left review comments
@colesbury colesbury colesbury left review comments
@ZeroIntensity ZeroIntensity ZeroIntensity approved these changes

Uh oh!

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

Assignees

No one assigned

Labels

awaiting merge

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.

20 participants

@alexmalyshev @vstinner @sergey-miryanov @freakboy3742 @bedevere-bot @pablogsal @encukou @colesbury @ZeroIntensity @KRXNA572010 @StanFromIreland @jaraco @markshannon @kumaraditya303 @andreuu-tsai @jonathandung @hugovk @serhiy-storchaka @aisk @Sacul0457
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.