Should logging.Handler.lock allow None?
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 5.1k
- Forks
- 2.1k
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 82
Description
Since https://github.com/python/cpython/commit/74723e11109a320e628898817ab449b3dad9ee96 (in CPython 3.13 and later), a variety of calls of Handler.acquire() and Handler.release() got converted into with Handler.lock.
As a result, unless you're overriding Handler.handle, Handler.lock cannot be None, which it could be previously.
Note that logging.NullHandler does actually set lock to None in the stdlib, but it does override Handler.handle.
I’m unsure about the policy for typeshed is about instance variables whose valid values depend on whether a particular method is overridden.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with CPython commit 74723e11109a320e628898817ab449b3dad9ee96 and compare Handler.lock, acquire(), release(), and handle() with the typeshed declarations. Check how NullHandler's lock and overridden handle() are represented, then review typeshed policy for instance variables whose valid values depend on overrides. Done means the annotation reflects supported CPython behavior and the policy question is resolved.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100