@@ -208,11 +208,11 @@ error handling for the moment; a better way to code this is shown below)::
208208 PyObject *t;
209209
210210 t = PyTuple_New(3);
211- PyTuple_SetItem(t, 0, PyInt_FromLong (1L));
212- PyTuple_SetItem(t, 1, PyInt_FromLong (2L));
211+ PyTuple_SetItem(t, 0, PyLong_FromLong (1L));
212+ PyTuple_SetItem(t, 1, PyLong_FromLong (2L));
213213 PyTuple_SetItem(t, 2, PyString_FromString("three"));
214214
215- Here, :cfunc: `PyInt_FromLong ` returns a new reference which is immediately
215+ Here, :cfunc: `PyLong_FromLong ` returns a new reference which is immediately
216216stolen by :cfunc: `PyTuple_SetItem `. When you want to keep using an object
217217although the reference to it will be stolen, use :cfunc: `Py_INCREF ` to grab
218218another reference before calling the reference-stealing function.
@@ -252,7 +252,7 @@ sets all items of a list (actually, any mutable sequence) to a given item::
252252 if (n < 0)
253253 return -1;
254254 for (i = 0; i < n; i++) {
255- PyObject *index = PyInt_FromLong (i);
255+ PyObject *index = PyLong_FromLong (i);
256256 if (!index)
257257 return -1;
258258 if (PyObject_SetItem(target, index, item) < 0)
@@ -301,8 +301,8 @@ using :cfunc:`PySequence_GetItem`. ::
301301 return -1; /* Not a list */
302302 for (i = 0; i < n; i++) {
303303 item = PyList_GetItem(list, i); /* Can't fail */
304- if (!PyInt_Check (item)) continue; /* Skip non-integers */
305- total += PyInt_AsLong (item);
304+ if (!PyLong_Check (item)) continue; /* Skip non-integers */
305+ total += PyLong_AsLong (item);
306306 }
307307 return total;
308308 }
@@ -324,8 +324,8 @@ using :cfunc:`PySequence_GetItem`. ::
324324 item = PySequence_GetItem(sequence, i);
325325 if (item == NULL)
326326 return -1; /* Not a sequence, or other failure */
327- if (PyInt_Check (item))
328- total += PyInt_AsLong (item);
327+ if (PyLong_Check (item))
328+ total += PyLong_AsLong (item);
329329 Py_DECREF(item); /* Discard reference ownership */
330330 }
331331 return total;
@@ -449,11 +449,11 @@ Here is the corresponding C code, in all its glory::
449449
450450 /* Clear the error and use zero: */
451451 PyErr_Clear();
452- item = PyInt_FromLong (0L);
452+ item = PyLong_FromLong (0L);
453453 if (item == NULL)
454454 goto error;
455455 }
456- const_one = PyInt_FromLong (1L);
456+ const_one = PyLong_FromLong (1L);
457457 if (const_one == NULL)
458458 goto error;
459459
0 commit comments