From f6dcd7729df8776454563443036f28e4a7994d8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Filipe=20La=C3=ADns?= Date: Fri, 13 Oct 2023 13:34:24 +0100 Subject: [PATCH] GH-110819: fix maybe-uninitialized warnings on longobject.c MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Filipe LaĆ­ns --- Objects/longobject.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Objects/longobject.c b/Objects/longobject.c index e73de742229005..2308bf0c9cde55 100644 --- a/Objects/longobject.c +++ b/Objects/longobject.c @@ -1764,7 +1764,7 @@ long_to_decimal_string_internal(PyObject *aa, digit *pout, *pin, rem, tenpow; int negative; int d; - int kind; + int kind = -1; a = (PyLongObject *)aa; if (a == NULL || !PyLong_Check(a)) { @@ -1935,6 +1935,7 @@ long_to_decimal_string_internal(PyObject *aa, } while (0) /* fill the string right-to-left */ + assert (kind > 0); if (bytes_writer) { char *p = *bytes_str + strlen; WRITE_DIGITS(p); @@ -1993,7 +1994,7 @@ long_format_binary(PyObject *aa, int base, int alternate, PyObject *v = NULL; Py_ssize_t sz; Py_ssize_t size_a; - int kind; + int kind = -1; int negative; int bits; @@ -2112,6 +2113,7 @@ long_format_binary(PyObject *aa, int base, int alternate, assert(p == (TYPE*)PyUnicode_DATA(v)); \ } while (0) + assert (kind > 0); if (bytes_writer) { char *p = *bytes_str + sz; WRITE_DIGITS(p);