Erlend Egeberg Aasland <erlend.aasl...@innova.no> added the comment:

Attached patch is based on Ronald Oussoren's and Alan Robertson's comments: 
Initialise self.socket to None early in __init()__, and then check for None in 
close() and emit(). Passes make test on 3.9, 3.8 and 3.7.

If this solution is ok I'll add a unit test for the case that triggered this 
report and prepare a PR.

----------
keywords: +patch
nosy: +erlendaasland
Added file: 
https://bugs.python.org/file48932/0001-bpo-38780-Harden-socket-use-in-logging.handlers.patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue38780>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to