Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

The newthreading.RLock.locked() method fails #134323

Closed
Labels
3.14bugs and security fixes3.15new features, bugs and security fixesstdlibPython modules in the Lib dirtype-bugAn unexpected behavior, bug, or error
@YvesDup

Description

@YvesDup

Bug report

Bug description:

importthreadingdefmain():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:

deflocked(self):
"""Return whether this object is locked."""
returnself._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

No one assigned

    Labels

    3.14bugs and security fixes3.15new features, bugs and security fixesstdlibPython modules in the Lib dirtype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp