From cd1f248dca278e6236936276bdf30595e106a427 Mon Sep 17 00:00:00 2001 From: Christian Kellner Date: Fri, 30 Oct 2020 16:03:16 +0100 Subject: [PATCH] util/jsoncomm: chain the BufferError in recv Explicit re-raise the BufferError exception in recv from the orignal JSONDecodeError, so the latter gets recorded as the underlying cause. Uncovered by pylint 2.6.0: W0707: "Not using raise from makes the traceback inaccurate, because the message implies there is a bug in the exception-handling code itself, which is a separate situation than wrapping an exception." --- osbuild/util/jsoncomm.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osbuild/util/jsoncomm.py b/osbuild/util/jsoncomm.py index 22d6b6d8..15ea27c0 100644 --- a/osbuild/util/jsoncomm.py +++ b/osbuild/util/jsoncomm.py @@ -316,8 +316,8 @@ class Socket(contextlib.AbstractContextManager): try: payload = json.loads(msg[0]) - except json.JSONDecodeError: - raise BufferError + except json.JSONDecodeError as e: + raise BufferError from e return (payload, fdset, msg[3])