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

gh-141460: Simplify threading.RLock implementation by removing dead code by KanaparthySaiSreekar · Pull Request #141462 · python/cpython · GitHub

/ cpython Public

gh-141460: Simplify threading.RLock implementation by removing dead code - #141462

Closed
KanaparthySaiSreekar wants to merge 1 commit into
python:mainfrom
KanaparthySaiSreekar:claude/simplify-rlock-implementation-011CV3ujQaEv7gQvgnHUzuci
Closed

gh-141460: Simplify threading.RLock implementation by removing dead code#141462
KanaparthySaiSreekar wants to merge 1 commit into
python:mainfrom
KanaparthySaiSreekar:claude/simplify-rlock-implementation-011CV3ujQaEv7gQvgnHUzuci

Conversation

KanaparthySaiSreekar commented Nov 12, 2025
edited by bedevere-app Bot
Loading

Copy link
Copy Markdown

The C implementation of RLock (_thread.RLock) is now always available on all supported platforms, making the Python fallback implementation and the factory function unnecessary.

Changes:

  • Remove _RLock class (Python implementation) from Lib/threading.py
  • Replace RLock() factory function with direct alias to _thread.RLock
  • Remove _PyRLock and _CRLock aliases
  • Update tests to use threading.RLock instead of _PyRLock or _CRLock
  • Remove PyRLockTests class and merge CRLockTests into RLockTests
  • Update test_free_threading/test_monitoring.py to use RLock

This simplification removes ~150 lines of dead code while maintaining full backward compatibility, as threading.RLock remains callable and returns the same C-based RLock instances as before.

The C implementation of RLock (_thread.RLock) is now always available
on all supported platforms, making the Python fallback implementation
and the factory function unnecessary.

Changes:
- Remove _RLock class (Python implementation) from Lib/threading.py
- Replace RLock() factory function with direct alias to _thread.RLock
- Remove _PyRLock and _CRLock aliases
- Update tests to use threading.RLock instead of _PyRLock or _CRLock
- Remove PyRLockTests class and merge CRLockTests into RLockTests
- Update test_free_threading/test_monitoring.py to use RLock

This simplification removes ~150 lines of dead code while maintaining
full backward compatibility, as threading.RLock remains callable and
returns the same C-based RLock instances as before.

Copy link
Copy Markdown

The following commit authors need to sign the Contributor License Agreement:

bedevere-app Bot commented Nov 12, 2025

Copy link
Copy Markdown

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.

StanFromIreland commented Nov 12, 2025
edited
Loading

Copy link
Copy Markdown
Member

Closing, seeing the CI this is pretty clearly not dead code. Removing public functions needs deprecation cycles too. Please open a discussion first.

Copy link
Copy Markdown
Member

Ah, there is indeed already an issue for this. cc @larryhastings

bedevere-app Bot commented Nov 12, 2025

Copy link
Copy Markdown

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.

StanFromIreland changed the title Simplify threading.RLock implementation by removing dead code gh-141460: Simplify threading.RLock implementation by removing dead code Nov 12, 2025
StanFromIreland marked this pull request as draft November 12, 2025 16:50

zware commented Nov 12, 2025

Copy link
Copy Markdown
Member

Closing anyway; Claude is never going to sign the CLA. See also the devguide chapter on generative AI.

zware closed this Nov 12, 2025
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.

4 participants


Back | FazBrowse Home | New Git URL