Skip to content

gh-145559: Add PyUnstable_DumpTraceback() and PyUnstable_DumpTracebackThreads()#148145

Merged
vstinner merged 12 commits intopython:mainfrom
alexmalyshev:traceback
May 6, 2026
Merged

gh-145559: Add PyUnstable_DumpTraceback() and PyUnstable_DumpTracebackThreads()#148145
vstinner merged 12 commits intopython:mainfrom
alexmalyshev:traceback

Conversation

@alexmalyshev
Copy link
Copy Markdown
Contributor

@alexmalyshev alexmalyshev commented Apr 5, 2026

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.

Regenerated from #145560 due to a bad merge.


📚 Documentation preview 📚: https://cpython-previews--148145.org.readthedocs.build/

Public versions of _Py_DumpTraceback() and _Py_DumpTracebackThreads().
@vstinner
Copy link
Copy Markdown
Member

@alexmalyshev: There are now merge conflicts, can you try to solve them? Moreover, a new max_threads parameter has been added. Can you update your PR to add it?

@read-the-docs-community
Copy link
Copy Markdown

read-the-docs-community Bot commented May 1, 2026

Comment thread Doc/c-api/exceptions.rst Outdated
Comment thread Python/traceback.c Outdated
Copy link
Copy Markdown
Member

@vstinner vstinner left a comment

Choose a reason for hiding this comment

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

LGTM if my suggestions are applied :-)

Comment thread Doc/c-api/exceptions.rst Outdated
Comment thread Modules/faulthandler.c
Comment thread Doc/whatsnew/3.15.rst Outdated
Co-authored-by: Victor Stinner <vstinner@python.org>
@vstinner vstinner enabled auto-merge (squash) May 6, 2026 14:32
@vstinner vstinner merged commit 646853d into python:main May 6, 2026
56 checks passed
@alexmalyshev alexmalyshev deleted the traceback branch May 6, 2026 15:28
@alexmalyshev
Copy link
Copy Markdown
Contributor Author

Thanks for all the help @vstinner, I really appreciate it!

@vstinner
Copy link
Copy Markdown
Member

vstinner commented May 6, 2026

You're welcome. Thanks for your contribution.

@vstinner
Copy link
Copy Markdown
Member

vstinner commented May 6, 2026

There is no tests on the newly added C APIs. These functions are tested indirectly by test_faulthandler.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants