mirror of
https://github.com/python/cpython.git
synced 2025-11-01 06:01:29 +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
|
|
@ -2137,8 +2137,7 @@ def test_signature(self): # gh-102029
|
|||
]
|
||||
for args, kwargs in arg_types:
|
||||
with self.subTest(args=args, kwargs=kwargs):
|
||||
with self.assertWarns(DeprecationWarning):
|
||||
threading.RLock(*args, **kwargs)
|
||||
self.assertRaises(TypeError, threading.RLock, *args, **kwargs)
|
||||
|
||||
# Subtypes with custom `__init__` are allowed (but, not recommended):
|
||||
class CustomRLock(self.locktype):
|
||||
|
|
@ -2156,6 +2155,9 @@ class ConditionAsRLockTests(lock_tests.RLockTests):
|
|||
# Condition uses an RLock by default and exports its API.
|
||||
locktype = staticmethod(threading.Condition)
|
||||
|
||||
def test_constructor_noargs(self):
|
||||
self.skipTest("Condition allows positional arguments")
|
||||
|
||||
def test_recursion_count(self):
|
||||
self.skipTest("Condition does not expose _recursion_count()")
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue