Open
Description
Bug report
Please see the below minimal repro:
from threading import Lock, RLock
class SubclassLock(Lock):
pass
class SubclassRLock(RLock):
passThe subclass of Lock emits:
Traceback (most recent call last):
File "/path/to/file.py", line 3, in <module>
class SubclassLock(Lock):
TypeError: cannot create 'builtin_function_or_method' instances
The subclass of RLock emits:
Traceback (most recent call last):
File "/path/to/file.py", line 6, in <module>
class SubclassRLock(RLock):
TypeError: function() argument 'code' must be code, not str
Both of these messages are relatively cryptic. I think if Python doesn't support subclassing Lock/RLock, it should be documented in threading, and this error message should be more friendly/clear.
Your environment
- CPython versions tested on: 3.10.3
- Operating system and architecture: macOS Big Sur 11.5.1
Metadata
Metadata
Assignees
Projects
Status
No status

