summaryrefslogtreecommitdiffstats
path: root/Objects/intobject.c
diff options
context:
space:
mode:
Diffstat (limited to 'Objects/intobject.c')
-rw-r--r--Objects/intobject.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/Objects/intobject.c b/Objects/intobject.c
index 763ed53..0ead74b 100644
--- a/Objects/intobject.c
+++ b/Objects/intobject.c
@@ -826,7 +826,10 @@ int_coerce(PyObject **pv, PyObject **pw)
static PyObject *
int_int(PyIntObject *v)
{
- Py_INCREF(v);
+ if (PyInt_CheckExact(v))
+ Py_INCREF(v);
+ else
+ v = (PyIntObject *)PyInt_FromLong(v->ob_ival);
return (PyObject *)v;
}