mirror of
https://github.com/python/cpython.git
synced 2025-09-18 22:50:26 +00:00
gh-134087: enforce signature of threading.RLock
(#134178)
- Reject positional and keyword arguments in `_thread.RLock.__new__`. - Convert `_thread.lock.__new__` to AC.
This commit is contained in:
parent
9983c7d441
commit
d6dc33ed80
7 changed files with 115 additions and 53 deletions
|
@ -123,7 +123,7 @@ def gettrace():
|
|||
|
||||
Lock = _LockType
|
||||
|
||||
def RLock(*args, **kwargs):
|
||||
def RLock():
|
||||
"""Factory function that returns a new reentrant lock.
|
||||
|
||||
A reentrant lock must be released by the thread that acquired it. Once a
|
||||
|
@ -132,16 +132,9 @@ def RLock(*args, **kwargs):
|
|||
acquired it.
|
||||
|
||||
"""
|
||||
if args or kwargs:
|
||||
import warnings
|
||||
warnings.warn(
|
||||
'Passing arguments to RLock is deprecated and will be removed in 3.15',
|
||||
DeprecationWarning,
|
||||
stacklevel=2,
|
||||
)
|
||||
if _CRLock is None:
|
||||
return _PyRLock(*args, **kwargs)
|
||||
return _CRLock(*args, **kwargs)
|
||||
return _PyRLock()
|
||||
return _CRLock()
|
||||
|
||||
class _RLock:
|
||||
"""This class implements reentrant lock objects.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue