mirror of
https://github.com/python/cpython.git
synced 2025-12-15 21:44:50 +00:00
_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.
This commit is contained in:
parent
db30ac41de
commit
5329cdb3ce
2 changed files with 2 additions and 1 deletions
|
|
@ -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']
|
||||
|
|
|
|||
|
|
@ -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];
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue