gh-132578: Add regression test ensuring Thread subclasses can safely define _handle#150322
Closed
Vaibhav-S-Gowda wants to merge 2 commits into
Closed
gh-132578: Add regression test ensuring Thread subclasses can safely define _handle#150322Vaibhav-S-Gowda wants to merge 2 commits into
Vaibhav-S-Gowda wants to merge 2 commits into
Conversation
…afely define _handle
|
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
Member
|
This is an unnecessary test. |
Member
|
And please read https://devguide.python.org/getting-started/generative-ai to understand our stand about AI. PRs that are just generated by AI for contribution points will be rejected and users banned from interacting with the repository should they abuse this. |
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
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR introduces a dedicated regression test to
Lib/test/test_threading.pyto prevent future namespace collisions on the_handleattribute within thethreading.Threadclass lifecycle.Rationale
In Python 3.13, the introduction of an internal
_handletracking parameter inadvertently shadowed custom_handlemethods or attributes defined by third-party frameworks (such asgevent) which subclassthreading.Thread. While the core engine has since migrated its internal variable to_os_thread_handleto resolve the conflict, an explicit test suite assertion was missing. This regression test ensures that user-defined subclasses can natively implement a customself._handleattribute without interfering with standard library operations or causing unexpected runtime behavior.Verification
./python -m test test_threading -v