summaryrefslogtreecommitdiff
path: root/Objects/longobject.c
diff options
context:
space:
mode:
Diffstat (limited to 'Objects/longobject.c')
-rw-r--r--Objects/longobject.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/Objects/longobject.c b/Objects/longobject.c
index 38e707220a..89b6862605 100644
--- a/Objects/longobject.c
+++ b/Objects/longobject.c
@@ -4170,8 +4170,10 @@ long_invert(PyLongObject *v)
Py_DECREF(w);
if (x == NULL)
return NULL;
- Py_SIZE(x) = -(Py_SIZE(x));
- return (PyObject *)maybe_small_long(x);
+ _PyLong_Negate(&x);
+ /* No need for maybe_small_long here, since any small
+ longs will have been caught in the Py_SIZE <= 1 fast path. */
+ return (PyObject *)x;
}
static PyObject *