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-87135: threading.Lock: Raise rather than hang on Python finalization#135991

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
encukou merged 6 commits intopython:mainfromencukou:no-acquire-in-finalize
Jul 1, 2025

Conversation

@encukou
Copy link
Member

@encukouencukou commentedJun 26, 2025
edited by bedevere-appbot
Loading

After Python finalization gets to the point where no other thread can attach thread state, attempting to acquire a Python lock will hang.
Raise PythonFinalizationError instead of hanging.

@colesbury, does this look maintainable (and correct) to you?

…lizationAfter Python finalization gets to the point where no other threadcan attach thread state, attempting to acquire a Python lock musthang.Raise PythonFinalizationError instead of hanging.
Copy link
Contributor

@colesburycolesbury left a comment

Choose a reason for hiding this comment

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

I think this approach makes sense. A comment about the flags below

@vstinner
Copy link
Member

Tests / Windows (free-threading) / Build and test (arm64) (pull_request)
Tests / Windows (free-threading) / Build and test (x64) (pull_request)

There is a suspicious error when running test.test_multiprocessing_spawn.test_processes:

Assertion failed: !PyErr_Occurred(), file D:\a\cpython\cpython\Python\specialize.c, line 740Fatal Python error: Aborted<Cannot show all threads while the GIL is disabled>Stack (most recent call first):  File "D:\a\cpython\cpython\Lib\logging\__init__.py", line 891 in _removeHandlerRefCurrent thread's C stack trace (most recent call first):  <cannot get C stack on this system>

Copy link
Member

@vstinnervstinner left a comment

Choose a reason for hiding this comment

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

LGTM

@encukouencukou merged commitfe119a0 intopython:mainJul 1, 2025
44 checks passed
@encukouencukou deleted the no-acquire-in-finalize branchJuly 1, 2025 08:57
AndPuQing pushed a commit to AndPuQing/cpython that referenced this pull requestJul 11, 2025
…lization (pythonGH-135991)After Python finalization gets to the point where no other threadcan attach thread state, attempting to acquire a Python lock must hang.Raise PythonFinalizationError instead of hanging.
Pranjal095 pushed a commit to Pranjal095/cpython that referenced this pull requestJul 12, 2025
…lization (pythonGH-135991)After Python finalization gets to the point where no other threadcan attach thread state, attempting to acquire a Python lock must hang.Raise PythonFinalizationError instead of hanging.
picnixz pushed a commit to picnixz/cpython that referenced this pull requestJul 13, 2025
…lization (pythonGH-135991)After Python finalization gets to the point where no other threadcan attach thread state, attempting to acquire a Python lock must hang.Raise PythonFinalizationError instead of hanging.
taegyunkim pushed a commit to taegyunkim/cpython that referenced this pull requestAug 4, 2025
…lization (pythonGH-135991)After Python finalization gets to the point where no other threadcan attach thread state, attempting to acquire a Python lock must hang.Raise PythonFinalizationError instead of hanging.
Agent-Hellboy pushed a commit to Agent-Hellboy/cpython that referenced this pull requestAug 19, 2025
…lization (pythonGH-135991)After Python finalization gets to the point where no other threadcan attach thread state, attempting to acquire a Python lock must hang.Raise PythonFinalizationError instead of hanging.
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@colesburycolesburycolesbury left review comments

@ZeroIntensityZeroIntensityZeroIntensity left review comments

@vstinnervstinnervstinner approved these changes

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

4 participants

@encukou@vstinner@colesbury@ZeroIntensity

[8]ページ先頭

©2009-2025 Movatter.jp