[issue37883] threading.Lock.locked is not documented
New submission from Rémi Lapeyre <remi.lapeyre@henki.fr>: As far as I can tell, it has never been documented. I'm not sure if it is deprecated but it has a docstring so it seems to me, that it just needs documentation in Doc/Library/threading.rst PS: I don't know how to set the beginner friendly flag. ---------- assignee: docs@python components: Documentation, Library (Lib) messages: 349923 nosy: docs@python, remi.lapeyre priority: normal severity: normal status: open title: threading.Lock.locked is not documented type: enhancement versions: Python 3.7, Python 3.8, Python 3.9 _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue37883> _______________________________________
Change by Pablo Galindo Salgado <pablogsal@gmail.com>: ---------- keywords: +newcomer friendly _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue37883> _______________________________________
Ido Michael <michael.ido@gmail.com> added the comment: Hey Remi, I've fixed it and created PR on the issue. Ido ---------- nosy: +Ido Michael _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue37883> _______________________________________
Ido Michael <michael.ido@gmail.com> added the comment: P.S PR: https://github.com/python/cpython/pull/16420 ---------- _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue37883> _______________________________________
Change by Ido Michael <michael.ido@gmail.com>: ---------- keywords: +patch pull_requests: +16017 stage: -> patch review pull_request: https://github.com/python/cpython/pull/16420 _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue37883> _______________________________________
Tal Einat <taleinat@gmail.com> added the comment: For future reference, there's a nicer, more concise way to reference PRs: just type GH-16420 (using the relevant PR number). ---------- nosy: +taleinat _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue37883> _______________________________________
Tal Einat <taleinat@gmail.com> added the comment: Looking at Lib/threading.py and Modules/_threadmodule.c, it actually appears that RLock.locked() is only implemented by the C implementation, but not the Python implementation which is used as a backup. If we're going to make the locked() method more visible by documenting it, we should expose such a method on the Python implementation, so that threading.RLock will indeed always have a locked() method.
From a quick look, it seems that the Python RLock's _is_owned() method might be just what we need, but that should be validated.
---------- _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue37883> _______________________________________
Change by Tal Einat <taleinat@gmail.com>: ---------- Removed message: https://bugs.python.org/msg353402 _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue37883> _______________________________________
Change by Tal Einat <taleinat@gmail.com>: ---------- versions: +Python 2.7 _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue37883> _______________________________________
Ido Michael <michael.ido@gmail.com> added the comment: Thanks, Tal, I think this one can be closed, I don't think I have permissions to close it ---------- _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue37883> _______________________________________
Tal Einat <taleinat+python@gmail.com> added the comment: Ido, I don't see why this should be closed. The suggestion is good and the PR is good. I'm only waiting for the CLA signing to be worked through to merge the PR. ---------- _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue37883> _______________________________________
Change by Ido Michael <michael.ido@gmail.com>: ---------- pull_requests: +16906 pull_request: https://github.com/python/cpython/pull/17427 _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue37883> _______________________________________
Ido Michael <michael.ido@gmail.com> added the comment: Hey Tal, created a new PR: GH-17427 Also fixed the signed CLA issue ---------- _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue37883> _______________________________________
Change by miss-islington <mariatta.wijaya+miss-islington@gmail.com>: ---------- pull_requests: +16907 pull_request: https://github.com/python/cpython/pull/17428 _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue37883> _______________________________________
Change by miss-islington <mariatta.wijaya+miss-islington@gmail.com>: ---------- pull_requests: +16908 pull_request: https://github.com/python/cpython/pull/17429 _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue37883> _______________________________________
Change by miss-islington <mariatta.wijaya+miss-islington@gmail.com>: ---------- pull_requests: +16909 pull_request: https://github.com/python/cpython/pull/17430 _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue37883> _______________________________________
Tal Einat <taleinat+python@gmail.com> added the comment: Thanks for the report Rémi and for the PR Ido! ---------- resolution: -> fixed stage: patch review -> resolved status: open -> closed _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue37883> _______________________________________
participants (5)
-
Ido Michael
-
miss-islington
-
Pablo Galindo Salgado
-
Rémi Lapeyre
-
Tal Einat