diff options
Diffstat (limited to 'Objects/longobject.c')
-rw-r--r-- | Objects/longobject.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Objects/longobject.c b/Objects/longobject.c index 11a7024..e4fc553 100644 --- a/Objects/longobject.c +++ b/Objects/longobject.c @@ -2861,7 +2861,10 @@ long_coerce(PyObject **pv, PyObject **pw) static PyObject * long_long(PyObject *v) { - Py_INCREF(v); + if (PyLong_CheckExact(v)) + Py_INCREF(v); + else + v = _PyLong_Copy((PyLongObject *)v); return v; } |