Title: bpo-33978: close resources before deletion of logging handlers by tirkarthi · Pull Request #8008 · python/cpython · GitHub
Open Graph Title: bpo-33978: close resources before deletion of logging handlers by tirkarthi · Pull Request #8008 · python/cpython
X Title: bpo-33978: close resources before deletion of logging handlers by tirkarthi · Pull Request #8008 · python/cpython
Description: Close the file handlers before deleting the logging handlers so that there is no resource warning. Since the handlers are a weakreference I tried to close them by calling self.close on __del__ but not all handlers have the lock attribute which resulted in AttributeError. shutdown handles the AttributeError and other scenarios but it will be a much cleaner if we close the handlers during weakref deletion instead of calling shudown which might miss some places. Additionally shutdown is also registered at exit which should clean up the current handlers I hope but doesn't handle the ones that were deleted. Attached tests and a NEWS entry. Kindly correct me if I am wrong on the approach since this is my first non-easy PR and I would like some help on this fix hoping the fix will not be much complex. Thanks https://bugs.python.org/issue33978
Open Graph Description: Close the file handlers before deleting the logging handlers so that there is no resource warning. Since the handlers are a weakreference I tried to close them by calling self.close on __del__ but ...
X Description: Close the file handlers before deleting the logging handlers so that there is no resource warning. Since the handlers are a weakreference I tried to close them by calling self.close on __del__ but ...
Opengraph URL: https://github.com/python/cpython/pull/8008
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:277b2705-0ed2-7182-0420-dfd3f550d61b |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | 9BEE:306885:28E6751:3A45EE0:6A59030B |
| html-safe-nonce | 01563cf346450f28e9f8778336b263bfdd5968375ef5dde3a49d76498afaed0c |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5QkVFOjMwNjg4NToyOEU2NzUxOjNBNDVFRTA6NkE1OTAzMEIiLCJ2aXNpdG9yX2lkIjoiNDEwMTQyNTc5MzU2OTcxOTA1MSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 3187bae32287564fad7308731d46dc4c091a7fed2b4c7cda2e024ef86c54da5f |
| hovercard-subject-tag | pull_request:198304703 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/python/cpython/pull/8008/files |
| twitter:image | https://avatars.githubusercontent.com/u/3972343?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/3972343?s=400&v=4 |
| og:image:alt | Close the file handlers before deleting the logging handlers so that there is no resource warning. Since the handlers are a weakreference I tried to close them by calling self.close on __del__ but ... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 5f2a0c7865178af3d91dd9f13b0cdfc3c73a2529c873d2780bb4c01271a57ec6 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 9842457e8d7e3b2e1635a63af28da35614845510 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width