FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-132542: Set native thread ID after fork by noamcohen97 · Pull Request #132701 · python/cpython · GitHub

Repository navigation

gh-132542: Set native thread ID after fork - #132701

Merged
serhiy-storchaka merged 5 commits into
python:mainfrom
noamcohen97:fork-tid
May 20, 2025
Merged

serhiy-storchaka merged 5 commits into
python:mainfrom
noamcohen97:fork-tid

Conversation

noamcohen97 commented Apr 18, 2025 •
edited by bedevere-app Bot
Loading

Copy link
Copy Markdown
Contributor

Since most of Python's runtime state, including thread-related data, is only consistent after PyOS_AfterFork_Child() is called, updating native_id in the after_fork handler ensures correctness and aligns with Python’s existing fork-handling mechanisms.

ZeroIntensity left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Needs a blurb entry.

Comment thread Lib/test/test_threading.py Outdated
ZeroIntensity added the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Apr 19, 2025

Copy link
Copy Markdown

🤖 New build scheduled with the buildbot fleet by @ZeroIntensity for commit 6ebd095 🤖

Results will be shown at:

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

If you want to schedule another build, you need to add the 🔨 test-with-buildbots label again.

bedevere-bot removed the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Apr 19, 2025

ZeroIntensity left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

LGTM

Comment thread Lib/test/test_threading.py Outdated
serhiy-storchaka added the needs backport to 3.14 bugs and security fixes label May 8, 2025
noamcohen97 requested a review from gpshead May 20, 2025 15:58

serhiy-storchaka left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

LGTM. 👍👍

serhiy-storchaka enabled auto-merge (squash) May 20, 2025 16:15
serhiy-storchaka merged commit 6b73502 into python:main May 20, 2025

Copy link
Copy Markdown

Thanks @noamcohen97 for the PR, and @serhiy-storchaka for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request May 20, 2025
(cherry picked from commit 6b73502)

Co-authored-by: Noam Cohen <noam@noam.me>

Copy link
Copy Markdown

Sorry, @noamcohen97 and @serhiy-storchaka, I could not cleanly backport this to 3.13 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker 6b735023132a4ac9dc5b849d982104eeb1e8bdad 3.13

bedevere-app Bot commented May 20, 2025

Copy link
Copy Markdown

GH-134356 is a backport of this pull request to the 3.14 branch.

bedevere-app Bot removed the needs backport to 3.14 bugs and security fixes label May 20, 2025

bedevere-app Bot commented May 20, 2025

Copy link
Copy Markdown

GH-134361 is a backport of this pull request to the 3.13 branch.

bedevere-app Bot removed the needs backport to 3.13 only security fixes label May 20, 2025
serhiy-storchaka pushed a commit that referenced this pull request May 20, 2025
)

(cherry picked from commit 6b73502)

Co-authored-by: Noam Cohen <noam@noam.me>
serhiy-storchaka pushed a commit that referenced this pull request May 20, 2025
noamcohen97 deleted the fork-tid branch May 20, 2025 17:31

kulikjak commented May 21, 2025 •
edited
Loading

Copy link
Copy Markdown
Contributor

Hi, the newly added test fails on systems without native_id:

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 Lib/threading.py does check for its existence, the test does not)

Copy link
Copy Markdown
Contributor Author

@kulikjak Thank you for noticing. I apologize for that.
I have created #134408 to address the issue.

@serhiy-storchaka Can you please help with merging the fix?

Copy link
Copy Markdown
Contributor

No worries, thanks for the fix!

lkollar pushed a commit to lkollar/cpython that referenced this pull request May 26, 2025
Pranjal095 pushed a commit to Pranjal095/cpython that referenced this pull request Jul 12, 2025
taegyunkim pushed a commit to taegyunkim/cpython that referenced this pull request Aug 4, 2025
serhiy-storchaka removed their assignment Jul 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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.

6 participants


Back | FazBrowse Home | New Git URL