Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8bcf312

Browse files
committed
Issue #27786: Simplify x_sub()
The z variable is known to be a fresh number which cannot be shared, Py_SIZE() can be used directly to negate the number.
1 parent 82df3b3 commit 8bcf312

1 file changed

Lines changed: 1 addition & 3 deletions

File tree

Objects/longobject.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3000,9 +3000,7 @@ x_sub(PyLongObject *a, PyLongObject *b)
30003000
}
30013001
assert(borrow == 0);
30023002
if (sign < 0) {
3003-
_PyLong_Negate(&z);
3004-
if (z == NULL)
3005-
return NULL;
3003+
Py_SIZE(z) = -Py_SIZE(z);
30063004
}
30073005
return long_normalize(z);
30083006
}

0 commit comments

Comments
 (0)