Skip to content

gh-132578: Add regression test ensuring Thread subclasses can safely define _handle#150322

Closed
Vaibhav-S-Gowda wants to merge 2 commits into
python:mainfrom
Vaibhav-S-Gowda:gh-132578-rename-thread-handle
Closed

gh-132578: Add regression test ensuring Thread subclasses can safely define _handle#150322
Vaibhav-S-Gowda wants to merge 2 commits into
python:mainfrom
Vaibhav-S-Gowda:gh-132578-rename-thread-handle

Conversation

@Vaibhav-S-Gowda
Copy link
Copy Markdown

@Vaibhav-S-Gowda Vaibhav-S-Gowda commented May 23, 2026

This PR introduces a dedicated regression test to Lib/test/test_threading.py to prevent future namespace collisions on the _handle attribute within the threading.Thread class lifecycle.

Rationale

In Python 3.13, the introduction of an internal _handle tracking parameter inadvertently shadowed custom _handle methods or attributes defined by third-party frameworks (such as gevent) which subclass threading.Thread. While the core engine has since migrated its internal variable to _os_thread_handle to resolve the conflict, an explicit test suite assertion was missing. This regression test ensures that user-defined subclasses can natively implement a custom self._handle attribute without interfering with standard library operations or causing unexpected runtime behavior.

Verification

  • Ran the local test suite on the modified source tree: ./python -m test test_threading -v
  • Verified that all 246 tests completed successfully with zero regressions or errors.

@bedevere-app bedevere-app Bot added the tests Tests in the Lib/test dir label May 23, 2026
@bedevere-app
Copy link
Copy Markdown

bedevere-app Bot commented May 23, 2026

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 skip news label instead.

@picnixz
Copy link
Copy Markdown
Member

picnixz commented May 23, 2026

This is an unnecessary test.

@picnixz picnixz closed this May 23, 2026
@picnixz
Copy link
Copy Markdown
Member

picnixz commented May 23, 2026

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.

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

Labels

awaiting review tests Tests in the Lib/test dir

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants