Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

Open
alexmalyshev wants to merge 6 commits intopython:mainfrom
alexmalyshev:dump-traceback
Open

gh-145559: Add PyUnstable_DumpTraceback() and PyUnstable_DumpTracebackThreads()#145560
alexmalyshev wants to merge 6 commits intopython:mainfrom
alexmalyshev:dump-traceback

Conversation

@alexmalyshev
Copy link
Contributor

@alexmalyshevalexmalyshev commentedMar 5, 2026
edited by bedevere-appbot
Loading

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.

@bedevere-app
Copy link

Most changes to Pythonrequire a NEWS entry. Add one using theblurb_it web app or theblurb command-line tool.

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

@vstinner
Copy link
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

@bedevere-app
Copy link

Most changes to Pythonrequire a NEWS entry. Add one using theblurb_it web app or theblurb command-line tool.

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

@alexmalyshev
Copy link
ContributorAuthor

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

@sergey-miryanov
Copy link
Contributor

I believe they should havePyUnstable_ prefix, notPyUnsafe_.

vstinner and alexmalyshev reacted with thumbs up emoji

@alexmalyshev
Copy link
ContributorAuthor

I believe they should havePyUnstable_ prefix, notPyUnsafe_.

Ack I always make this mistake...

…functionsThese functions stopped being exported inpython#107215.  However, they are the onlyway to print a Python stacktrace safely from a signal handler, making them veryuseful for extensions.  Re-export them as PyUnstable functions.
@sergey-miryanov
Copy link
Contributor

Please,try to avoid force-push.

alexmalyshev reacted with thumbs up emoji

@freakboy3742
Copy link
Contributor

!buildbot emscripten

@bedevere-bot
Copy link

🤖 New build scheduled with the buildbot fleet by@freakboy3742 for commit538a1cd 🤖

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

Copy link
Member

@ZeroIntensityZeroIntensity left a comment

Choose a reason for hiding this comment

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

Note thatPyUnstable_DumpTracebackThreads does not work well on the free-threaded build, because other threads may exit and delete theirPyThreadState *. 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.

it is very limited. Strings are truncated to 100 characters and encoded to
ASCII with backslashreplace. It doesn't write the source code, only the
function name, filename and line number of each frame. Write only the first
100 frames: if the traceback is truncated, write the line " ...".
Copy link
Member

Choose a reason for hiding this comment

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

It sounds useful to move or copy this comment into the Doc/c-api/ documentation. Same remark for PyUnstable_DumpTracebackThreads() comment.

alexmalyshev reacted with thumbs up emoji
@vstinnervstinner changed the titlegh-145559: Re-export _Py_DumpTraceback and _Py_DumpTracebackThreadsgh-145559: Add PyUnstable_DumpTraceback() and PyUnstable_DumpTracebackThreads()Mar 6, 2026
Comment says 100, but it appears to have been 500 since 2012,54f939b.
Copy link
Member

@ZeroIntensityZeroIntensity left a 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 useblurb_it.
For the "What's New in Python 3.15" page, please add a note under the "C API changes" section (here).

alexmalyshev reacted with thumbs up emoji
Copy link
Member

@ZeroIntensityZeroIntensity left a comment

Choose a reason for hiding this comment

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

One little issue with the blurb entry, but otherwise this looks good.

@@ -0,0 +1 @@
Rename `_Py_DumpTraceback` and `_Py_DumpTracebackThreads` to `PyUnstable_DumpTraceback` and `PyUnstable_DumpTracebackThreads`.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Rename `_Py_DumpTraceback` and `_Py_DumpTracebackThreads` to `PyUnstable_DumpTraceback` and `PyUnstable_DumpTracebackThreads`.
Rename ``_Py_DumpTraceback`` and ``_Py_DumpTracebackThreads`` to:c:func:`PyUnstable_DumpTraceback` and:c:func:`PyUnstable_DumpTracebackThreads`.

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

Reviewers

@vstinnervstinnervstinner left review comments

@ZeroIntensityZeroIntensityZeroIntensity left review comments

@ericsnowcurrentlyericsnowcurrentlyAwaiting requested review from ericsnowcurrentlyericsnowcurrently is a code owner

@FFY00FFY00Awaiting requested review from FFY00FFY00 is a code owner

@freakboy3742freakboy3742Awaiting requested review from freakboy3742freakboy3742 is a code owner

@emmatypingemmatypingAwaiting requested review from emmatypingemmatyping is a code owner

@erlend-aaslanderlend-aaslandAwaiting requested review from erlend-aaslanderlend-aasland is a code owner

@corona10corona10Awaiting requested review from corona10corona10 is a code owner

@AA-TurnerAA-TurnerAwaiting requested review from AA-TurnerAA-Turner is a code owner

Assignees

No one assigned

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

6 participants

@alexmalyshev@vstinner@sergey-miryanov@freakboy3742@bedevere-bot@ZeroIntensity

[8]ページ先頭

©2009-2026 Movatter.jp