Issue #28998: More APIs now support longs as well as ints.
diff --git a/Objects/intobject.c b/Objects/intobject.c
index 0c5ea65..04e4d29 100644
--- a/Objects/intobject.c
+++ b/Objects/intobject.c
@@ -155,6 +155,11 @@
         return -1;
     }
 
+    if (PyLong_CheckExact(op)) {
+        /* avoid creating temporary int object */
+        return PyLong_AsLong(op);
+    }
+
     io = (PyIntObject*) (*nb->nb_int) (op);
     if (io == NULL)
         return -1;
@@ -163,8 +168,6 @@
             /* got a long? => retry int conversion */
             val = PyLong_AsLong((PyObject *)io);
             Py_DECREF(io);
-            if ((val == -1) && PyErr_Occurred())
-                return -1;
             return val;
         }
         else