]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[Backport r50779 | neal.norwitz]
authorAndrew M. Kuchling <amk@amk.ca>
Tue, 3 Oct 2006 18:52:07 +0000 (18:52 +0000)
committerAndrew M. Kuchling <amk@amk.ca>
Tue, 3 Oct 2006 18:52:07 +0000 (18:52 +0000)
Move the initialization of size_a down below the check for a being NULL.

Reported by Klocwork #106.

[Slight change required: in 2.5 Py_ssize_t is used, but 2.4 uses int.]

Objects/longobject.c

index 0a354f1d854f21848f1b6d401cbfea315c8a0b7c..f4a9a42e87e716aa247180ddce4b345209ef1381 100644 (file)
@@ -1043,7 +1043,7 @@ long_format(PyObject *aa, int base, int addL)
        register PyLongObject *a = (PyLongObject *)aa;
        PyStringObject *str;
        int i;
-       const int size_a = ABS(a->ob_size);
+       int size_a;
        char *p;
        int bits;
        char sign = '\0';
@@ -1053,6 +1053,7 @@ long_format(PyObject *aa, int base, int addL)
                return NULL;
        }
        assert(base >= 2 && base <= 36);
+       size_a = ABS(a->ob_size);
 
        /* Compute a rough upper bound for the length of the string */
        i = base;