-
-
Notifications
You must be signed in to change notification settings - Fork 32.1k
Logging Handler.close does not remove instance from shutdown list. #129143
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
Comments
I agree with your second option - the documentation needs to be updated to correct the inaccuracy. The docstring is correct, so the ReST documentation should be consistent with that. |
vsajip
added a commit
to vsajip/cpython
that referenced
this issue
Feb 10, 2025
vsajip
added a commit
that referenced
this issue
Feb 10, 2025
miss-islington
pushed a commit
to miss-islington/cpython
that referenced
this issue
Feb 10, 2025
…e(). (pythonGH-129950) (cherry picked from commit 7c156a6) Co-authored-by: Vinay Sajip <[email protected]>
miss-islington
pushed a commit
to miss-islington/cpython
that referenced
this issue
Feb 10, 2025
…e(). (pythonGH-129950) (cherry picked from commit 7c156a6) Co-authored-by: Vinay Sajip <[email protected]>
This was referenced Feb 10, 2025
Merged
vsajip
pushed a commit
that referenced
this issue
Feb 10, 2025
vsajip
pushed a commit
that referenced
this issue
Feb 10, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Bug report
Bug description:
The close method on my custom handler was being called during shutdown despite me having closed it myself already. The close method (according to the documentation) is supposed to remove itself from the list to be called during shutdown. Took a look at it though and unforunately it doesn't actually do this as it's written.
The only thing it does is remove itself from the weak value dictionary
_handlers
which is just used to find handlers by name.The collection that dictates what is used at shutdown (
_handlerList
) only gets the items removed if the weak reference is broken so close will be called as long as the handler hasn't been disposed of.To make the docmentation accurate some new code needs to be implemented to loop though list and check the weak references against the current instance which would have the side benefit of tidying up any broken references. I guess could also leave it be and update the documentation for how it actually works, seems to have been this way for awhile and no one else seems to have issues. If it had been documented correctly could have worked around it as it is from the begining.
CPython versions tested on:
3.9
Operating systems tested on:
Windows
Linked PRs
The text was updated successfully, but these errors were encountered: