]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
backport tim_one's checkin of
authorMichael W. Hudson <mwh@python.net>
Tue, 5 Mar 2002 15:42:48 +0000 (15:42 +0000)
committerMichael W. Hudson <mwh@python.net>
Tue, 5 Mar 2002 15:42:48 +0000 (15:42 +0000)
    revision 1.114 of longobject.c

_PyLong_Copy():  was creating a copy of the absolute value, but should
copy the sign too.  Added a test to test_descr to ensure that it does.

Bugfix candidate.

Objects/longobject.c

index 5b7a00aa9fcf817b66f1fb1a6e753e10c07453aa..f3e7df7134285eb1757bfd14845f95ab21126f98 100644 (file)
@@ -63,7 +63,7 @@ _PyLong_Copy(PyLongObject *src)
                i = -(i);
        result = _PyLong_New(i);
        if (result != NULL) {
-               result->ob_size = i;
+               result->ob_size = src->ob_size;
                while (--i >= 0)
                        result->ob_digit[i] = src->ob_digit[i];
        }