From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2201) id 000813858D39; Sat, 16 Jul 2022 19:12:33 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 000813858D39 To: cygwin-apps-cvs@sourceware.org Subject: [calm - Cygwin server-side packaging maintenance script] branch master, updated. 20220704-5-g4ef519f X-Git-Refname: refs/heads/master X-Git-Reftype: branch X-Git-Oldrev: 7525e8aaa9979436a1ff9c319c1e95c1c9a6598f X-Git-Newrev: 4ef519f84b9da106f07677289f629787384cb469 Message-Id: <20220716191234.000813858D39@sourceware.org> Date: Sat, 16 Jul 2022 19:12:33 +0000 (GMT) From: Jon TURNEY X-BeenThere: cygwin-apps-cvs@cygwin.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Cygwin-apps git logs List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Jul 2022 19:12:34 -0000 https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/calm.git;h=4ef519f84b9da106f07677289f629787384cb469 commit 4ef519f84b9da106f07677289f629787384cb469 Author: Jon Turney Date: Sat Jul 16 19:56:28 2022 +0100 Fix BufferingSMTPHandler used as a context Since a1cb1581, BufferingSMTPHandler was used directly as a context to send an unhandled exception termination report email, but that class doesn't support such use... Diff: --- calm/buffering_smtp_handler.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/calm/buffering_smtp_handler.py b/calm/buffering_smtp_handler.py index 2d764ae..2cd1b63 100644 --- a/calm/buffering_smtp_handler.py +++ b/calm/buffering_smtp_handler.py @@ -99,3 +99,10 @@ class BufferingSMTPHandler(logging.handlers.BufferingHandler): def __enter__(self): logging.getLogger().addHandler(self) return self + + def __exit__(self, exception_type, exception_value, traceback): + self.close() + logging.getLogger().removeHandler(self) + + # process any exception in the with-block normally + return False