diff options
author | Nikita Sobolev <mail@sobolevn.me> | 2024-01-25 19:46:32 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-25 19:46:32 (GMT) |
commit | d96358ff9de646dbf64dfdfed46d510da7ec4803 (patch) | |
tree | ab98adc8df28364e72a0ae3ab6db75027d8ef34e /Lib/threading.py | |
parent | b52fc70d1ab3be7866ab71065bae61a03a28bfae (diff) | |
download | cpython-d96358ff9de646dbf64dfdfed46d510da7ec4803.zip cpython-d96358ff9de646dbf64dfdfed46d510da7ec4803.tar.gz cpython-d96358ff9de646dbf64dfdfed46d510da7ec4803.tar.bz2 |
gh-114315: Make `threading.Lock` a real class, not a factory function (#114479)
`threading.Lock` is now the underlying class and is constructable rather than the old
factory function. This allows for type annotations to refer to it which had no non-ugly
way to be expressed prior to this.
---------
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
Diffstat (limited to 'Lib/threading.py')
-rw-r--r-- | Lib/threading.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/threading.py b/Lib/threading.py index ecf799b..00b95f8 100644 --- a/Lib/threading.py +++ b/Lib/threading.py @@ -5,7 +5,6 @@ import sys as _sys import _thread import functools import warnings -import _weakref from time import monotonic as _time from _weakrefset import WeakSet @@ -37,6 +36,7 @@ __all__ = ['get_ident', 'active_count', 'Condition', 'current_thread', _start_joinable_thread = _thread.start_joinable_thread _daemon_threads_allowed = _thread.daemon_threads_allowed _allocate_lock = _thread.allocate_lock +_LockType = _thread.LockType _set_sentinel = _thread._set_sentinel get_ident = _thread.get_ident _is_main_interpreter = _thread._is_main_interpreter @@ -115,7 +115,7 @@ def gettrace(): # Synchronization classes -Lock = _allocate_lock +Lock = _LockType def RLock(*args, **kwargs): """Factory function that returns a new reentrant lock. |