-
-
Notifications
You must be signed in to change notification settings - Fork 33.1k
Closed
Labels
3.14bugs and security fixesbugs and security fixes3.15new features, bugs and security fixesnew features, bugs and security fixesstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
Bug report
Bug description:
import threading
def main():
r = threading.RLock()
print(f"{r = }")
t = threading.Thread(target=r.acquire)
t.start()
t.join()
print(f"{r = }")
print(f"{r.locked() = } at {hex(id(r))}")
if __name__ == '__main__':
main()
Output is:
r = <unlocked _thread.RLock object owner=0 count=1 at 0x105a98720>
r = <locked _thread.RLock object owner=6106329088 count=1 at 0x105a98720>
r.locked() = False at 0x105a98720
Error is located at:
Lines 238 to 240 in 28625d4
def locked(self): | |
"""Return whether this object is locked.""" | |
return self._count > 0 |
The return instruction must be:
return self._block.locked()
.
I can submit a PR quickly.
CPython versions tested on:
CPython main branch, 3.14
Operating systems tested on:
macOS
Linked PRs
Metadata
Metadata
Assignees
Labels
3.14bugs and security fixesbugs and security fixes3.15new features, bugs and security fixesnew features, bugs and security fixesstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error