gh-132542: Set native thread ID after fork#132701
gh-132542: Set native thread ID after fork#132701serhiy-storchaka merged 5 commits intopython:mainfrom
Conversation
|
🤖 New build scheduled with the buildbot fleet by @ZeroIntensity for commit 6ebd095 🤖 Results will be shown at: If you want to schedule another build, you need to add the 🔨 test-with-buildbots label again. |
|
Thanks @noamcohen97 for the PR, and @serhiy-storchaka for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14. |
(cherry picked from commit 6b73502) Co-authored-by: Noam Cohen <[email protected]>
|
Sorry, @noamcohen97 and @serhiy-storchaka, I could not cleanly backport this to |
|
GH-134356 is a backport of this pull request to the 3.14 branch. |
|
GH-134361 is a backport of this pull request to the 3.13 branch. |
) (cherry picked from commit 6b73502) Co-authored-by: Noam Cohen <[email protected]>
|
Hi, the newly added test fails on systems without Traceback (most recent call last):
File "<string>", line 6, in <module>
parent_thread_native_id = threading.current_thread().native_id
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: '_MainThread' object has no attribute 'native_id'(while |
|
@kulikjak Thank you for noticing. I apologize for that. @serhiy-storchaka Can you please help with merging the fix? |
|
No worries, thanks for the fix! |
Since most of Python's runtime state, including thread-related data, is only consistent after
PyOS_AfterFork_Child()is called, updatingnative_idin theafter_forkhandler ensures correctness and aligns with Python’s existing fork-handling mechanisms.