From 08ed989106d8599e287e2c513ae7f21c49e72747 Mon Sep 17 00:00:00 2001 From: Carson Radtke Date: Tue, 21 Nov 2023 19:50:02 -0600 Subject: [PATCH] fix compiler warning about a possible use of an uninitialized variable --- Modules/_io/fileio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Modules/_io/fileio.c b/Modules/_io/fileio.c index 8a73ea0365b7a3..a732bdd5727636 100644 --- a/Modules/_io/fileio.c +++ b/Modules/_io/fileio.c @@ -157,7 +157,7 @@ _io_FileIO_close_impl(fileio *self, PyTypeObject *cls) return res; } - PyObject *exc; + PyObject *exc = NULL; if (res == NULL) { exc = PyErr_GetRaisedException(); } @@ -171,7 +171,7 @@ _io_FileIO_close_impl(fileio *self, PyTypeObject *cls) } } rc = internal_close(self); - if (res == NULL) { + if (exc != NULL) { _PyErr_ChainExceptions1(exc); } if (rc < 0) {