Skip to content

repr of threading.RLock is erronous with the _thread module #134322

@YvesDup

Description

@YvesDup

Bug report

Bug description:

import threading
 
r = threading.RLock()
 print(f"{r = }")

output is:

r = <unlocked _thread.RLock object owner=0 count=1 at 0x105a98720>

The threading.RLock.__repr__ seems to me erronous because when a threading.RLock is just created, its count attribute should be 0.
This error occurs only with the _thread module.

I can submit a PR.

CPython versions tested on:

CPython main branch

Operating systems tested on:

macOS

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    extension-modulesC modules in the Modules dirtype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions