Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should logging.Handler.lock allow None? #13381

Open
gsnedders opened this issue Jan 9, 2025 · 1 comment
Open

Should logging.Handler.lock allow None? #13381

gsnedders opened this issue Jan 9, 2025 · 1 comment

Comments

@gsnedders
Copy link

Since python/cpython@74723e1 (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.

@JelleZijlstra
Copy link
Member

Sounds to me like the attribute can indeed be None, and our stubs should reflect that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants