diff options
-rw-r--r-- | Lib/test/test_descr.py | 1 | ||||
-rw-r--r-- | Objects/longobject.c | 2 |
2 files changed, 2 insertions, 1 deletions
diff --git a/Lib/test/test_descr.py b/Lib/test/test_descr.py index e667efb..de9bba1 100644 --- a/Lib/test/test_descr.py +++ b/Lib/test/test_descr.py @@ -1751,6 +1751,7 @@ def inherits(): # Check that negative clones don't segfault a = longclone(-1) vereq(a.__dict__, {}) + vereq(long(a), -1) # verify PyNumber_Long() copies the sign bit class precfloat(float): __slots__ = ['prec'] diff --git a/Objects/longobject.c b/Objects/longobject.c index 5b7a00a..f3e7df7 100644 --- a/Objects/longobject.c +++ b/Objects/longobject.c @@ -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]; } |