From 217cfd1c86c59ed8a55ce6d6b88bbe37309e7ba2 Mon Sep 17 00:00:00 2001 From: Christian Heimes Date: Sun, 2 Dec 2007 14:31:20 +0000 Subject: Cleanup: Replaced most PyInt_ aliases with PyLong_ and disabled the aliases in intobject.h --- Demo/embed/demo.c | 2 +- Doc/includes/run-func.c | 4 +- Doc/includes/shoddy.c | 2 +- Include/intobject.h | 25 +++--- Include/longobject.h | 4 + Include/py_curses.h | 2 +- Include/pythonrun.h | 2 - Mac/Modules/MacOS.c | 2 +- Mac/Modules/carbonevt/_CarbonEvtmodule.c | 4 +- Mac/Modules/cf/pycfbridge.c | 6 +- Mac/Modules/ctl/_Ctlmodule.c | 4 +- Mac/Modules/dlg/_Dlgmodule.c | 6 +- Mac/Modules/gestaltmodule.c | 2 +- Mac/Modules/qd/_Qdmodule.c | 4 +- Mac/Modules/res/_Resmodule.c | 2 +- Mac/Modules/snd/_Sndihooks.c | 2 +- Mac/Modules/win/_Winmodule.c | 2 +- Modules/_bisectmodule.c | 4 +- Modules/_bsddb.c | 68 ++++++++-------- Modules/_collectionsmodule.c | 4 +- Modules/_csv.c | 8 +- Modules/_ctypes/_ctypes.c | 40 +++++----- Modules/_ctypes/callbacks.c | 4 +- Modules/_ctypes/callproc.c | 20 ++--- Modules/_ctypes/cfield.c | 62 +++++++-------- Modules/_ctypes/stgdict.c | 2 +- Modules/_cursesmodule.c | 30 +++---- Modules/_elementtree.c | 2 +- Modules/_fileio.c | 16 ++-- Modules/_hashopenssl.c | 4 +- Modules/_localemodule.c | 24 +++--- Modules/_randommodule.c | 14 ++-- Modules/_sqlite/connection.c | 12 +-- Modules/_sqlite/cursor.c | 12 +-- Modules/_sqlite/module.c | 2 +- Modules/_sre.c | 14 ++-- Modules/_ssl.c | 18 ++--- Modules/_struct.c | 46 +++++------ Modules/_testcapimodule.c | 58 +++++++------- Modules/_tkinter.c | 16 ++-- Modules/_weakref.c | 4 +- Modules/arraymodule.c | 20 ++--- Modules/audioop.c | 16 ++-- Modules/binascii.c | 2 +- Modules/bz2module.c | 8 +- Modules/cStringIO.c | 2 +- Modules/cjkcodecs/multibytecodec.c | 22 +++--- Modules/datetimemodule.c | 52 ++++++------ Modules/dlmodule.c | 12 +-- Modules/errnomodule.c | 2 +- Modules/fcntlmodule.c | 16 ++-- Modules/gcmodule.c | 2 +- Modules/grpmodule.c | 4 +- Modules/itertoolsmodule.c | 18 ++--- Modules/md5module.c | 4 +- Modules/mmapmodule.c | 20 ++--- Modules/operator.c | 4 +- Modules/ossaudiodev.c | 24 +++--- Modules/parsermodule.c | 18 ++--- Modules/posixmodule.c | 132 +++++++++++++++---------------- Modules/pwdmodule.c | 2 +- Modules/pyexpat.c | 30 +++---- Modules/readline.c | 18 ++--- Modules/resource.c | 38 ++++----- Modules/selectmodule.c | 16 ++-- Modules/sha1module.c | 4 +- Modules/sha256module.c | 2 +- Modules/sha512module.c | 2 +- Modules/signalmodule.c | 80 +++++++++---------- Modules/socketmodule.c | 26 +++--- Modules/spwdmodule.c | 2 +- Modules/syslogmodule.c | 6 +- Modules/termios.c | 32 ++++---- Modules/threadmodule.c | 6 +- Modules/timemodule.c | 4 +- Modules/unicodedata.c | 8 +- Modules/xxmodule.c | 4 +- Modules/xxsubtype.c | 6 +- Modules/zipimport.c | 4 +- Modules/zlibmodule.c | 4 +- Objects/abstract.c | 10 +-- Objects/bytesobject.c | 26 +++--- Objects/dictobject.c | 2 +- Objects/enumobject.c | 10 +-- Objects/exceptions.c | 8 +- Objects/fileobject.c | 2 +- Objects/floatobject.c | 6 +- Objects/frameobject.c | 4 +- Objects/iterobject.c | 4 +- Objects/listobject.c | 10 +-- Objects/longobject.c | 6 +- Objects/memoryobject.c | 8 +- Objects/rangeobject.c | 12 +-- Objects/setobject.c | 2 +- Objects/sliceobject.c | 14 ++-- Objects/stringlib/formatter.h | 2 +- Objects/stringlib/string_format.h | 6 +- Objects/stringobject.c | 18 ++--- Objects/structseq.c | 12 +-- Objects/tupleobject.c | 2 +- Objects/typeobject.c | 14 ++-- Objects/unicodeobject.c | 68 ++++++++-------- PC/_msi.c | 8 +- PC/_subprocess.c | 16 ++-- PC/_winreg.c | 10 +-- PC/msvcrtmodule.c | 10 +-- Python/Python-ast.c | 2 +- Python/ast.c | 4 +- Python/bltinmodule.c | 30 +++---- Python/ceval.c | 50 ++++++------ Python/compile.c | 20 ++--- Python/errors.c | 2 +- Python/getargs.c | 16 ++-- Python/import.c | 4 +- Python/mactoolboxglue.c | 6 +- Python/marshal.c | 4 +- Python/modsupport.c | 14 ++-- Python/pystate.c | 2 +- Python/pythonrun.c | 8 +- Python/structmember.c | 24 +++--- Python/symtable.c | 44 +++++------ Python/sysmodule.c | 20 ++--- Python/traceback.c | 2 +- 123 files changed, 888 insertions(+), 885 deletions(-) diff --git a/Demo/embed/demo.c b/Demo/embed/demo.c index 6005f13..bc2406a 100644 --- a/Demo/embed/demo.c +++ b/Demo/embed/demo.c @@ -48,7 +48,7 @@ main(int argc, char **argv) static PyObject * xyzzy_foo(PyObject *self, PyObject* args) { - return PyInt_FromLong(42L); + return PyLong_FromLong(42L); } static PyMethodDef xyzzy_methods[] = { diff --git a/Doc/includes/run-func.c b/Doc/includes/run-func.c index e4f5a27..1c9860d 100644 --- a/Doc/includes/run-func.c +++ b/Doc/includes/run-func.c @@ -26,7 +26,7 @@ main(int argc, char *argv[]) if (pFunc && PyCallable_Check(pFunc)) { pArgs = PyTuple_New(argc - 3); for (i = 0; i < argc - 3; ++i) { - pValue = PyInt_FromLong(atoi(argv[i + 3])); + pValue = PyLong_FromLong(atoi(argv[i + 3])); if (!pValue) { Py_DECREF(pArgs); Py_DECREF(pModule); @@ -39,7 +39,7 @@ main(int argc, char *argv[]) pValue = PyObject_CallObject(pFunc, pArgs); Py_DECREF(pArgs); if (pValue != NULL) { - printf("Result of call: %ld\n", PyInt_AsLong(pValue)); + printf("Result of call: %ld\n", PyLong_AsLong(pValue)); Py_DECREF(pValue); } else { diff --git a/Doc/includes/shoddy.c b/Doc/includes/shoddy.c index 07a4177..4c46bea 100644 --- a/Doc/includes/shoddy.c +++ b/Doc/includes/shoddy.c @@ -10,7 +10,7 @@ static PyObject * Shoddy_increment(Shoddy *self, PyObject *unused) { self->state++; - return PyInt_FromLong(self->state); + return PyLong_FromLong(self->state); } diff --git a/Include/intobject.h b/Include/intobject.h index 2778df1..b23afae 100644 --- a/Include/intobject.h +++ b/Include/intobject.h @@ -29,23 +29,24 @@ typedef struct { PyAPI_DATA(PyTypeObject) PyInt_Type; */ -#define PyInt_Check(op) PyLong_Check(op) #define PyInt_CheckExact(op) (PyLong_CheckExact(op) && _PyLong_FitsInLong(op)) -#define PyInt_FromString PyLong_FromString -#define PyInt_FromUnicode PyLong_FromUnicode -#define PyInt_FromLong PyLong_FromLong -#define PyInt_FromSize_t PyLong_FromSize_t -#define PyInt_FromSsize_t PyLong_FromSsize_t -#define PyInt_AsLong PyLong_AsLong -#define PyInt_AsSsize_t PyLong_AsSsize_t -#define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask -#define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask +#ifdef 0 +# define PyInt_Check(op) PyLong_Check(op) +# define PyInt_FromString PyLong_FromString +# define PyInt_FromUnicode PyLong_FromUnicode +# define PyInt_FromLong PyLong_FromLong +# define PyInt_FromSize_t PyLong_FromSize_t +# define PyInt_FromSsize_t PyLong_FromSsize_t +# define PyInt_AsLong PyLong_AsLong +# define PyInt_AsSsize_t PyLong_AsSsize_t +# define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask +# define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask +# define PyInt_AS_LONG PyLong_AS_LONG +#endif PyAPI_FUNC(long) PyInt_GetMax(void); -#define PyInt_AS_LONG(op) PyLong_AsLong(op) - /* These aren't really part of the Int object, but they're handy; the protos * are necessary for systems that need the magic of PyAPI_FUNC. */ diff --git a/Include/longobject.h b/Include/longobject.h index 16abd0e..688b4e4 100644 --- a/Include/longobject.h +++ b/Include/longobject.h @@ -26,6 +26,10 @@ PyAPI_FUNC(size_t) PyLong_AsSize_t(PyObject *); PyAPI_FUNC(unsigned long) PyLong_AsUnsignedLong(PyObject *); PyAPI_FUNC(unsigned long) PyLong_AsUnsignedLongMask(PyObject *); +/* It may be useful in the future. I've added it in the PyInt -> PyLong + cleanup to keep the extra information. [CH] */ +#define PyLong_AS_LONG(op) PyLong_AsLong(op) + /* Used by socketmodule.c */ #if SIZEOF_SOCKET_T <= SIZEOF_LONG #define PyLong_FromSocket_t(fd) PyLong_FromLong((SOCKET_T)(fd)) diff --git a/Include/py_curses.h b/Include/py_curses.h index 62d00d8..23d9d16 100644 --- a/Include/py_curses.h +++ b/Include/py_curses.h @@ -139,7 +139,7 @@ static PyObject *PyCurses_ ## X (PyObject *self, PyObject *args) \ static PyObject *PyCurses_ ## X (PyObject *self) \ { \ PyCursesInitialised \ - return PyInt_FromLong((long) X()); } + return PyLong_FromLong((long) X()); } #define NoArgReturnStringFunction(X) \ diff --git a/Include/pythonrun.h b/Include/pythonrun.h index 607826a..9d5b3a6 100644 --- a/Include/pythonrun.h +++ b/Include/pythonrun.h @@ -125,7 +125,6 @@ PyAPI_FUNC(void) _PyImport_Init(void); PyAPI_FUNC(void) _PyExc_Init(void); PyAPI_FUNC(void) _PyImportHooks_Init(void); PyAPI_FUNC(int) _PyFrame_Init(void); -PyAPI_FUNC(int) _PyInt_Init(void); PyAPI_FUNC(void) _PyFloat_Init(void); PyAPI_FUNC(int) PyBytes_Init(void); @@ -140,7 +139,6 @@ PyAPI_FUNC(void) PyList_Fini(void); PyAPI_FUNC(void) PySet_Fini(void); PyAPI_FUNC(void) PyString_Fini(void); PyAPI_FUNC(void) PyBytes_Fini(void); -PyAPI_FUNC(void) PyInt_Fini(void); PyAPI_FUNC(void) PyFloat_Fini(void); PyAPI_FUNC(void) PyOS_FiniInterrupts(void); diff --git a/Mac/Modules/MacOS.c b/Mac/Modules/MacOS.c index 49215f5..350975b 100644 --- a/Mac/Modules/MacOS.c +++ b/Mac/Modules/MacOS.c @@ -195,7 +195,7 @@ rf_tell(rfobject *self, PyObject *args) PyMac_Error(err); return NULL; } - return PyInt_FromLong(where); + return PyLong_FromLong(where); } static char rf_close__doc__[] = diff --git a/Mac/Modules/carbonevt/_CarbonEvtmodule.c b/Mac/Modules/carbonevt/_CarbonEvtmodule.c index 7b44228..725dae3 100755 --- a/Mac/Modules/carbonevt/_CarbonEvtmodule.c +++ b/Mac/Modules/carbonevt/_CarbonEvtmodule.c @@ -102,8 +102,8 @@ myEventHandler(EventHandlerCallRef handlerRef, EventRef event, void *outPyObject } else { if (retValue == Py_None) status = noErr; - else if (PyInt_Check(retValue)) { - status = PyInt_AsLong(retValue); + else if (PyLong_Check(retValue)) { + status = PyLong_AsLong(retValue); } else status = noErr; /* wrong object type, complain? */ Py_DECREF(retValue); diff --git a/Mac/Modules/cf/pycfbridge.c b/Mac/Modules/cf/pycfbridge.c index 06700b3..eb476ed 100644 --- a/Mac/Modules/cf/pycfbridge.c +++ b/Mac/Modules/cf/pycfbridge.c @@ -114,7 +114,7 @@ PyCF_CF2Python_simple(CFTypeRef src) { long l; if (!CFNumberGetValue(src, kCFNumberLongType, &l)) /* XXXX Out of range! */; - return PyInt_FromLong(l); + return PyLong_FromLong(l); } } /* XXXX Should return as CFTypeRef, really... */ @@ -258,8 +258,8 @@ PyCF_Python2CF_simple(PyObject *src, CFTypeRef *dst) { *dst = kCFBooleanFalse; return 1; } - if (PyInt_Check(src)) { - long v = PyInt_AsLong(src); + if (PyLong_Check(src)) { + long v = PyLong_AsLong(src); *dst = CFNumberCreate(NULL, kCFNumberLongType, &v); return 1; } diff --git a/Mac/Modules/ctl/_Ctlmodule.c b/Mac/Modules/ctl/_Ctlmodule.c index 4880dee..f872b82 100644 --- a/Mac/Modules/ctl/_Ctlmodule.c +++ b/Mac/Modules/ctl/_Ctlmodule.c @@ -3250,7 +3250,7 @@ static PyObject *CtlObj_TrackControl(ControlObject *_self, PyObject *_args) PyMac_GetPoint, &startPoint, &callback)) return NULL; if (callback && callback != Py_None) { - if (PyInt_Check(callback) && PyInt_AS_LONG(callback) == -1) + if (PyLong_Check(callback) && PyLong_AS_LONG(callback) == -1) upp = (ControlActionUPP)-1; else { settrackfunc(callback); @@ -3283,7 +3283,7 @@ static PyObject *CtlObj_HandleControlClick(ControlObject *_self, PyObject *_args &callback)) return NULL; if (callback && callback != Py_None) { - if (PyInt_Check(callback) && PyInt_AS_LONG(callback) == -1) + if (PyLong_Check(callback) && PyLong_AS_LONG(callback) == -1) upp = (ControlActionUPP)-1; else { settrackfunc(callback); diff --git a/Mac/Modules/dlg/_Dlgmodule.c b/Mac/Modules/dlg/_Dlgmodule.c index 473a449..1a56325 100644 --- a/Mac/Modules/dlg/_Dlgmodule.c +++ b/Mac/Modules/dlg/_Dlgmodule.c @@ -55,8 +55,8 @@ static pascal Boolean Dlg_UnivFilterProc(DialogPtr dialog, } else { Dlg_FilterProc_callback = callback; - if (PyInt_Check(res)) { - *itemHit = PyInt_AsLong(res); + if (PyLong_Check(res)) { + *itemHit = PyLong_AsLong(res); rv = 1; } else @@ -150,7 +150,7 @@ PyObject *DlgObj_New(DialogPtr itself) int DlgObj_Convert(PyObject *v, DialogPtr *p_itself) { if (v == Py_None) { *p_itself = NULL; return 1; } - if (PyInt_Check(v)) { *p_itself = (DialogPtr)PyInt_AsLong(v); + if (PyLong_Check(v)) { *p_itself = (DialogPtr)PyLong_AsLong(v); return 1; } if (!DlgObj_Check(v)) { diff --git a/Mac/Modules/gestaltmodule.c b/Mac/Modules/gestaltmodule.c index ddfa94a..387f93c5 100644 --- a/Mac/Modules/gestaltmodule.c +++ b/Mac/Modules/gestaltmodule.c @@ -40,7 +40,7 @@ gestalt_gestalt(PyObject *self, PyObject *args) iErr = Gestalt ( selector, &response ); if (iErr != 0) return PyMac_Error(iErr); - return PyInt_FromLong(response); + return PyLong_FromLong(response); } static struct PyMethodDef gestalt_methods[] = { diff --git a/Mac/Modules/qd/_Qdmodule.c b/Mac/Modules/qd/_Qdmodule.c index 1e4c700..715a4c5 100644 --- a/Mac/Modules/qd/_Qdmodule.c +++ b/Mac/Modules/qd/_Qdmodule.c @@ -1488,14 +1488,14 @@ static PyMethodDef BMObj_methods[] = { static PyObject *BMObj_get_baseAddr(BitMapObject *self, void *closure) { - return PyInt_FromLong((long)self->ob_itself->baseAddr); + return PyLong_FromLong((long)self->ob_itself->baseAddr); } #define BMObj_set_baseAddr NULL static PyObject *BMObj_get_rowBytes(BitMapObject *self, void *closure) { - return PyInt_FromLong((long)self->ob_itself->rowBytes); + return PyLong_FromLong((long)self->ob_itself->rowBytes); } #define BMObj_set_rowBytes NULL diff --git a/Mac/Modules/res/_Resmodule.c b/Mac/Modules/res/_Resmodule.c index 1cc38ef..ecb5cb3 100644 --- a/Mac/Modules/res/_Resmodule.c +++ b/Mac/Modules/res/_Resmodule.c @@ -556,7 +556,7 @@ static int ResObj_set_data(ResourceObject *self, PyObject *v, void *closure) static PyObject *ResObj_get_size(ResourceObject *self, void *closure) { - return PyInt_FromLong(GetHandleSize(self->ob_itself)); + return PyLong_FromLong(GetHandleSize(self->ob_itself)); } #define ResObj_set_size NULL diff --git a/Mac/Modules/snd/_Sndihooks.c b/Mac/Modules/snd/_Sndihooks.c index 74cad9b..383663a 100644 --- a/Mac/Modules/snd/_Sndihooks.c +++ b/Mac/Modules/snd/_Sndihooks.c @@ -409,7 +409,7 @@ sndih_getSampleSizeAvailable(self, args) if( (rsizes = PyTuple_New(arg.numsizes)) == NULL) return NULL; for( i=0; idata = malloc(sizeof(db_recno_t)); if (key->data == NULL) { PyErr_SetString(PyExc_MemoryError, "Key memory allocation failed"); @@ -738,7 +738,7 @@ static PyObject* _DBCursor_get(DBCursorObject* self, int extra_flags, /* add an integer to a dictionary using the given name as a key */ static void _addIntToDict(PyObject* dict, char *name, int value) { - PyObject* v = PyInt_FromLong((long) value); + PyObject* v = PyLong_FromLong((long) value); if (!v || PyDict_SetItemString(dict, name, v)) PyErr_Clear(); @@ -755,7 +755,7 @@ static void _addTimeTToDict(PyObject* dict, char *name, time_t value) v = PyLong_FromLongLong((PY_LONG_LONG) value); else #endif - v = PyInt_FromLong((long) value); + v = PyLong_FromLong((long) value); if (!v || PyDict_SetItemString(dict, name, v)) PyErr_Clear(); @@ -1132,7 +1132,7 @@ DB_append(DBObject* self, PyObject* args) } free_buf_view(dataobj, data_buf_view); - return PyInt_FromLong(recno); + return PyLong_FromLong(recno); } @@ -1168,8 +1168,8 @@ _db_associateCallback(DB* db, const DBT* priKey, const DBT* priData, else if (result == Py_None) { retval = DB_DONOTINDEX; } - else if (PyInt_Check(result)) { - retval = PyInt_AsLong(result); + else if (PyLong_Check(result)) { + retval = PyLong_AsLong(result); } else if (PyBytes_Check(result) || PyString_Check(result)) { char* data; @@ -1457,7 +1457,7 @@ DB_fd(DBObject* self, PyObject* args) err = self->db->fd(self->db, &the_fd); MYDB_END_ALLOW_THREADS; RETURN_IF_ERR(); - return PyInt_FromLong(the_fd); + return PyLong_FromLong(the_fd); } @@ -1594,7 +1594,7 @@ DB_pget(DBObject* self, PyObject* args, PyObject* kwargs) if (self->primaryDBType == DB_RECNO || self->primaryDBType == DB_QUEUE) - pkeyObj = PyInt_FromLong(*(int *)pkey.data); + pkeyObj = PyLong_FromLong(*(int *)pkey.data); else pkeyObj = PyString_FromStringAndSize(pkey.data, pkey.size); @@ -1603,7 +1603,7 @@ DB_pget(DBObject* self, PyObject* args, PyObject* kwargs) PyObject *keyObj; int type = _DB_get_type(self); if (type == DB_RECNO || type == DB_QUEUE) - keyObj = PyInt_FromLong(*(int *)key.data); + keyObj = PyLong_FromLong(*(int *)key.data); else keyObj = PyString_FromStringAndSize(key.data, key.size); #if (PY_VERSION_HEX >= 0x02040000) @@ -1667,7 +1667,7 @@ DB_get_size(DBObject* self, PyObject* args, PyObject* kwargs) err = self->db->get(self->db, txn, &key, &data, flags); MYDB_END_ALLOW_THREADS; if (err == DB_BUFFER_SMALL) { - retval = PyInt_FromLong((long)data.size); + retval = PyLong_FromLong((long)data.size); err = 0; } @@ -1769,7 +1769,7 @@ DB_get_byteswapped(DBObject* self, PyObject* args) retval = self->db->get_byteswapped(self->db); MYDB_END_ALLOW_THREADS; #endif - return PyInt_FromLong(retval); + return PyLong_FromLong(retval); } @@ -1785,7 +1785,7 @@ DB_get_type(DBObject* self, PyObject* args) type = _DB_get_type(self); if (type == -1) return NULL; - return PyInt_FromLong(type); + return PyLong_FromLong(type); } @@ -2004,7 +2004,7 @@ DB_put(DBObject* self, PyObject* args, PyObject* kwargs) } if (flags & DB_APPEND) - retval = PyInt_FromLong(*((db_recno_t*)key.data)); + retval = PyLong_FromLong(*((db_recno_t*)key.data)); else { retval = Py_None; Py_INCREF(retval); @@ -2130,8 +2130,8 @@ _db_compareCallback(DB* db, /* we're in a callback within the DB code, we can't raise */ PyErr_Print(); res = _default_cmp(leftKey, rightKey); - } else if (PyInt_Check(result)) { - res = PyInt_AsLong(result); + } else if (PyLong_Check(result)) { + res = PyLong_AsLong(result); } else { PyErr_SetString(PyExc_TypeError, "DB_bt_compare callback MUST return an int."); @@ -2175,11 +2175,11 @@ DB_set_bt_compare(DBObject* self, PyObject* args) Py_DECREF(tuple); if (result == NULL) return NULL; - if (!PyInt_Check(result)) { + if (!PyLong_Check(result)) { PyErr_SetString(PyExc_TypeError, "callback MUST return an int"); return NULL; - } else if (PyInt_AsLong(result) != 0) { + } else if (PyLong_AsLong(result) != 0) { PyErr_SetString(PyExc_TypeError, "callback failed to return 0 on two empty strings"); return NULL; @@ -2581,7 +2581,7 @@ DB_truncate(DBObject* self, PyObject* args, PyObject* kwargs) err = self->db->truncate(self->db, txn, &count, flags); MYDB_END_ALLOW_THREADS; RETURN_IF_ERR(); - return PyInt_FromLong(count); + return PyLong_FromLong(count); } #endif @@ -2662,7 +2662,7 @@ DB_set_get_returns_none(DBObject* self, PyObject* args) ++oldValue; self->moduleFlags.getReturnsNone = (flags >= 1); self->moduleFlags.cursorSetReturnsNone = (flags >= 2); - return PyInt_FromLong(oldValue); + return PyLong_FromLong(oldValue); } #if (DBVER >= 41) @@ -2866,9 +2866,9 @@ DB_has_key(DBObject* self, PyObject* args) FREE_DBT_VIEW(key, keyobj, key_buf_view); if (err == DB_BUFFER_SMALL || err == 0) { - return PyInt_FromLong(1); + return PyLong_FromLong(1); } else if (err == DB_NOTFOUND || err == DB_KEYEMPTY) { - return PyInt_FromLong(0); + return PyLong_FromLong(0); } makeDBError(err); @@ -2936,7 +2936,7 @@ _DB_make_list(DBObject* self, DB_TXN* txn, int type) break; case DB_RECNO: case DB_QUEUE: - item = PyInt_FromLong(*((db_recno_t*)key.data)); + item = PyLong_FromLong(*((db_recno_t*)key.data)); break; } break; @@ -3071,7 +3071,7 @@ DBC_count(DBCursorObject* self, PyObject* args) MYDB_END_ALLOW_THREADS; RETURN_IF_ERR(); - return PyInt_FromLong(count); + return PyLong_FromLong(count); } @@ -3294,7 +3294,7 @@ DBC_pget(DBCursorObject* self, PyObject* args, PyObject *kwargs) if (self->mydb->primaryDBType == DB_RECNO || self->mydb->primaryDBType == DB_QUEUE) - pkeyObj = PyInt_FromLong(*(int *)pkey.data); + pkeyObj = PyLong_FromLong(*(int *)pkey.data); else pkeyObj = PyString_FromStringAndSize(pkey.data, pkey.size); @@ -3303,7 +3303,7 @@ DBC_pget(DBCursorObject* self, PyObject* args, PyObject *kwargs) PyObject *keyObj; int type = _DB_get_type(self->mydb); if (type == DB_RECNO || type == DB_QUEUE) - keyObj = PyInt_FromLong(*(int *)key.data); + keyObj = PyLong_FromLong(*(int *)key.data); else keyObj = PyString_FromStringAndSize(key.data, key.size); retval = PyTuple_Pack(3, keyObj, pkeyObj, dataObj); @@ -3359,7 +3359,7 @@ DBC_get_recno(DBCursorObject* self, PyObject* args) recno = *((db_recno_t*)data.data); free_dbt(&key); free_dbt(&data); - return PyInt_FromLong(recno); + return PyLong_FromLong(recno); } @@ -3661,7 +3661,7 @@ DBC_get_current_size(DBCursorObject* self, PyObject* args) MYDB_END_ALLOW_THREADS; if (err == DB_BUFFER_SMALL || !err) { /* DB_BUFFER_SMALL means positive size, !err means zero length value */ - retval = PyInt_FromLong((long)data.size); + retval = PyLong_FromLong((long)data.size); err = 0; } @@ -4336,7 +4336,7 @@ DBEnv_lock_detect(DBEnvObject* self, PyObject* args) #endif MYDB_END_ALLOW_THREADS; RETURN_IF_ERR(); - return PyInt_FromLong(aborted); + return PyLong_FromLong(aborted); } @@ -4380,7 +4380,7 @@ DBEnv_lock_id(DBEnvObject* self, PyObject* args) MYDB_END_ALLOW_THREADS; RETURN_IF_ERR(); - return PyInt_FromLong((long)theID); + return PyLong_FromLong((long)theID); } #if (DBVER >= 40) @@ -4695,7 +4695,7 @@ DBEnv_set_get_returns_none(DBEnvObject* self, PyObject* args) ++oldValue; self->moduleFlags.getReturnsNone = (flags >= 1); self->moduleFlags.cursorSetReturnsNone = (flags >= 2); - return PyInt_FromLong(oldValue); + return PyLong_FromLong(oldValue); } @@ -4839,7 +4839,7 @@ DBTxn_id(DBTxnObject* self, PyObject* args) id = txn_id(self->txn); #endif MYDB_END_ALLOW_THREADS; - return PyInt_FromLong(id); + return PyLong_FromLong(id); } #if (DBVER >= 43) @@ -5022,7 +5022,7 @@ DBSequence_get_cachesize(DBSequenceObject* self, PyObject* args) MYDB_END_ALLOW_THREADS RETURN_IF_ERR(); - return PyInt_FromLong(size); + return PyLong_FromLong(size); } static PyObject* @@ -5056,7 +5056,7 @@ DBSequence_get_flags(DBSequenceObject* self, PyObject* args) MYDB_END_ALLOW_THREADS RETURN_IF_ERR(); - return PyInt_FromLong((int)flags); + return PyLong_FromLong((int)flags); } static PyObject* diff --git a/Modules/_collectionsmodule.c b/Modules/_collectionsmodule.c index 85709a9..20c0774 100644 --- a/Modules/_collectionsmodule.c +++ b/Modules/_collectionsmodule.c @@ -775,7 +775,7 @@ deque_init(dequeobject *deque, PyObject *args, PyObject *kwdargs) if (!PyArg_ParseTupleAndKeywords(args, kwdargs, "|OO:deque", kwlist, &iterable, &maxlenobj)) return -1; if (maxlenobj != NULL && maxlenobj != Py_None) { - maxlen = PyInt_AsLong(maxlenobj); + maxlen = PyLong_AsLong(maxlenobj); if (maxlen == -1 && PyErr_Occurred()) return -1; if (maxlen < 0) { @@ -954,7 +954,7 @@ dequeiter_next(dequeiterobject *it) static PyObject * dequeiter_len(dequeiterobject *it) { - return PyInt_FromLong(it->counter); + return PyLong_FromLong(it->counter); } PyDoc_STRVAR(length_hint_doc, "Private method returning an estimate of len(list(it))."); diff --git a/Modules/_csv.c b/Modules/_csv.c index 7936597..c30cea9 100644 --- a/Modules/_csv.c +++ b/Modules/_csv.c @@ -162,7 +162,7 @@ Dialect_get_quotechar(DialectObj *self) static PyObject * Dialect_get_quoting(DialectObj *self) { - return PyInt_FromLong(self->quoting); + return PyLong_FromLong(self->quoting); } static int @@ -186,7 +186,7 @@ _set_int(const char *name, int *target, PyObject *src, int dflt) "\"%s\" must be an integer", name); return -1; } - *target = PyInt_AsLong(src); + *target = PyLong_AsLong(src); } return 0; } @@ -1390,9 +1390,9 @@ csv_field_size_limit(PyObject *module, PyObject *args) "limit must be an integer"); return NULL; } - field_limit = PyInt_AsLong(new_limit); + field_limit = PyLong_AsLong(new_limit); } - return PyInt_FromLong(old_limit); + return PyLong_FromLong(old_limit); } /* diff --git a/Modules/_ctypes/_ctypes.c b/Modules/_ctypes/_ctypes.c index 1c11853..00643ac 100644 --- a/Modules/_ctypes/_ctypes.c +++ b/Modules/_ctypes/_ctypes.c @@ -236,7 +236,7 @@ static PyObject * CDataType_from_address(PyObject *type, PyObject *value) { void *buf; - if (!PyInt_Check(value)) { + if (!PyLong_Check(value)) { PyErr_SetString(PyExc_TypeError, "integer expected"); return NULL; @@ -265,7 +265,7 @@ CDataType_in_dll(PyObject *type, PyObject *args) obj = PyObject_GetAttrString(dll, "_handle"); if (!obj) return NULL; - if (!PyInt_Check(obj)) { + if (!PyLong_Check(obj)) { PyErr_SetString(PyExc_TypeError, "the _handle attribute of the second argument must be an integer"); Py_DECREF(obj); @@ -641,7 +641,7 @@ PointerType_from_param(PyObject *type, PyObject *value) StgDictObject *typedict; if (value == Py_None) - return PyInt_FromLong(0); /* NULL pointer */ + return PyLong_FromLong(0); /* NULL pointer */ typedict = PyType_stgdict(type); assert(typedict); /* Cannot be NULL for pointer types */ @@ -969,7 +969,7 @@ ArrayType_new(PyTypeObject *type, PyObject *args, PyObject *kwds) "which must be a positive integer"); return NULL; } - length = PyInt_AS_LONG(proto); + length = PyLong_AS_LONG(proto); proto = PyDict_GetItemString(typedict, "_type_"); /* Borrowed ref */ if (!proto) { @@ -1233,7 +1233,7 @@ c_void_p_from_param(PyObject *type, PyObject *value) } /* Should probably allow buffer interface as well */ /* int, long */ - if (PyInt_Check(value)) { + if (PyLong_Check(value)) { PyCArgObject *parg; struct fielddesc *fd = getentry("P"); @@ -1784,12 +1784,12 @@ make_funcptrtype_dict(StgDictObject *stgdict) stgdict->ffi_type_pointer = ffi_type_pointer; ob = PyDict_GetItemString((PyObject *)stgdict, "_flags_"); - if (!ob || !PyInt_Check(ob)) { + if (!ob || !PyLong_Check(ob)) { PyErr_SetString(PyExc_TypeError, "class must define _flags_ which must be an integer"); return -1; } - stgdict->flags = PyInt_AS_LONG(ob); + stgdict->flags = PyLong_AS_LONG(ob); /* _argtypes_ is optional... */ ob = PyDict_GetItemString((PyObject *)stgdict, "_argtypes_"); @@ -2697,11 +2697,11 @@ static int _get_name(PyObject *obj, char **pname) { #ifdef MS_WIN32 - if (PyInt_Check(obj)) { + if (PyLong_Check(obj)) { /* We have to use MAKEINTRESOURCEA for Windows CE. Works on Windows as well, of course. */ - *pname = MAKEINTRESOURCEA(PyInt_AsUnsignedLongMask(obj) & 0xFFFF); + *pname = MAKEINTRESOURCEA(PyLong_AsUnsignedLongMask(obj) & 0xFFFF); return 1; } #endif @@ -2738,7 +2738,7 @@ CFuncPtr_FromDll(PyTypeObject *type, PyObject *args, PyObject *kwds) obj = PyObject_GetAttrString(dll, "_handle"); if (!obj) return NULL; - if (!PyInt_Check(obj)) { + if (!PyLong_Check(obj)) { PyErr_SetString(PyExc_TypeError, "the _handle attribute of the second argument must be an integer"); Py_DECREF(obj); @@ -2858,12 +2858,12 @@ CFuncPtr_new(PyTypeObject *type, PyObject *args, PyObject *kwds) return CFuncPtr_FromDll(type, args, kwds); #ifdef MS_WIN32 - if (2 <= PyTuple_GET_SIZE(args) && PyInt_Check(PyTuple_GET_ITEM(args, 0))) + if (2 <= PyTuple_GET_SIZE(args) && PyLong_Check(PyTuple_GET_ITEM(args, 0))) return CFuncPtr_FromVtblIndex(type, args, kwds); #endif if (1 == PyTuple_GET_SIZE(args) - && (PyInt_Check(PyTuple_GET_ITEM(args, 0)))) { + && (PyLong_Check(PyTuple_GET_ITEM(args, 0)))) { CDataObject *ob; void *ptr = PyLong_AsVoidPtr(PyTuple_GET_ITEM(args, 0)); if (ptr == NULL) @@ -3068,7 +3068,7 @@ _build_callargs(CFuncPtrObject *self, PyObject *argtypes, calls below. */ /* We HAVE already checked that the tuple can be parsed with "i|ZO", so... */ Py_ssize_t tsize = PyTuple_GET_SIZE(item); - flag = PyInt_AS_LONG(PyTuple_GET_ITEM(item, 0)); + flag = PyLong_AS_LONG(PyTuple_GET_ITEM(item, 0)); name = tsize > 1 ? PyTuple_GET_ITEM(item, 1) : NULL; defval = tsize > 2 ? PyTuple_GET_ITEM(item, 2) : NULL; @@ -3077,7 +3077,7 @@ _build_callargs(CFuncPtrObject *self, PyObject *argtypes, /* ['in', 'lcid'] parameter. Always taken from defval, if given, else the integer 0. */ if (defval == NULL) { - defval = PyInt_FromLong(0); + defval = PyLong_FromLong(0); if (defval == NULL) goto error; } else @@ -4864,11 +4864,11 @@ init_ctypes(void) return; PyModule_AddObject(m, "COMError", ComError); - PyModule_AddObject(m, "FUNCFLAG_HRESULT", PyInt_FromLong(FUNCFLAG_HRESULT)); - PyModule_AddObject(m, "FUNCFLAG_STDCALL", PyInt_FromLong(FUNCFLAG_STDCALL)); + PyModule_AddObject(m, "FUNCFLAG_HRESULT", PyLong_FromLong(FUNCFLAG_HRESULT)); + PyModule_AddObject(m, "FUNCFLAG_STDCALL", PyLong_FromLong(FUNCFLAG_STDCALL)); #endif - PyModule_AddObject(m, "FUNCFLAG_CDECL", PyInt_FromLong(FUNCFLAG_CDECL)); - PyModule_AddObject(m, "FUNCFLAG_PYTHONAPI", PyInt_FromLong(FUNCFLAG_PYTHONAPI)); + PyModule_AddObject(m, "FUNCFLAG_CDECL", PyLong_FromLong(FUNCFLAG_CDECL)); + PyModule_AddObject(m, "FUNCFLAG_PYTHONAPI", PyLong_FromLong(FUNCFLAG_PYTHONAPI)); PyModule_AddStringConstant(m, "__version__", "1.1.0"); PyModule_AddObject(m, "_memmove_addr", PyLong_FromVoidPtr(memmove)); @@ -4891,8 +4891,8 @@ init_ctypes(void) #define RTLD_GLOBAL RTLD_LOCAL #endif - PyModule_AddObject(m, "RTLD_LOCAL", PyInt_FromLong(RTLD_LOCAL)); - PyModule_AddObject(m, "RTLD_GLOBAL", PyInt_FromLong(RTLD_GLOBAL)); + PyModule_AddObject(m, "RTLD_LOCAL", PyLong_FromLong(RTLD_LOCAL)); + PyModule_AddObject(m, "RTLD_GLOBAL", PyLong_FromLong(RTLD_GLOBAL)); PyExc_ArgError = PyErr_NewException("ctypes.ArgumentError", NULL, NULL); if (PyExc_ArgError) { diff --git a/Modules/_ctypes/callbacks.c b/Modules/_ctypes/callbacks.c index 9e1aa4f..5e61938 100644 --- a/Modules/_ctypes/callbacks.c +++ b/Modules/_ctypes/callbacks.c @@ -408,7 +408,7 @@ long Call_GetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv) return E_FAIL; } - retval = PyInt_AsLong(result); + retval = PyLong_AsLong(result); if (PyErr_Occurred()) { PyErr_WriteUnraisable(context ? context : Py_None); retval = E_FAIL; @@ -469,7 +469,7 @@ long Call_CanUnloadNow(void) return E_FAIL; } - retval = PyInt_AsLong(result); + retval = PyLong_AsLong(result); if (PyErr_Occurred()) { PyErr_WriteUnraisable(context ? context : Py_None); retval = E_FAIL; diff --git a/Modules/_ctypes/callproc.c b/Modules/_ctypes/callproc.c index 1ab1d27..befb31b 100644 --- a/Modules/_ctypes/callproc.c +++ b/Modules/_ctypes/callproc.c @@ -269,7 +269,7 @@ check_hresult(PyObject *self, PyObject *args) return NULL; if (FAILED(hr)) return PyErr_SetFromWindowsErr(hr); - return PyInt_FromLong(hr); + return PyLong_FromLong(hr); } #endif @@ -727,7 +727,7 @@ static PyObject *GetResult(PyObject *restype, void *result, PyObject *checker) PyObject *retval, *v; if (restype == NULL) - return PyInt_FromLong(*(int *)result); + return PyLong_FromLong(*(int *)result); if (restype == Py_None) { Py_INCREF(Py_None); @@ -1020,12 +1020,12 @@ PyObject *_CallProc(PPROC pProc, if (*(int *)resbuf & 0x80000000) retval = GetComError(*(HRESULT *)resbuf, iid, pIunk); else - retval = PyInt_FromLong(*(int *)resbuf); + retval = PyLong_FromLong(*(int *)resbuf); } else if (flags & FUNCFLAG_HRESULT) { if (*(int *)resbuf & 0x80000000) retval = PyErr_SetFromWindowsErr(*(int *)resbuf); else - retval = PyInt_FromLong(*(int *)resbuf); + retval = PyLong_FromLong(*(int *)resbuf); } else #endif retval = GetResult(restype, resbuf, checker); @@ -1198,12 +1198,12 @@ copy_com_pointer(PyObject *self, PyObject *args) pdst = (IUnknown **)b.value.p; if (pdst == NULL) - r = PyInt_FromLong(E_POINTER); + r = PyLong_FromLong(E_POINTER); else { if (src) src->lpVtbl->AddRef(src); *pdst = src; - r = PyInt_FromLong(S_OK); + r = PyLong_FromLong(S_OK); } done: Py_XDECREF(a.keep); @@ -1345,10 +1345,10 @@ sizeof_func(PyObject *self, PyObject *obj) dict = PyType_stgdict(obj); if (dict) - return PyInt_FromSsize_t(dict->size); + return PyLong_FromSsize_t(dict->size); if (CDataObject_Check(obj)) - return PyInt_FromSsize_t(((CDataObject *)obj)->b_size); + return PyLong_FromSsize_t(((CDataObject *)obj)->b_size); PyErr_SetString(PyExc_TypeError, "this type has no size"); return NULL; @@ -1366,11 +1366,11 @@ align_func(PyObject *self, PyObject *obj) dict = PyType_stgdict(obj); if (dict) - return PyInt_FromSsize_t(dict->align); + return PyLong_FromSsize_t(dict->align); dict = PyObject_stgdict(obj); if (dict) - return PyInt_FromSsize_t(dict->align); + return PyLong_FromSsize_t(dict->align); PyErr_SetString(PyExc_TypeError, "no alignment info"); diff --git a/Modules/_ctypes/cfield.c b/Modules/_ctypes/cfield.c index 2ec7b3a..f29fc666 100644 --- a/Modules/_ctypes/cfield.c +++ b/Modules/_ctypes/cfield.c @@ -216,13 +216,13 @@ CField_get(CFieldObject *self, PyObject *inst, PyTypeObject *type) static PyObject * CField_get_offset(PyObject *self, void *data) { - return PyInt_FromSsize_t(((CFieldObject *)self)->offset); + return PyLong_FromSsize_t(((CFieldObject *)self)->offset); } static PyObject * CField_get_size(PyObject *self, void *data) { - return PyInt_FromSsize_t(((CFieldObject *)self)->size); + return PyLong_FromSsize_t(((CFieldObject *)self)->size); } static PyGetSetDef CField_getset[] = { @@ -329,13 +329,13 @@ static int get_long(PyObject *v, long *p) { long x; - if (!PyInt_Check(v)) { + if (!PyLong_Check(v)) { PyErr_Format(PyExc_TypeError, "int expected instead of %s instance", v->ob_type->tp_name); return -1; } - x = PyInt_AsUnsignedLongMask(v); + x = PyLong_AsUnsignedLongMask(v); if (x == -1 && PyErr_Occurred()) return -1; *p = x; @@ -348,13 +348,13 @@ static int get_ulong(PyObject *v, unsigned long *p) { unsigned long x; - if (!PyInt_Check(v)) { + if (!PyLong_Check(v)) { PyErr_Format(PyExc_TypeError, "int expected instead of %s instance", v->ob_type->tp_name); return -1; } - x = PyInt_AsUnsignedLongMask(v); + x = PyLong_AsUnsignedLongMask(v); if (x == -1 && PyErr_Occurred()) return -1; *p = x; @@ -369,13 +369,13 @@ static int get_longlong(PyObject *v, PY_LONG_LONG *p) { PY_LONG_LONG x; - if (!PyInt_Check(v)) { + if (!PyLong_Check(v)) { PyErr_Format(PyExc_TypeError, "int expected instead of %s instance", v->ob_type->tp_name); return -1; } - x = PyInt_AsUnsignedLongLongMask(v); + x = PyLong_AsUnsignedLongLongMask(v); if (x == -1 && PyErr_Occurred()) return -1; *p = x; @@ -388,13 +388,13 @@ static int get_ulonglong(PyObject *v, unsigned PY_LONG_LONG *p) { unsigned PY_LONG_LONG x; - if (!PyInt_Check(v)) { + if (!PyLong_Check(v)) { PyErr_Format(PyExc_TypeError, "int expected instead of %s instance", v->ob_type->tp_name); return -1; } - x = PyInt_AsUnsignedLongLongMask(v); + x = PyLong_AsUnsignedLongLongMask(v); if (x == -1 && PyErr_Occurred()) return -1; *p = x; @@ -513,7 +513,7 @@ b_get(void *ptr, Py_ssize_t size) { signed char val = *(signed char *)ptr; GET_BITFIELD(val, size); - return PyInt_FromLong(val); + return PyLong_FromLong(val); } static PyObject * @@ -533,7 +533,7 @@ B_get(void *ptr, Py_ssize_t size) { unsigned char val = *(unsigned char *)ptr; GET_BITFIELD(val, size); - return PyInt_FromLong(val); + return PyLong_FromLong(val); } static PyObject * @@ -571,7 +571,7 @@ h_get(void *ptr, Py_ssize_t size) short val; memcpy(&val, ptr, sizeof(val)); GET_BITFIELD(val, size); - return PyInt_FromLong((long)val); + return PyLong_FromLong((long)val); } static PyObject * @@ -581,7 +581,7 @@ h_get_sw(void *ptr, Py_ssize_t size) memcpy(&val, ptr, sizeof(val)); val = SWAP_2(val); GET_BITFIELD(val, size); - return PyInt_FromLong(val); + return PyLong_FromLong(val); } static PyObject * @@ -619,7 +619,7 @@ H_get(void *ptr, Py_ssize_t size) unsigned short val; memcpy(&val, ptr, sizeof(val)); GET_BITFIELD(val, size); - return PyInt_FromLong(val); + return PyLong_FromLong(val); } static PyObject * @@ -629,7 +629,7 @@ H_get_sw(void *ptr, Py_ssize_t size) memcpy(&val, ptr, sizeof(val)); val = SWAP_2(val); GET_BITFIELD(val, size); - return PyInt_FromLong(val); + return PyLong_FromLong(val); } static PyObject * @@ -667,7 +667,7 @@ i_get(void *ptr, Py_ssize_t size) int val; memcpy(&val, ptr, sizeof(val)); GET_BITFIELD(val, size); - return PyInt_FromLong(val); + return PyLong_FromLong(val); } static PyObject * @@ -677,7 +677,7 @@ i_get_sw(void *ptr, Py_ssize_t size) memcpy(&val, ptr, sizeof(val)); val = SWAP_INT(val); GET_BITFIELD(val, size); - return PyInt_FromLong(val); + return PyLong_FromLong(val); } #ifdef MS_WIN32 @@ -815,7 +815,7 @@ l_get(void *ptr, Py_ssize_t size) long val; memcpy(&val, ptr, sizeof(val)); GET_BITFIELD(val, size); - return PyInt_FromLong(val); + return PyLong_FromLong(val); } static PyObject * @@ -825,7 +825,7 @@ l_get_sw(void *ptr, Py_ssize_t size) memcpy(&val, ptr, sizeof(val)); val = SWAP_LONG(val); GET_BITFIELD(val, size); - return PyInt_FromLong(val); + return PyLong_FromLong(val); } static PyObject * @@ -1173,9 +1173,9 @@ c_set(void *ptr, PyObject *value, Py_ssize_t size) *(char *)ptr = PyBytes_AS_STRING(value)[0]; _RET(value); } - if (PyInt_Check(value)) + if (PyLong_Check(value)) { - long longval = PyInt_AS_LONG(value); + long longval = PyLong_AS_LONG(value); if (longval < 0 || longval >= 256) goto error; *(char *)ptr = (char)longval; @@ -1384,11 +1384,11 @@ z_set(void *ptr, PyObject *value, Py_ssize_t size) return NULL; *(char **)ptr = PyString_AS_STRING(str); return str; - } else if (PyInt_Check(value)) { + } else if (PyLong_Check(value)) { #if SIZEOF_VOID_P == SIZEOF_LONG_LONG - *(char **)ptr = (char *)PyInt_AsUnsignedLongLongMask(value); + *(char **)ptr = (char *)PyLong_AsUnsignedLongLongMask(value); #else - *(char **)ptr = (char *)PyInt_AsUnsignedLongMask(value); + *(char **)ptr = (char *)PyLong_AsUnsignedLongMask(value); #endif _RET(value); } @@ -1427,11 +1427,11 @@ Z_set(void *ptr, PyObject *value, Py_ssize_t size) Py_INCREF(value); return value; } - if (PyInt_Check(value) || PyLong_Check(value)) { + if (PyLong_Check(value) || PyLong_Check(value)) { #if SIZEOF_VOID_P == SIZEOF_LONG_LONG - *(wchar_t **)ptr = (wchar_t *)PyInt_AsUnsignedLongLongMask(value); + *(wchar_t **)ptr = (wchar_t *)PyLong_AsUnsignedLongLongMask(value); #else - *(wchar_t **)ptr = (wchar_t *)PyInt_AsUnsignedLongMask(value); + *(wchar_t **)ptr = (wchar_t *)PyLong_AsUnsignedLongMask(value); #endif Py_INCREF(Py_None); return Py_None; @@ -1585,21 +1585,21 @@ P_set(void *ptr, PyObject *value, Py_ssize_t size) _RET(value); } - if (!PyInt_Check(value) && !PyLong_Check(value)) { + if (!PyLong_Check(value) && !PyLong_Check(value)) { PyErr_SetString(PyExc_TypeError, "cannot be converted to pointer"); return NULL; } #if SIZEOF_VOID_P <= SIZEOF_LONG - v = (void *)PyInt_AsUnsignedLongMask(value); + v = (void *)PyLong_AsUnsignedLongMask(value); #else #ifndef HAVE_LONG_LONG # error "PyLong_AsVoidPtr: sizeof(void*) > sizeof(long), but no long long" #elif SIZEOF_LONG_LONG < SIZEOF_VOID_P # error "PyLong_AsVoidPtr: sizeof(PY_LONG_LONG) < sizeof(void*)" #endif - v = (void *)PyInt_AsUnsignedLongLongMask(value); + v = (void *)PyLong_AsUnsignedLongLongMask(value); #endif if (PyErr_Occurred()) diff --git a/Modules/_ctypes/stgdict.c b/Modules/_ctypes/stgdict.c index 3f330f0..d38380b 100644 --- a/Modules/_ctypes/stgdict.c +++ b/Modules/_ctypes/stgdict.c @@ -311,7 +311,7 @@ StructUnionType_update_stgdict(PyObject *type, PyObject *fields, int isStruct) isPacked = PyObject_GetAttrString(type, "_pack_"); if (isPacked) { - pack = PyInt_AsLong(isPacked); + pack = PyLong_AsLong(isPacked); if (pack < 0 || PyErr_Occurred()) { Py_XDECREF(isPacked); PyErr_SetString(PyExc_ValueError, diff --git a/Modules/_cursesmodule.c b/Modules/_cursesmodule.c index 3a88360..1fc7da7 100644 --- a/Modules/_cursesmodule.c +++ b/Modules/_cursesmodule.c @@ -197,7 +197,7 @@ static int PyCurses_ConvertToChtype(PyObject *obj, chtype *ch) { if (PyInt_CheckExact(obj)) { - *ch = (chtype) PyInt_AsLong(obj); + *ch = (chtype) PyLong_AsLong(obj); } else if(PyString_Check(obj) && (PyString_Size(obj) == 1)) { *ch = (chtype) *PyString_AsString(obj); @@ -777,14 +777,14 @@ PyCursesWindow_Enclose(PyCursesWindowObject *self, PyObject *args) if (!PyArg_ParseTuple(args,"ii;y,x", &y, &x)) return NULL; - return PyInt_FromLong( wenclose(self->win,y,x) ); + return PyLong_FromLong( wenclose(self->win,y,x) ); } #endif static PyObject * PyCursesWindow_GetBkgd(PyCursesWindowObject *self) { - return PyInt_FromLong((long) getbkgd(self->win)); + return PyLong_FromLong((long) getbkgd(self->win)); } static PyObject * @@ -810,7 +810,7 @@ PyCursesWindow_GetCh(PyCursesWindowObject *self, PyObject *args) PyErr_SetString(PyExc_TypeError, "getch requires 0 or 2 arguments"); return NULL; } - return PyInt_FromLong((long)rtn); + return PyLong_FromLong((long)rtn); } static PyObject * @@ -1012,7 +1012,7 @@ PyCursesWindow_InCh(PyCursesWindowObject *self, PyObject *args) PyErr_SetString(PyExc_TypeError, "inch requires 0 or 2 arguments"); return NULL; } - return PyInt_FromLong((long) rtn); + return PyLong_FromLong((long) rtn); } static PyObject * @@ -1679,7 +1679,7 @@ PyCurses_color_pair(PyObject *self, PyObject *args) PyCursesInitialisedColor if (!PyArg_ParseTuple(args, "i:color_pair", &n)) return NULL; - return PyInt_FromLong((long) (n << 8)); + return PyLong_FromLong((long) (n << 8)); } static PyObject * @@ -1694,7 +1694,7 @@ PyCurses_Curs_Set(PyObject *self, PyObject *args) erg = curs_set(vis); if (erg == ERR) return PyCursesCheckERR(erg, "curs_set"); - return PyInt_FromLong((long) erg); + return PyLong_FromLong((long) erg); } static PyObject * @@ -1912,7 +1912,7 @@ PyCurses_InitScr(PyObject *self) where they're not defined until you've called initscr() */ #define SetDictInt(string,ch) \ do { \ - PyObject *o = PyInt_FromLong((long) (ch)); \ + PyObject *o = PyLong_FromLong((long) (ch)); \ if (o && PyDict_SetItemString(ModDict, string, o) == 0) { \ Py_DECREF(o); \ } \ @@ -2269,7 +2269,7 @@ PyCurses_pair_number(PyObject *self, PyObject *args) return NULL; } - return PyInt_FromLong((long) ((n & A_COLOR) >> 8)); + return PyLong_FromLong((long) ((n & A_COLOR) >> 8)); } static PyObject * @@ -2316,7 +2316,7 @@ update_lines_cols(void) if (!m) return 0; - o = PyInt_FromLong(LINES); + o = PyLong_FromLong(LINES); if (!o) { Py_DECREF(m); return 0; @@ -2332,7 +2332,7 @@ update_lines_cols(void) return 0; } Py_DECREF(o); - o = PyInt_FromLong(COLS); + o = PyLong_FromLong(COLS); if (!o) { Py_DECREF(m); return 0; @@ -2429,10 +2429,10 @@ PyCurses_Start_Color(PyObject *self) code = start_color(); if (code != ERR) { initialisedcolors = TRUE; - c = PyInt_FromLong((long) COLORS); + c = PyLong_FromLong((long) COLORS); PyDict_SetItemString(ModDict, "COLORS", c); Py_DECREF(c); - cp = PyInt_FromLong((long) COLOR_PAIRS); + cp = PyLong_FromLong((long) COLOR_PAIRS); PyDict_SetItemString(ModDict, "COLOR_PAIRS", cp); Py_DECREF(cp); Py_INCREF(Py_None); @@ -2453,7 +2453,7 @@ PyCurses_tigetflag(PyObject *self, PyObject *args) if (!PyArg_ParseTuple(args, "z", &capname)) return NULL; - return PyInt_FromLong( (long) tigetflag( capname ) ); + return PyLong_FromLong( (long) tigetflag( capname ) ); } static PyObject * @@ -2466,7 +2466,7 @@ PyCurses_tigetnum(PyObject *self, PyObject *args) if (!PyArg_ParseTuple(args, "z", &capname)) return NULL; - return PyInt_FromLong( (long) tigetnum( capname ) ); + return PyLong_FromLong( (long) tigetnum( capname ) ); } static PyObject * diff --git a/Modules/_elementtree.c b/Modules/_elementtree.c index 07de63a..72c157d 100644 --- a/Modules/_elementtree.c +++ b/Modules/_elementtree.c @@ -677,7 +677,7 @@ element_deepcopy(ElementObject* self, PyObject* args) } /* add object to memo dictionary (so deepcopy won't visit it again) */ - id = PyInt_FromLong((Py_uintptr_t) self); + id = PyLong_FromLong((Py_uintptr_t) self); i = PyDict_SetItem(memo, id, (PyObject*) element); diff --git a/Modules/_fileio.c b/Modules/_fileio.c index 68b28d4..f3b20c9 100644 --- a/Modules/_fileio.c +++ b/Modules/_fileio.c @@ -326,7 +326,7 @@ fileio_fileno(PyFileIOObject *self) { if (self->fd < 0) return err_closed(); - return PyInt_FromLong((long) self->fd); + return PyLong_FromLong((long) self->fd); } static PyObject * @@ -388,7 +388,7 @@ fileio_readinto(PyFileIOObject *self, PyObject *args) return NULL; } - return PyInt_FromSsize_t(n); + return PyLong_FromSsize_t(n); } #define DEFAULT_BUFFER_SIZE (8*1024) @@ -521,7 +521,7 @@ fileio_write(PyFileIOObject *self, PyObject *args) return NULL; } - return PyInt_FromSsize_t(n); + return PyLong_FromSsize_t(n); } /* XXX Windows support below is likely incomplete */ @@ -561,10 +561,10 @@ portable_lseek(int fd, PyObject *posobj, int whence) return NULL; } #if !defined(HAVE_LARGEFILE_SUPPORT) - pos = PyInt_AsLong(posobj); + pos = PyLong_AsLong(posobj); #else pos = PyLong_Check(posobj) ? - PyLong_AsLongLong(posobj) : PyInt_AsLong(posobj); + PyLong_AsLongLong(posobj) : PyLong_AsLong(posobj); #endif if (PyErr_Occurred()) return NULL; @@ -581,7 +581,7 @@ portable_lseek(int fd, PyObject *posobj, int whence) return PyErr_SetFromErrno(PyExc_IOError); #if !defined(HAVE_LARGEFILE_SUPPORT) - return PyInt_FromLong(res); + return PyLong_FromLong(res); #else return PyLong_FromLongLong(res); #endif @@ -639,10 +639,10 @@ fileio_truncate(PyFileIOObject *self, PyObject *args) } #if !defined(HAVE_LARGEFILE_SUPPORT) - pos = PyInt_AsLong(posobj); + pos = PyLong_AsLong(posobj); #else pos = PyLong_Check(posobj) ? - PyLong_AsLongLong(posobj) : PyInt_AsLong(posobj); + PyLong_AsLongLong(posobj) : PyLong_AsLong(posobj); #endif if (PyErr_Occurred()) { Py_DECREF(posobj); diff --git a/Modules/_hashopenssl.c b/Modules/_hashopenssl.c index 0f460bf..487240e 100644 --- a/Modules/_hashopenssl.c +++ b/Modules/_hashopenssl.c @@ -203,13 +203,13 @@ static PyMethodDef EVP_methods[] = { static PyObject * EVP_get_block_size(EVPobject *self, void *closure) { - return PyInt_FromLong(EVP_MD_CTX_block_size(&((EVPobject *)self)->ctx)); + return PyLong_FromLong(EVP_MD_CTX_block_size(&((EVPobject *)self)->ctx)); } static PyObject * EVP_get_digest_size(EVPobject *self, void *closure) { - return PyInt_FromLong(EVP_MD_CTX_size(&((EVPobject *)self)->ctx)); + return PyLong_FromLong(EVP_MD_CTX_size(&((EVPobject *)self)->ctx)); } static PyMemberDef EVP_members[] = { diff --git a/Modules/_localemodule.c b/Modules/_localemodule.c index f9c48e1..5677b90 100644 --- a/Modules/_localemodule.c +++ b/Modules/_localemodule.c @@ -71,7 +71,7 @@ copy_grouping(char* s) i = -1; do { i++; - val = PyInt_FromLong(s[i]); + val = PyLong_FromLong(s[i]); if (!val) break; if (PyList_SetItem(result, i, val)) { @@ -149,7 +149,7 @@ PyLocale_localeconv(PyObject* self) Py_XDECREF(x) #define RESULT_INT(i)\ - x = PyInt_FromLong(l->i);\ + x = PyLong_FromLong(l->i);\ if (!x) goto failed;\ PyDict_SetItemString(result, #i, x);\ Py_XDECREF(x) @@ -202,7 +202,7 @@ PyLocale_strcoll(PyObject* self, PyObject* args) if (!PyArg_ParseTuple(args, "ss:strcoll", &s1, &s2)) return NULL; - return PyInt_FromLong(strcoll(s1, s2)); + return PyLong_FromLong(strcoll(s1, s2)); #else PyObject *os1, *os2, *result = NULL; wchar_t *ws1 = NULL, *ws2 = NULL; @@ -234,7 +234,7 @@ PyLocale_strcoll(PyObject* self, PyObject* args) goto done; ws2[len2 - 1] = 0; /* Collate the strings. */ - result = PyInt_FromLong(wcscoll(ws1, ws2)); + result = PyLong_FromLong(wcscoll(ws1, ws2)); done: /* Deallocate everything. */ if (ws1) PyMem_FREE(ws1); @@ -628,37 +628,37 @@ init_locale(void) d = PyModule_GetDict(m); - x = PyInt_FromLong(LC_CTYPE); + x = PyLong_FromLong(LC_CTYPE); PyDict_SetItemString(d, "LC_CTYPE", x); Py_XDECREF(x); - x = PyInt_FromLong(LC_TIME); + x = PyLong_FromLong(LC_TIME); PyDict_SetItemString(d, "LC_TIME", x); Py_XDECREF(x); - x = PyInt_FromLong(LC_COLLATE); + x = PyLong_FromLong(LC_COLLATE); PyDict_SetItemString(d, "LC_COLLATE", x); Py_XDECREF(x); - x = PyInt_FromLong(LC_MONETARY); + x = PyLong_FromLong(LC_MONETARY); PyDict_SetItemString(d, "LC_MONETARY", x); Py_XDECREF(x); #ifdef LC_MESSAGES - x = PyInt_FromLong(LC_MESSAGES); + x = PyLong_FromLong(LC_MESSAGES); PyDict_SetItemString(d, "LC_MESSAGES", x); Py_XDECREF(x); #endif /* LC_MESSAGES */ - x = PyInt_FromLong(LC_NUMERIC); + x = PyLong_FromLong(LC_NUMERIC); PyDict_SetItemString(d, "LC_NUMERIC", x); Py_XDECREF(x); - x = PyInt_FromLong(LC_ALL); + x = PyLong_FromLong(LC_ALL); PyDict_SetItemString(d, "LC_ALL", x); Py_XDECREF(x); - x = PyInt_FromLong(CHAR_MAX); + x = PyLong_FromLong(CHAR_MAX); PyDict_SetItemString(d, "CHAR_MAX", x); Py_XDECREF(x); diff --git a/Modules/_randommodule.c b/Modules/_randommodule.c index bd4d17e..3256bf1 100644 --- a/Modules/_randommodule.c +++ b/Modules/_randommodule.c @@ -259,7 +259,7 @@ random_seed(RandomObject *self, PyObject *args) masklower = PyLong_FromUnsignedLong(0xffffffffU); if (masklower == NULL) goto Done; - thirtytwo = PyInt_FromLong(32L); + thirtytwo = PyLong_FromLong(32L); if (thirtytwo == NULL) goto Done; while ((err=PyObject_IsTrue(n))) { @@ -319,12 +319,12 @@ random_getstate(RandomObject *self) if (state == NULL) return NULL; for (i=0; istate[i])); + element = PyLong_FromLong((long)(self->state[i])); if (element == NULL) goto Fail; PyTuple_SET_ITEM(state, i, element); } - element = PyInt_FromLong((long)(self->index)); + element = PyLong_FromLong((long)(self->index)); if (element == NULL) goto Fail; PyTuple_SET_ITEM(state, i, element); @@ -353,13 +353,13 @@ random_setstate(RandomObject *self, PyObject *state) } for (i=0; istate[i] = (unsigned long)element; } - element = PyInt_AsLong(PyTuple_GET_ITEM(state, i)); + element = PyLong_AsLong(PyTuple_GET_ITEM(state, i)); if (element == -1 && PyErr_Occurred()) return NULL; self->index = (int)element; @@ -410,14 +410,14 @@ random_jumpahead(RandomObject *self, PyObject *n) mt = self->state; for (i = N-1; i > 1; i--) { - iobj = PyInt_FromLong(i); + iobj = PyLong_FromLong(i); if (iobj == NULL) return NULL; remobj = PyNumber_Remainder(n, iobj); Py_DECREF(iobj); if (remobj == NULL) return NULL; - j = PyInt_AsLong(remobj); + j = PyLong_AsLong(remobj); Py_DECREF(remobj); if (j == -1L && PyErr_Occurred()) return NULL; diff --git a/Modules/_sqlite/connection.c b/Modules/_sqlite/connection.c index b6f6492..92a3e51 100644 --- a/Modules/_sqlite/connection.c +++ b/Modules/_sqlite/connection.c @@ -420,8 +420,8 @@ void _pysqlite_set_result(sqlite3_context* context, PyObject* py_val) sqlite3_result_null(context); } else if (py_val == Py_None) { sqlite3_result_null(context); - } else if (PyInt_Check(py_val)) { - longval = PyInt_AsLong(py_val); + } else if (PyLong_Check(py_val)) { + longval = PyLong_AsLong(py_val); sqlite3_result_int64(context, (PY_LONG_LONG)longval); } else if (PyFloat_Check(py_val)) { sqlite3_result_double(context, PyFloat_AsDouble(py_val)); @@ -458,7 +458,7 @@ PyObject* _pysqlite_build_py_params(sqlite3_context *context, int argc, sqlite3_ switch (sqlite3_value_type(argv[i])) { case SQLITE_INTEGER: val_int = sqlite3_value_int64(cur_value); - cur_py_value = PyInt_FromLong((long)val_int); + cur_py_value = PyLong_FromLong((long)val_int); break; case SQLITE_FLOAT: cur_py_value = PyFloat_FromDouble(sqlite3_value_double(cur_value)); @@ -734,8 +734,8 @@ static int _authorizer_callback(void* user_arg, int action, const char* arg1, co rc = SQLITE_DENY; } else { - if (PyInt_Check(ret)) { - rc = (int)PyInt_AsLong(ret); + if (PyLong_Check(ret)) { + rc = (int)PyLong_AsLong(ret); } else { rc = SQLITE_DENY; } @@ -1036,7 +1036,7 @@ pysqlite_collation_callback( goto finally; } - result = PyInt_AsLong(retval); + result = PyLong_AsLong(retval); if (PyErr_Occurred()) { result = 0; } diff --git a/Modules/_sqlite/cursor.c b/Modules/_sqlite/cursor.c index c51c92e..334f94b 100644 --- a/Modules/_sqlite/cursor.c +++ b/Modules/_sqlite/cursor.c @@ -26,7 +26,7 @@ #include "util.h" #include "sqlitecompat.h" -/* used to decide wether to call PyInt_FromLong or PyLong_FromLongLong */ +/* used to decide wether to call PyLong_FromLong or PyLong_FromLongLong */ #ifndef INT32_MIN #define INT32_MIN (-2147483647 - 1) #endif @@ -101,7 +101,7 @@ int pysqlite_cursor_init(pysqlite_Cursor* self, PyObject* args, PyObject* kwargs self->arraysize = 1; - self->rowcount = PyInt_FromLong(-1L); + self->rowcount = PyLong_FromLong(-1L); if (!self->rowcount) { return -1; } @@ -344,7 +344,7 @@ PyObject* _pysqlite_fetch_one_row(pysqlite_Cursor* self) if (intval < INT32_MIN || intval > INT32_MAX) { converted = PyLong_FromLongLong(intval); } else { - converted = PyInt_FromLong((long)intval); + converted = PyLong_FromLong((long)intval); } } else if (coltype == SQLITE_FLOAT) { converted = PyFloat_FromDouble(sqlite3_column_double(self->statement->st, i)); @@ -499,7 +499,7 @@ PyObject* _pysqlite_query_execute(pysqlite_Cursor* self, int multiple, PyObject* self->description = Py_None; Py_DECREF(self->rowcount); - self->rowcount = PyInt_FromLong(-1L); + self->rowcount = PyLong_FromLong(-1L); if (!self->rowcount) { goto error; } @@ -680,7 +680,7 @@ PyObject* _pysqlite_query_execute(pysqlite_Cursor* self, int multiple, PyObject* rowcount += (long)sqlite3_changes(self->connection->db); Py_END_ALLOW_THREADS Py_DECREF(self->rowcount); - self->rowcount = PyInt_FromLong(rowcount); + self->rowcount = PyLong_FromLong(rowcount); } Py_DECREF(self->lastrowid); @@ -688,7 +688,7 @@ PyObject* _pysqlite_query_execute(pysqlite_Cursor* self, int multiple, PyObject* Py_BEGIN_ALLOW_THREADS lastrowid = sqlite3_last_insert_rowid(self->connection->db); Py_END_ALLOW_THREADS - self->lastrowid = PyInt_FromLong((long)lastrowid); + self->lastrowid = PyLong_FromLong((long)lastrowid); } else { Py_INCREF(Py_None); self->lastrowid = Py_None; diff --git a/Modules/_sqlite/module.c b/Modules/_sqlite/module.c index 107d61a..5c2aaa7 100644 --- a/Modules/_sqlite/module.c +++ b/Modules/_sqlite/module.c @@ -351,7 +351,7 @@ PyMODINIT_FUNC init_sqlite3(void) /* Set integer constants */ for (i = 0; _int_constants[i].constant_name != 0; i++) { - tmp_obj = PyInt_FromLong(_int_constants[i].constant_value); + tmp_obj = PyLong_FromLong(_int_constants[i].constant_value); if (!tmp_obj) { goto error; } diff --git a/Modules/_sre.c b/Modules/_sre.c index f4cd1fe..33f3759 100644 --- a/Modules/_sre.c +++ b/Modules/_sre.c @@ -2756,8 +2756,8 @@ match_getindex(MatchObject* self, PyObject* index) /* Default value */ return 0; - if (PyInt_Check(index)) - return PyInt_AsSsize_t(index); + if (PyLong_Check(index)) + return PyLong_AsSsize_t(index); i = -1; @@ -2765,7 +2765,7 @@ match_getindex(MatchObject* self, PyObject* index) index = PyObject_GetItem(self->pattern->groupindex, index); if (index) { if (PyLong_Check(index)) - i = PyInt_AsSsize_t(index); + i = PyLong_AsSsize_t(index); Py_DECREF(index); } else PyErr_Clear(); @@ -2957,12 +2957,12 @@ _pair(Py_ssize_t i1, Py_ssize_t i2) if (!pair) return NULL; - item = PyInt_FromSsize_t(i1); + item = PyLong_FromSsize_t(i1); if (!item) goto error; PyTuple_SET_ITEM(pair, 0, item); - item = PyInt_FromSsize_t(i2); + item = PyLong_FromSsize_t(i2); if (!item) goto error; PyTuple_SET_ITEM(pair, 1, item); @@ -3397,13 +3397,13 @@ PyMODINIT_FUNC init_sre(void) return; d = PyModule_GetDict(m); - x = PyInt_FromLong(SRE_MAGIC); + x = PyLong_FromLong(SRE_MAGIC); if (x) { PyDict_SetItemString(d, "MAGIC", x); Py_DECREF(x); } - x = PyInt_FromLong(sizeof(SRE_CODE)); + x = PyLong_FromLong(sizeof(SRE_CODE)); if (x) { PyDict_SetItemString(d, "CODESIZE", x); Py_DECREF(x); diff --git a/Modules/_ssl.c b/Modules/_ssl.c index 3d6fcff..bd3f172 100644 --- a/Modules/_ssl.c +++ b/Modules/_ssl.c @@ -818,7 +818,7 @@ _decode_certificate (X509 *certificate, int verbose) { } Py_DECREF(issuer); - version = PyInt_FromLong(X509_get_version(certificate) + 1); + version = PyLong_FromLong(X509_get_version(certificate) + 1); if (PyDict_SetItemString(retval, "version", version) < 0) { Py_DECREF(version); goto fail0; @@ -1039,7 +1039,7 @@ static PyObject *PySSL_cipher (PySSLObject *self) { goto fail0; PyTuple_SET_ITEM(retval, 1, v); } - v = PyInt_FromLong(SSL_CIPHER_get_bits(current, NULL)); + v = PyLong_FromLong(SSL_CIPHER_get_bits(current, NULL)); if (v == NULL) goto fail0; PyTuple_SET_ITEM(retval, 2, v); @@ -1194,7 +1194,7 @@ static PyObject *PySSL_SSLwrite(PySSLObject *self, PyObject *args) } } while (err == SSL_ERROR_WANT_READ || err == SSL_ERROR_WANT_WRITE); if (len > 0) - return PyInt_FromLong(len); + return PyLong_FromLong(len); else return PySSL_SetError(self, len, __FILE__, __LINE__); } @@ -1215,7 +1215,7 @@ static PyObject *PySSL_SSLpending(PySSLObject *self) if (count < 0) return PySSL_SetError(self, count, __FILE__, __LINE__); else - return PyInt_FromLong(count); + return PyLong_FromLong(count); } PyDoc_STRVAR(PySSL_SSLpending_doc, @@ -1240,8 +1240,8 @@ static PyObject *PySSL_SSLread(PySSLObject *self, PyObject *args) if ((buf == NULL) || (buf == Py_None)) { if (!(buf = PyBytes_FromStringAndSize((char *) 0, len))) return NULL; - } else if (PyInt_Check(buf)) { - len = PyInt_AS_LONG(buf); + } else if (PyLong_Check(buf)) { + len = PyLong_AS_LONG(buf); if (!(buf = PyBytes_FromStringAndSize((char *) 0, len))) return NULL; } else { @@ -1336,7 +1336,7 @@ static PyObject *PySSL_SSLread(PySSLObject *self, PyObject *args) Py_DECREF(buf); return res; } else { - return PyInt_FromLong(count); + return PyLong_FromLong(count); } } @@ -1408,7 +1408,7 @@ bound on the entropy contained in string. See RFC 1750."); static PyObject * PySSL_RAND_status(PyObject *self) { - return PyInt_FromLong(RAND_status()); + return PyLong_FromLong(RAND_status()); } PyDoc_STRVAR(PySSL_RAND_status_doc, @@ -1434,7 +1434,7 @@ PySSL_RAND_egd(PyObject *self, PyObject *arg) "enough data to seed the PRNG"); return NULL; } - return PyInt_FromLong(bytes); + return PyLong_FromLong(bytes); } PyDoc_STRVAR(PySSL_RAND_egd_doc, diff --git a/Modules/_struct.c b/Modules/_struct.c index 8f66a96..dd92e0c 100644 --- a/Modules/_struct.c +++ b/Modules/_struct.c @@ -146,7 +146,7 @@ get_pylong(PyObject *v) static int get_long(PyObject *v, long *p) { - long x = PyInt_AsLong(v); + long x = PyLong_AsLong(v); if (x == -1 && PyErr_Occurred()) { #ifdef PY_STRUCT_FLOAT_COERCE if (PyFloat_Check(v)) { @@ -445,13 +445,13 @@ nu_char(const char *p, const formatdef *f) static PyObject * nu_byte(const char *p, const formatdef *f) { - return PyInt_FromLong((long) *(signed char *)p); + return PyLong_FromLong((long) *(signed char *)p); } static PyObject * nu_ubyte(const char *p, const formatdef *f) { - return PyInt_FromLong((long) *(unsigned char *)p); + return PyLong_FromLong((long) *(unsigned char *)p); } static PyObject * @@ -459,7 +459,7 @@ nu_short(const char *p, const formatdef *f) { short x; memcpy((char *)&x, p, sizeof x); - return PyInt_FromLong((long)x); + return PyLong_FromLong((long)x); } static PyObject * @@ -467,7 +467,7 @@ nu_ushort(const char *p, const formatdef *f) { unsigned short x; memcpy((char *)&x, p, sizeof x); - return PyInt_FromLong((long)x); + return PyLong_FromLong((long)x); } static PyObject * @@ -475,7 +475,7 @@ nu_int(const char *p, const formatdef *f) { int x; memcpy((char *)&x, p, sizeof x); - return PyInt_FromLong((long)x); + return PyLong_FromLong((long)x); } static PyObject * @@ -484,10 +484,10 @@ nu_uint(const char *p, const formatdef *f) unsigned int x; memcpy((char *)&x, p, sizeof x); #if (SIZEOF_LONG > SIZEOF_INT) - return PyInt_FromLong((long)x); + return PyLong_FromLong((long)x); #else if (x <= ((unsigned int)LONG_MAX)) - return PyInt_FromLong((long)x); + return PyLong_FromLong((long)x); return PyLong_FromUnsignedLong((unsigned long)x); #endif } @@ -497,7 +497,7 @@ nu_long(const char *p, const formatdef *f) { long x; memcpy((char *)&x, p, sizeof x); - return PyInt_FromLong(x); + return PyLong_FromLong(x); } static PyObject * @@ -506,7 +506,7 @@ nu_ulong(const char *p, const formatdef *f) unsigned long x; memcpy((char *)&x, p, sizeof x); if (x <= LONG_MAX) - return PyInt_FromLong((long)x); + return PyLong_FromLong((long)x); return PyLong_FromUnsignedLong(x); } @@ -521,7 +521,7 @@ nu_longlong(const char *p, const formatdef *f) PY_LONG_LONG x; memcpy((char *)&x, p, sizeof x); if (x >= LONG_MIN && x <= LONG_MAX) - return PyInt_FromLong(Py_SAFE_DOWNCAST(x, PY_LONG_LONG, long)); + return PyLong_FromLong(Py_SAFE_DOWNCAST(x, PY_LONG_LONG, long)); return PyLong_FromLongLong(x); } @@ -531,7 +531,7 @@ nu_ulonglong(const char *p, const formatdef *f) unsigned PY_LONG_LONG x; memcpy((char *)&x, p, sizeof x); if (x <= LONG_MAX) - return PyInt_FromLong(Py_SAFE_DOWNCAST(x, unsigned PY_LONG_LONG, long)); + return PyLong_FromLong(Py_SAFE_DOWNCAST(x, unsigned PY_LONG_LONG, long)); return PyLong_FromUnsignedLongLong(x); } @@ -818,7 +818,7 @@ bu_int(const char *p, const formatdef *f) /* Extend the sign bit. */ if (SIZEOF_LONG > f->size) x |= -(x & (1L << ((8 * f->size) - 1))); - return PyInt_FromLong(x); + return PyLong_FromLong(x); } static PyObject * @@ -831,7 +831,7 @@ bu_uint(const char *p, const formatdef *f) x = (x<<8) | *bytes++; } while (--i > 0); if (x <= LONG_MAX) - return PyInt_FromLong((long)x); + return PyLong_FromLong((long)x); return PyLong_FromUnsignedLong(x); } @@ -849,7 +849,7 @@ bu_longlong(const char *p, const formatdef *f) if (SIZEOF_LONG_LONG > f->size) x |= -(x & ((PY_LONG_LONG)1 << ((8 * f->size) - 1))); if (x >= LONG_MIN && x <= LONG_MAX) - return PyInt_FromLong(Py_SAFE_DOWNCAST(x, PY_LONG_LONG, long)); + return PyLong_FromLong(Py_SAFE_DOWNCAST(x, PY_LONG_LONG, long)); return PyLong_FromLongLong(x); #else return _PyLong_FromByteArray((const unsigned char *)p, @@ -870,7 +870,7 @@ bu_ulonglong(const char *p, const formatdef *f) x = (x<<8) | *bytes++; } while (--i > 0); if (x <= LONG_MAX) - return PyInt_FromLong(Py_SAFE_DOWNCAST(x, unsigned PY_LONG_LONG, long)); + return PyLong_FromLong(Py_SAFE_DOWNCAST(x, unsigned PY_LONG_LONG, long)); return PyLong_FromUnsignedLongLong(x); #else return _PyLong_FromByteArray((const unsigned char *)p, @@ -1054,7 +1054,7 @@ lu_int(const char *p, const formatdef *f) /* Extend the sign bit. */ if (SIZEOF_LONG > f->size) x |= -(x & (1L << ((8 * f->size) - 1))); - return PyInt_FromLong(x); + return PyLong_FromLong(x); } static PyObject * @@ -1067,7 +1067,7 @@ lu_uint(const char *p, const formatdef *f) x = (x<<8) | bytes[--i]; } while (i > 0); if (x <= LONG_MAX) - return PyInt_FromLong((long)x); + return PyLong_FromLong((long)x); return PyLong_FromUnsignedLong((long)x); } @@ -1085,7 +1085,7 @@ lu_longlong(const char *p, const formatdef *f) if (SIZEOF_LONG_LONG > f->size) x |= -(x & ((PY_LONG_LONG)1 << ((8 * f->size) - 1))); if (x >= LONG_MIN && x <= LONG_MAX) - return PyInt_FromLong(Py_SAFE_DOWNCAST(x, PY_LONG_LONG, long)); + return PyLong_FromLong(Py_SAFE_DOWNCAST(x, PY_LONG_LONG, long)); return PyLong_FromLongLong(x); #else return _PyLong_FromByteArray((const unsigned char *)p, @@ -1106,7 +1106,7 @@ lu_ulonglong(const char *p, const formatdef *f) x = (x<<8) | bytes[--i]; } while (i > 0); if (x <= LONG_MAX) - return PyInt_FromLong(Py_SAFE_DOWNCAST(x, unsigned PY_LONG_LONG, long)); + return PyLong_FromLong(Py_SAFE_DOWNCAST(x, unsigned PY_LONG_LONG, long)); return PyLong_FromUnsignedLongLong(x); #else return _PyLong_FromByteArray((const unsigned char *)p, @@ -1762,7 +1762,7 @@ s_pack_into(PyObject *self, PyObject *args) assert( buffer_len >= 0 ); /* Extract the offset from the first argument */ - offset = PyInt_AsSsize_t(PyTuple_GET_ITEM(args, 1)); + offset = PyLong_AsSsize_t(PyTuple_GET_ITEM(args, 1)); /* Support negative offsets. */ if (offset < 0) @@ -1794,7 +1794,7 @@ s_get_format(PyStructObject *self, void *unused) static PyObject * s_get_size(PyStructObject *self, void *unused) { - return PyInt_FromSsize_t(self->s_size); + return PyLong_FromSsize_t(self->s_size); } /* List of functions */ @@ -1876,7 +1876,7 @@ init_struct(void) #ifdef PY_STRUCT_OVERFLOW_MASKING if (pyint_zero == NULL) { - pyint_zero = PyInt_FromLong(0); + pyint_zero = PyLong_FromLong(0); if (pyint_zero == NULL) return; } diff --git a/Modules/_testcapimodule.c b/Modules/_testcapimodule.c index 9b67b5e..7de5e0d 100644 --- a/Modules/_testcapimodule.c +++ b/Modules/_testcapimodule.c @@ -85,7 +85,7 @@ test_list_api(PyObject *self) return (PyObject*)NULL; /* list = range(NLIST) */ for (i = 0; i < NLIST; ++i) { - PyObject* anint = PyInt_FromLong(i); + PyObject* anint = PyLong_FromLong(i); if (anint == (PyObject*)NULL) { Py_DECREF(list); return (PyObject*)NULL; @@ -101,7 +101,7 @@ test_list_api(PyObject *self) /* Check that list == range(29, -1, -1) now */ for (i = 0; i < NLIST; ++i) { PyObject* anint = PyList_GET_ITEM(list, i); - if (PyInt_AS_LONG(anint) != NLIST-1-i) { + if (PyLong_AS_LONG(anint) != NLIST-1-i) { PyErr_SetString(TestError, "test_list_api: reverse screwed up"); Py_DECREF(list); @@ -127,7 +127,7 @@ test_dict_inner(int count) return -1; for (i = 0; i < count; i++) { - v = PyInt_FromLong(i); + v = PyLong_FromLong(i); PyDict_SetItem(dict, v, v); Py_DECREF(v); } @@ -136,8 +136,8 @@ test_dict_inner(int count) PyObject *o; iterations++; - i = PyInt_AS_LONG(v) + 1; - o = PyInt_FromLong(i); + i = PyLong_AS_LONG(v) + 1; + o = PyLong_FromLong(i); if (o == NULL) return -1; if (PyDict_SetItem(dict, k, o) < 0) { @@ -278,7 +278,7 @@ test_L_code(PyObject *self) "L code returned wrong value for long 42"); Py_DECREF(num); - num = PyInt_FromLong(42); + num = PyLong_FromLong(42); if (num == NULL) return NULL; @@ -404,7 +404,7 @@ getargs_K(PyObject *self, PyObject *args) #endif /* This function not only tests the 'k' getargs code, but also the - PyInt_AsUnsignedLongMask() and PyInt_AsUnsignedLongMask() functions. */ + PyLong_AsUnsignedLongMask() and PyLong_AsUnsignedLongMask() functions. */ static PyObject * test_k_code(PyObject *self) { @@ -420,10 +420,10 @@ test_k_code(PyObject *self) if (num == NULL) return NULL; - value = PyInt_AsUnsignedLongMask(num); + value = PyLong_AsUnsignedLongMask(num); if (value != ULONG_MAX) return raiseTestError("test_k_code", - "PyInt_AsUnsignedLongMask() returned wrong value for long 0xFFF...FFF"); + "PyLong_AsUnsignedLongMask() returned wrong value for long 0xFFF...FFF"); PyTuple_SET_ITEM(tuple, 0, num); @@ -439,10 +439,10 @@ test_k_code(PyObject *self) if (num == NULL) return NULL; - value = PyInt_AsUnsignedLongMask(num); + value = PyLong_AsUnsignedLongMask(num); if (value != (unsigned long)-0x42) return raiseTestError("test_k_code", - "PyInt_AsUnsignedLongMask() returned wrong value for long 0xFFF...FFF"); + "PyLong_AsUnsignedLongMask() returned wrong value for long 0xFFF...FFF"); PyTuple_SET_ITEM(tuple, 0, num); @@ -642,7 +642,7 @@ raise_exception(PyObject *self, PyObject *args) if (exc_args == NULL) return NULL; for (i = 0; i < num_args; ++i) { - v = PyInt_FromLong(i); + v = PyLong_FromLong(i); if (v == NULL) { Py_DECREF(exc_args); return NULL; @@ -796,7 +796,7 @@ profile_int(PyObject *self, PyObject* args) gettimeofday(&start, NULL); for(k=0; k < 20000; k++) for(i=0; i < 1000; i++) { - single = PyInt_FromLong(i); + single = PyLong_FromLong(i); Py_DECREF(single); } gettimeofday(&stop, NULL); @@ -807,7 +807,7 @@ profile_int(PyObject *self, PyObject* args) gettimeofday(&start, NULL); for(k=0; k < 20000; k++) for(i=0; i < 1000; i++) { - single = PyInt_FromLong(i+1000000); + single = PyLong_FromLong(i+1000000); Py_DECREF(single); } gettimeofday(&stop, NULL); @@ -819,7 +819,7 @@ profile_int(PyObject *self, PyObject* args) gettimeofday(&start, NULL); for(k=0; k < 20000; k++) { for(i=0; i < 1000; i++) { - multiple[i] = PyInt_FromLong(i+1000000); + multiple[i] = PyLong_FromLong(i+1000000); } for(i=0; i < 1000; i++) { Py_DECREF(multiple[i]); @@ -834,7 +834,7 @@ profile_int(PyObject *self, PyObject* args) gettimeofday(&start, NULL); for(k=0; k < 20; k++) { for(i=0; i < 1000000; i++) { - multiple[i] = PyInt_FromLong(i+1000000); + multiple[i] = PyLong_FromLong(i+1000000); } for(i=0; i < 1000000; i++) { Py_DECREF(multiple[i]); @@ -848,7 +848,7 @@ profile_int(PyObject *self, PyObject* args) gettimeofday(&start, NULL); for(k=0; k < 10; k++) { for(i=0; i < 1000000; i++) { - multiple[i] = PyInt_FromLong(i+1000); + multiple[i] = PyLong_FromLong(i+1000); } for(i=0; i < 1000000; i++) { Py_DECREF(multiple[i]); @@ -858,7 +858,7 @@ profile_int(PyObject *self, PyObject* args) print_delta(5, &start, &stop); /* Test 6: Perform small int addition */ - op1 = PyInt_FromLong(1); + op1 = PyLong_FromLong(1); gettimeofday(&start, NULL); for(i=0; i < 10000000; i++) { result = PyNumber_Add(op1, op1); @@ -869,7 +869,7 @@ profile_int(PyObject *self, PyObject* args) print_delta(6, &start, &stop); /* Test 7: Perform medium int addition */ - op1 = PyInt_FromLong(1000); + op1 = PyLong_FromLong(1000); gettimeofday(&start, NULL); for(i=0; i < 10000000; i++) { result = PyNumber_Add(op1, op1); @@ -1061,17 +1061,17 @@ init_testcapi(void) Py_INCREF(&test_structmembersType); PyModule_AddObject(m, "test_structmembersType", (PyObject *)&test_structmembersType); - PyModule_AddObject(m, "CHAR_MAX", PyInt_FromLong(CHAR_MAX)); - PyModule_AddObject(m, "CHAR_MIN", PyInt_FromLong(CHAR_MIN)); - PyModule_AddObject(m, "UCHAR_MAX", PyInt_FromLong(UCHAR_MAX)); - PyModule_AddObject(m, "SHRT_MAX", PyInt_FromLong(SHRT_MAX)); - PyModule_AddObject(m, "SHRT_MIN", PyInt_FromLong(SHRT_MIN)); - PyModule_AddObject(m, "USHRT_MAX", PyInt_FromLong(USHRT_MAX)); + PyModule_AddObject(m, "CHAR_MAX", PyLong_FromLong(CHAR_MAX)); + PyModule_AddObject(m, "CHAR_MIN", PyLong_FromLong(CHAR_MIN)); + PyModule_AddObject(m, "UCHAR_MAX", PyLong_FromLong(UCHAR_MAX)); + PyModule_AddObject(m, "SHRT_MAX", PyLong_FromLong(SHRT_MAX)); + PyModule_AddObject(m, "SHRT_MIN", PyLong_FromLong(SHRT_MIN)); + PyModule_AddObject(m, "USHRT_MAX", PyLong_FromLong(USHRT_MAX)); PyModule_AddObject(m, "INT_MAX", PyLong_FromLong(INT_MAX)); PyModule_AddObject(m, "INT_MIN", PyLong_FromLong(INT_MIN)); PyModule_AddObject(m, "UINT_MAX", PyLong_FromUnsignedLong(UINT_MAX)); - PyModule_AddObject(m, "LONG_MAX", PyInt_FromLong(LONG_MAX)); - PyModule_AddObject(m, "LONG_MIN", PyInt_FromLong(LONG_MIN)); + PyModule_AddObject(m, "LONG_MAX", PyLong_FromLong(LONG_MAX)); + PyModule_AddObject(m, "LONG_MIN", PyLong_FromLong(LONG_MIN)); PyModule_AddObject(m, "ULONG_MAX", PyLong_FromUnsignedLong(ULONG_MAX)); PyModule_AddObject(m, "FLT_MAX", PyFloat_FromDouble(FLT_MAX)); PyModule_AddObject(m, "FLT_MIN", PyFloat_FromDouble(FLT_MIN)); @@ -1080,8 +1080,8 @@ init_testcapi(void) PyModule_AddObject(m, "LLONG_MAX", PyLong_FromLongLong(PY_LLONG_MAX)); PyModule_AddObject(m, "LLONG_MIN", PyLong_FromLongLong(PY_LLONG_MIN)); PyModule_AddObject(m, "ULLONG_MAX", PyLong_FromUnsignedLongLong(PY_ULLONG_MAX)); - PyModule_AddObject(m, "PY_SSIZE_T_MAX", PyInt_FromSsize_t(PY_SSIZE_T_MAX)); - PyModule_AddObject(m, "PY_SSIZE_T_MIN", PyInt_FromSsize_t(PY_SSIZE_T_MIN)); + PyModule_AddObject(m, "PY_SSIZE_T_MAX", PyLong_FromSsize_t(PY_SSIZE_T_MAX)); + PyModule_AddObject(m, "PY_SSIZE_T_MIN", PyLong_FromSsize_t(PY_SSIZE_T_MIN)); TestError = PyErr_NewException("_testcapi.error", NULL, NULL); Py_INCREF(TestError); diff --git a/Modules/_tkinter.c b/Modules/_tkinter.c index 577ad62..c755f89 100644 --- a/Modules/_tkinter.c +++ b/Modules/_tkinter.c @@ -44,7 +44,7 @@ Copyright (C) 1994 Steen Lumholt. #ifndef PyBool_Check #define PyBool_Check(o) 0 -#define PyBool_FromLong PyInt_FromLong +#define PyBool_FromLong PyLong_FromLong #endif /* Starting with Tcl 8.4, many APIs offer const-correctness. Unfortunately, @@ -870,7 +870,7 @@ AsObj(PyObject *value) else if (PyBool_Check(value)) return Tcl_NewBooleanObj(PyObject_IsTrue(value)); else if (PyInt_CheckExact(value)) - return Tcl_NewLongObj(PyInt_AS_LONG(value)); + return Tcl_NewLongObj(PyLong_AS_LONG(value)); else if (PyFloat_Check(value)) return Tcl_NewDoubleObj(PyFloat_AS_DOUBLE(value)); else if (PyTuple_Check(value)) { @@ -960,7 +960,7 @@ FromObj(PyObject* tkapp, Tcl_Obj *value) } if (value->typePtr == app->IntType) { - return PyInt_FromLong(value->internalRep.longValue); + return PyLong_FromLong(value->internalRep.longValue); } if (value->typePtr == app->ListType) { @@ -1647,7 +1647,7 @@ Tkapp_GetInt(PyObject *self, PyObject *args) if (PyTuple_Size(args) == 1) { PyObject* o = PyTuple_GetItem(args, 0); - if (PyInt_Check(o)) { + if (PyLong_Check(o)) { Py_INCREF(o); return o; } @@ -1687,7 +1687,7 @@ Tkapp_GetBoolean(PyObject *self, PyObject *args) if (PyTuple_Size(args) == 1) { PyObject *o = PyTuple_GetItem(args, 0); - if (PyInt_Check(o)) { + if (PyLong_Check(o)) { Py_INCREF(o); return o; } @@ -2527,7 +2527,7 @@ Tkapp_InterpAddr(PyObject *self, PyObject *args) if (!PyArg_ParseTuple(args, ":interpaddr")) return NULL; - return PyInt_FromLong((long)Tkapp_Interp(self)); + return PyLong_FromLong((long)Tkapp_Interp(self)); } static PyObject * @@ -2856,7 +2856,7 @@ frames in an animation."; static PyObject * Tkinter_getbusywaitinterval(PyObject *self, PyObject *args) { - return PyInt_FromLong(Tkinter_busywaitinterval); + return PyLong_FromLong(Tkinter_busywaitinterval); } static char getbusywaitinterval_doc[] = @@ -2987,7 +2987,7 @@ DisableEventHook(void) static void ins_long(PyObject *d, char *name, long val) { - PyObject *v = PyInt_FromLong(val); + PyObject *v = PyLong_FromLong(val); if (v) { PyDict_SetItemString(d, name, v); Py_DECREF(v); diff --git a/Modules/_weakref.c b/Modules/_weakref.c index cb7977b..f4ee3a3 100644 --- a/Modules/_weakref.c +++ b/Modules/_weakref.c @@ -17,10 +17,10 @@ weakref_getweakrefcount(PyObject *self, PyObject *object) if (PyType_SUPPORTS_WEAKREFS(Py_Type(object))) { PyWeakReference **list = GET_WEAKREFS_LISTPTR(object); - result = PyInt_FromSsize_t(_PyWeakref_GetWeakrefCount(*list)); + result = PyLong_FromSsize_t(_PyWeakref_GetWeakrefCount(*list)); } else - result = PyInt_FromLong(0); + result = PyLong_FromLong(0); return result; } diff --git a/Modules/arraymodule.c b/Modules/arraymodule.c index c7aeb5b..86afc92 100644 --- a/Modules/arraymodule.c +++ b/Modules/arraymodule.c @@ -115,7 +115,7 @@ b_getitem(arrayobject *ap, Py_ssize_t i) long x = ((char *)ap->ob_item)[i]; if (x >= 128) x -= 256; - return PyInt_FromLong(x); + return PyLong_FromLong(x); } static int @@ -146,7 +146,7 @@ static PyObject * BB_getitem(arrayobject *ap, Py_ssize_t i) { long x = ((unsigned char *)ap->ob_item)[i]; - return PyInt_FromLong(x); + return PyLong_FromLong(x); } static int @@ -189,7 +189,7 @@ u_setitem(arrayobject *ap, Py_ssize_t i, PyObject *v) static PyObject * h_getitem(arrayobject *ap, Py_ssize_t i) { - return PyInt_FromLong((long) ((short *)ap->ob_item)[i]); + return PyLong_FromLong((long) ((short *)ap->ob_item)[i]); } @@ -208,7 +208,7 @@ h_setitem(arrayobject *ap, Py_ssize_t i, PyObject *v) static PyObject * HH_getitem(arrayobject *ap, Py_ssize_t i) { - return PyInt_FromLong((long) ((unsigned short *)ap->ob_item)[i]); + return PyLong_FromLong((long) ((unsigned short *)ap->ob_item)[i]); } static int @@ -237,7 +237,7 @@ HH_setitem(arrayobject *ap, Py_ssize_t i, PyObject *v) static PyObject * i_getitem(arrayobject *ap, Py_ssize_t i) { - return PyInt_FromLong((long) ((int *)ap->ob_item)[i]); + return PyLong_FromLong((long) ((int *)ap->ob_item)[i]); } static int @@ -294,7 +294,7 @@ II_setitem(arrayobject *ap, Py_ssize_t i, PyObject *v) static PyObject * l_getitem(arrayobject *ap, Py_ssize_t i) { - return PyInt_FromLong(((long *)ap->ob_item)[i]); + return PyLong_FromLong(((long *)ap->ob_item)[i]); } static int @@ -899,7 +899,7 @@ array_count(arrayobject *self, PyObject *v) else if (cmp < 0) return NULL; } - return PyInt_FromSsize_t(count); + return PyLong_FromSsize_t(count); } PyDoc_STRVAR(count_doc, @@ -917,7 +917,7 @@ array_index(arrayobject *self, PyObject *v) int cmp = PyObject_RichCompareBool(selfi, v, Py_EQ); Py_DECREF(selfi); if (cmp > 0) { - return PyInt_FromLong((long)i); + return PyLong_FromLong((long)i); } else if (cmp < 0) return NULL; @@ -1043,7 +1043,7 @@ array_buffer_info(arrayobject *self, PyObject *unused) return NULL; PyTuple_SET_ITEM(retval, 0, PyLong_FromVoidPtr(self->ob_item)); - PyTuple_SET_ITEM(retval, 1, PyInt_FromLong((long)(Py_Size(self)))); + PyTuple_SET_ITEM(retval, 1, PyLong_FromLong((long)(Py_Size(self)))); return retval; } @@ -1483,7 +1483,7 @@ array_get_typecode(arrayobject *a, void *closure) static PyObject * array_get_itemsize(arrayobject *a, void *closure) { - return PyInt_FromLong((long)a->ob_descr->itemsize); + return PyLong_FromLong((long)a->ob_descr->itemsize); } static PyGetSetDef array_getsets [] = { diff --git a/Modules/audioop.c b/Modules/audioop.c index 78eddd1..eb38082 100644 --- a/Modules/audioop.c +++ b/Modules/audioop.c @@ -315,7 +315,7 @@ audioop_getsample(PyObject *self, PyObject *args) if ( size == 1 ) val = (int)*CHARP(cp, i); else if ( size == 2 ) val = (int)*SHORTP(cp, i*2); else if ( size == 4 ) val = (int)*LONGP(cp, i*4); - return PyInt_FromLong(val); + return PyLong_FromLong(val); } static PyObject * @@ -339,7 +339,7 @@ audioop_max(PyObject *self, PyObject *args) if ( val < 0 ) val = (-val); if ( val > max ) max = val; } - return PyInt_FromLong(max); + return PyLong_FromLong(max); } static PyObject * @@ -390,7 +390,7 @@ audioop_avg(PyObject *self, PyObject *args) val = 0; else val = (int)(avg / (double)(len/size)); - return PyInt_FromLong(val); + return PyLong_FromLong(val); } static PyObject * @@ -417,7 +417,7 @@ audioop_rms(PyObject *self, PyObject *args) val = 0; else val = (int)sqrt(sum_squares / (double)(len/size)); - return PyInt_FromLong(val); + return PyLong_FromLong(val); } static double _sum2(short *a, short *b, int len) @@ -599,7 +599,7 @@ audioop_findmax(PyObject *self, PyObject *args) } - return PyInt_FromLong(best_j); + return PyLong_FromLong(best_j); } static PyObject * @@ -656,7 +656,7 @@ audioop_avgpp(PyObject *self, PyObject *args) val = 0; else val = (int)(avg / (double)nextreme); - return PyInt_FromLong(val); + return PyLong_FromLong(val); } static PyObject * @@ -709,7 +709,7 @@ audioop_maxpp(PyObject *self, PyObject *args) if ( diff != 0 ) prevdiff = diff; } - return PyInt_FromLong(max); + return PyLong_FromLong(max); } static PyObject * @@ -736,7 +736,7 @@ audioop_cross(PyObject *self, PyObject *args) if ( val != prevval ) ncross++; prevval = val; } - return PyInt_FromLong(ncross); + return PyLong_FromLong(ncross); } static PyObject * diff --git a/Modules/binascii.c b/Modules/binascii.c index 62fc8c2..5f8705d 100644 --- a/Modules/binascii.c +++ b/Modules/binascii.c @@ -924,7 +924,7 @@ binascii_crc32(PyObject *self, PyObject *args) */ result |= -(result & (1L << 31)); #endif - return PyInt_FromLong(result); + return PyLong_FromLong(result); } diff --git a/Modules/bz2module.c b/Modules/bz2module.c index e0fbb57..32c8106 100644 --- a/Modules/bz2module.c +++ b/Modules/bz2module.c @@ -894,10 +894,10 @@ BZ2File_seek(BZ2FileObject *self, PyObject *args) if (!PyArg_ParseTuple(args, "O|i:seek", &offobj, &where)) return NULL; #if !defined(HAVE_LARGEFILE_SUPPORT) - offset = PyInt_AsLong(offobj); + offset = PyLong_AsLong(offobj); #else offset = PyLong_Check(offobj) ? - PyLong_AsLongLong(offobj) : PyInt_AsLong(offobj); + PyLong_AsLongLong(offobj) : PyLong_AsLong(offobj); #endif if (PyErr_Occurred()) return NULL; @@ -1028,7 +1028,7 @@ BZ2File_tell(BZ2FileObject *self, PyObject *args) } #if !defined(HAVE_LARGEFILE_SUPPORT) - ret = PyInt_FromLong(self->pos); + ret = PyLong_FromLong(self->pos); #else ret = PyLong_FromLongLong(self->pos); #endif @@ -1102,7 +1102,7 @@ static PyMethodDef BZ2File_methods[] = { static PyObject * BZ2File_get_closed(BZ2FileObject *self, void *closure) { - return PyInt_FromLong(self->mode == MODE_CLOSED); + return PyLong_FromLong(self->mode == MODE_CLOSED); } static PyGetSetDef BZ2File_getset[] = { diff --git a/Modules/cStringIO.c b/Modules/cStringIO.c index 9b39703..79834f9 100644 --- a/Modules/cStringIO.c +++ b/Modules/cStringIO.c @@ -276,7 +276,7 @@ IO_tell(IOobject *self, PyObject *unused) { if (!IO__opencheck(self)) return NULL; - return PyInt_FromSsize_t(self->pos); + return PyLong_FromSsize_t(self->pos); } PyDoc_STRVAR(IO_truncate__doc__, diff --git a/Modules/cjkcodecs/multibytecodec.c b/Modules/cjkcodecs/multibytecodec.c index a05a017..5672fc33 100644 --- a/Modules/cjkcodecs/multibytecodec.c +++ b/Modules/cjkcodecs/multibytecodec.c @@ -65,7 +65,7 @@ make_tuple(PyObject *object, Py_ssize_t len) } PyTuple_SET_ITEM(v, 0, object); - w = PyInt_FromSsize_t(len); + w = PyLong_FromSsize_t(len); if (w == NULL) { Py_DECREF(v); return NULL; @@ -313,7 +313,7 @@ multibytecodec_encerror(MultibyteCodec *codec, if (!PyTuple_Check(retobj) || PyTuple_GET_SIZE(retobj) != 2 || !PyUnicode_Check((tobj = PyTuple_GET_ITEM(retobj, 0))) || - !PyInt_Check(PyTuple_GET_ITEM(retobj, 1))) { + !PyLong_Check(PyTuple_GET_ITEM(retobj, 1))) { PyErr_SetString(PyExc_TypeError, "encoding error handler must return " "(unicode, int) tuple"); @@ -337,7 +337,7 @@ multibytecodec_encerror(MultibyteCodec *codec, memcpy(buf->outbuf, PyString_AS_STRING(retstr), retstrsize); buf->outbuf += retstrsize; - newpos = PyInt_AsSsize_t(PyTuple_GET_ITEM(retobj, 1)); + newpos = PyLong_AsSsize_t(PyTuple_GET_ITEM(retobj, 1)); if (newpos < 0 && !PyErr_Occurred()) newpos += (Py_ssize_t)(buf->inbuf_end - buf->inbuf_top); if (newpos < 0 || buf->inbuf_top + newpos > buf->inbuf_end) { @@ -432,7 +432,7 @@ multibytecodec_decerror(MultibyteCodec *codec, if (!PyTuple_Check(retobj) || PyTuple_GET_SIZE(retobj) != 2 || !PyUnicode_Check((retuni = PyTuple_GET_ITEM(retobj, 0))) || - !PyInt_Check(PyTuple_GET_ITEM(retobj, 1))) { + !PyLong_Check(PyTuple_GET_ITEM(retobj, 1))) { PyErr_SetString(PyExc_TypeError, "decoding error handler must return " "(unicode, int) tuple"); @@ -447,7 +447,7 @@ multibytecodec_decerror(MultibyteCodec *codec, buf->outbuf += retunisize; } - newpos = PyInt_AsSsize_t(PyTuple_GET_ITEM(retobj, 1)); + newpos = PyLong_AsSsize_t(PyTuple_GET_ITEM(retobj, 1)); if (newpos < 0 && !PyErr_Occurred()) newpos += (Py_ssize_t)(buf->inbuf_end - buf->inbuf_top); if (newpos < 0 || buf->inbuf_top + newpos > buf->inbuf_end) { @@ -1317,8 +1317,8 @@ mbstreamreader_read(MultibyteStreamReaderObject *self, PyObject *args) if (sizeobj == Py_None || sizeobj == NULL) size = -1; - else if (PyInt_Check(sizeobj)) - size = PyInt_AsSsize_t(sizeobj); + else if (PyLong_Check(sizeobj)) + size = PyLong_AsSsize_t(sizeobj); else { PyErr_SetString(PyExc_TypeError, "arg 1 must be an integer"); return NULL; @@ -1341,8 +1341,8 @@ mbstreamreader_readline(MultibyteStreamReaderObject *self, PyObject *args) if (sizeobj == Py_None || sizeobj == NULL) size = -1; - else if (PyInt_Check(sizeobj)) - size = PyInt_AsSsize_t(sizeobj); + else if (PyLong_Check(sizeobj)) + size = PyLong_AsSsize_t(sizeobj); else { PyErr_SetString(PyExc_TypeError, "arg 1 must be an integer"); return NULL; @@ -1365,8 +1365,8 @@ mbstreamreader_readlines(MultibyteStreamReaderObject *self, PyObject *args) if (sizehintobj == Py_None || sizehintobj == NULL) sizehint = -1; - else if (PyInt_Check(sizehintobj)) - sizehint = PyInt_AsSsize_t(sizehintobj); + else if (PyLong_Check(sizehintobj)) + sizehint = PyLong_AsSsize_t(sizehintobj); else { PyErr_SetString(PyExc_TypeError, "arg 1 must be an integer"); return NULL; diff --git a/Modules/datetimemodule.c b/Modules/datetimemodule.c index a8907ac..6955c78 100644 --- a/Modules/datetimemodule.c +++ b/Modules/datetimemodule.c @@ -1220,8 +1220,8 @@ wrap_strftime(PyObject *object, PyObject *format, PyObject *timetuple, long year; PyObject *pyyear = PySequence_GetItem(timetuple, 0); if (pyyear == NULL) return NULL; - assert(PyInt_Check(pyyear)); - year = PyInt_AsLong(pyyear); + assert(PyLong_Check(pyyear)); + year = PyLong_AsLong(pyyear); Py_DECREF(pyyear); if (year < 1900) { PyErr_Format(PyExc_ValueError, "year=%ld is before " @@ -1465,7 +1465,7 @@ delta_to_microseconds(PyDateTime_Delta *self) PyObject *x3 = NULL; PyObject *result = NULL; - x1 = PyInt_FromLong(GET_TD_DAYS(self)); + x1 = PyLong_FromLong(GET_TD_DAYS(self)); if (x1 == NULL) goto Done; x2 = PyNumber_Multiply(x1, seconds_per_day); /* days in seconds */ @@ -1475,7 +1475,7 @@ delta_to_microseconds(PyDateTime_Delta *self) x1 = NULL; /* x2 has days in seconds */ - x1 = PyInt_FromLong(GET_TD_SECONDS(self)); /* seconds */ + x1 = PyLong_FromLong(GET_TD_SECONDS(self)); /* seconds */ if (x1 == NULL) goto Done; x3 = PyNumber_Add(x1, x2); /* days and seconds in seconds */ @@ -1493,7 +1493,7 @@ delta_to_microseconds(PyDateTime_Delta *self) x3 = NULL; /* x1 has days+seconds in us */ - x2 = PyInt_FromLong(GET_TD_MICROSECONDS(self)); + x2 = PyLong_FromLong(GET_TD_MICROSECONDS(self)); if (x2 == NULL) goto Done; result = PyNumber_Add(x1, x2); @@ -1902,7 +1902,7 @@ delta_new(PyTypeObject *type, PyObject *args, PyObject *kw) &ms, &minute, &hour, &week) == 0) goto Done; - x = PyInt_FromLong(0); + x = PyLong_FromLong(0); if (x == NULL) goto Done; @@ -2149,19 +2149,19 @@ static PyTypeObject PyDateTime_DeltaType = { static PyObject * date_year(PyDateTime_Date *self, void *unused) { - return PyInt_FromLong(GET_YEAR(self)); + return PyLong_FromLong(GET_YEAR(self)); } static PyObject * date_month(PyDateTime_Date *self, void *unused) { - return PyInt_FromLong(GET_MONTH(self)); + return PyLong_FromLong(GET_MONTH(self)); } static PyObject * date_day(PyDateTime_Date *self, void *unused) { - return PyInt_FromLong(GET_DAY(self)); + return PyLong_FromLong(GET_DAY(self)); } static PyGetSetDef date_getset[] = { @@ -2456,7 +2456,7 @@ date_isoweekday(PyDateTime_Date *self) { int dow = weekday(GET_YEAR(self), GET_MONTH(self), GET_DAY(self)); - return PyInt_FromLong(dow + 1); + return PyLong_FromLong(dow + 1); } static PyObject * @@ -2563,7 +2563,7 @@ date_hash(PyDateTime_Date *self) static PyObject * date_toordinal(PyDateTime_Date *self) { - return PyInt_FromLong(ymd_to_ord(GET_YEAR(self), GET_MONTH(self), + return PyLong_FromLong(ymd_to_ord(GET_YEAR(self), GET_MONTH(self), GET_DAY(self))); } @@ -2572,7 +2572,7 @@ date_weekday(PyDateTime_Date *self) { int dow = weekday(GET_YEAR(self), GET_MONTH(self), GET_DAY(self)); - return PyInt_FromLong(dow); + return PyLong_FromLong(dow); } /* Pickle support, a simple use of __reduce__. */ @@ -2975,26 +2975,26 @@ static PyTypeObject PyDateTime_TZInfoType = { static PyObject * time_hour(PyDateTime_Time *self, void *unused) { - return PyInt_FromLong(TIME_GET_HOUR(self)); + return PyLong_FromLong(TIME_GET_HOUR(self)); } static PyObject * time_minute(PyDateTime_Time *self, void *unused) { - return PyInt_FromLong(TIME_GET_MINUTE(self)); + return PyLong_FromLong(TIME_GET_MINUTE(self)); } /* The name time_second conflicted with some platform header file. */ static PyObject * py_time_second(PyDateTime_Time *self, void *unused) { - return PyInt_FromLong(TIME_GET_SECOND(self)); + return PyLong_FromLong(TIME_GET_SECOND(self)); } static PyObject * time_microsecond(PyDateTime_Time *self, void *unused) { - return PyInt_FromLong(TIME_GET_MICROSECOND(self)); + return PyLong_FromLong(TIME_GET_MICROSECOND(self)); } static PyObject * @@ -3505,25 +3505,25 @@ static PyTypeObject PyDateTime_TimeType = { static PyObject * datetime_hour(PyDateTime_DateTime *self, void *unused) { - return PyInt_FromLong(DATE_GET_HOUR(self)); + return PyLong_FromLong(DATE_GET_HOUR(self)); } static PyObject * datetime_minute(PyDateTime_DateTime *self, void *unused) { - return PyInt_FromLong(DATE_GET_MINUTE(self)); + return PyLong_FromLong(DATE_GET_MINUTE(self)); } static PyObject * datetime_second(PyDateTime_DateTime *self, void *unused) { - return PyInt_FromLong(DATE_GET_SECOND(self)); + return PyLong_FromLong(DATE_GET_SECOND(self)); } static PyObject * datetime_microsecond(PyDateTime_DateTime *self, void *unused) { - return PyInt_FromLong(DATE_GET_MICROSECOND(self)); + return PyLong_FromLong(DATE_GET_MICROSECOND(self)); } static PyObject * @@ -3837,7 +3837,7 @@ datetime_strptime(PyObject *cls, PyObject *args) return NULL; } if (PyInt_CheckExact(p)) - ia[i] = PyInt_AsLong(p); + ia[i] = PyLong_AsLong(p); else good_timetuple = 0; Py_DECREF(p); @@ -4753,11 +4753,11 @@ initdatetime(void) assert(DI100Y == 25 * DI4Y - 1); assert(DI100Y == days_before_year(100+1)); - us_per_us = PyInt_FromLong(1); - us_per_ms = PyInt_FromLong(1000); - us_per_second = PyInt_FromLong(1000000); - us_per_minute = PyInt_FromLong(60000000); - seconds_per_day = PyInt_FromLong(24 * 3600); + us_per_us = PyLong_FromLong(1); + us_per_ms = PyLong_FromLong(1000); + us_per_second = PyLong_FromLong(1000000); + us_per_minute = PyLong_FromLong(60000000); + seconds_per_day = PyLong_FromLong(24 * 3600); if (us_per_us == NULL || us_per_ms == NULL || us_per_second == NULL || us_per_minute == NULL || seconds_per_day == NULL) return; diff --git a/Modules/dlmodule.c b/Modules/dlmodule.c index 5c582c3..aaca4cf 100644 --- a/Modules/dlmodule.c +++ b/Modules/dlmodule.c @@ -70,7 +70,7 @@ dl_sym(dlobject *xp, PyObject *args) Py_INCREF(Py_None); return Py_None; } - return PyInt_FromLong((long)func); + return PyLong_FromLong((long)func); } static PyObject * @@ -107,8 +107,8 @@ dl_call(dlobject *xp, PyObject *args) } for (i = 1; i < n; i++) { PyObject *v = PyTuple_GetItem(args, i); - if (PyInt_Check(v)) { - alist[i-1] = PyInt_AsLong(v); + if (PyLong_Check(v)) { + alist[i-1] = PyLong_AsLong(v); if (alist[i-1] == -1 && PyErr_Occurred()) return NULL; } else if (PyUnicode_Check(v)) @@ -125,7 +125,7 @@ dl_call(dlobject *xp, PyObject *args) alist[i-1] = 0; res = (*func)(alist[0], alist[1], alist[2], alist[3], alist[4], alist[5], alist[6], alist[7], alist[8], alist[9]); - return PyInt_FromLong(res); + return PyLong_FromLong(res); } static PyMethodDef dlobject_methods[] = { @@ -225,7 +225,7 @@ static PyMethodDef dl_methods[] = { static void insint(PyObject *d, char *name, int value) { - PyObject *v = PyInt_FromLong((long) value); + PyObject *v = PyLong_FromLong((long) value); if (!v || PyDict_SetItemString(d, name, v)) PyErr_Clear(); @@ -249,7 +249,7 @@ initdl(void) d = PyModule_GetDict(m); Dlerror = x = PyErr_NewException("dl.error", NULL, NULL); PyDict_SetItemString(d, "error", x); - x = PyInt_FromLong((long)RTLD_LAZY); + x = PyLong_FromLong((long)RTLD_LAZY); PyDict_SetItemString(d, "RTLD_LAZY", x); #define INSINT(X) insint(d,#X,X) #ifdef RTLD_NOW diff --git a/Modules/errnomodule.c b/Modules/errnomodule.c index 21dfe1d..b1beb00 100644 --- a/Modules/errnomodule.c +++ b/Modules/errnomodule.c @@ -22,7 +22,7 @@ static void _inscode(PyObject *d, PyObject *de, const char *name, int code) { PyObject *u = PyUnicode_FromString(name); - PyObject *v = PyInt_FromLong((long) code); + PyObject *v = PyLong_FromLong((long) code); /* Don't bother checking for errors; they'll be caught at the end * of the module initialization function by the caller of diff --git a/Modules/fcntlmodule.c b/Modules/fcntlmodule.c index 4e49a7d..4361bfa 100644 --- a/Modules/fcntlmodule.c +++ b/Modules/fcntlmodule.c @@ -73,7 +73,7 @@ fcntl_fcntl(PyObject *self, PyObject *args) PyErr_SetFromErrno(PyExc_IOError); return NULL; } - return PyInt_FromLong((long)ret); + return PyLong_FromLong((long)ret); } PyDoc_STRVAR(fcntl_doc, @@ -152,7 +152,7 @@ fcntl_ioctl(PyObject *self, PyObject *args) return NULL; } if (mutate_arg) { - return PyInt_FromLong(ret); + return PyLong_FromLong(ret); } else { return PyString_FromStringAndSize(buf, len); @@ -198,7 +198,7 @@ fcntl_ioctl(PyObject *self, PyObject *args) PyErr_SetFromErrno(PyExc_IOError); return NULL; } - return PyInt_FromLong((long)ret); + return PyLong_FromLong((long)ret); #undef IOCTL_BUFSZ } @@ -333,22 +333,22 @@ fcntl_lockf(PyObject *self, PyObject *args) l.l_start = l.l_len = 0; if (startobj != NULL) { #if !defined(HAVE_LARGEFILE_SUPPORT) - l.l_start = PyInt_AsLong(startobj); + l.l_start = PyLong_AsLong(startobj); #else l.l_start = PyLong_Check(startobj) ? PyLong_AsLongLong(startobj) : - PyInt_AsLong(startobj); + PyLong_AsLong(startobj); #endif if (PyErr_Occurred()) return NULL; } if (lenobj != NULL) { #if !defined(HAVE_LARGEFILE_SUPPORT) - l.l_len = PyInt_AsLong(lenobj); + l.l_len = PyLong_AsLong(lenobj); #else l.l_len = PyLong_Check(lenobj) ? PyLong_AsLongLong(lenobj) : - PyInt_AsLong(lenobj); + PyLong_AsLong(lenobj); #endif if (PyErr_Occurred()) return NULL; @@ -414,7 +414,7 @@ a file or socket object."); static int ins(PyObject* d, char* symbol, long value) { - PyObject* v = PyInt_FromLong(value); + PyObject* v = PyLong_FromLong(value); if (!v || PyDict_SetItemString(d, symbol, v) < 0) return -1; diff --git a/Modules/gcmodule.c b/Modules/gcmodule.c index 63fb1f1..a5d789a 100644 --- a/Modules/gcmodule.c +++ b/Modules/gcmodule.c @@ -944,7 +944,7 @@ gc_collect(PyObject *self, PyObject *args, PyObject *kws) collecting = 0; } - return PyInt_FromSsize_t(n); + return PyLong_FromSsize_t(n); } PyDoc_STRVAR(gc_set_debug__doc__, diff --git a/Modules/grpmodule.c b/Modules/grpmodule.c index 7e47925..a39ca76 100644 --- a/Modules/grpmodule.c +++ b/Modules/grpmodule.c @@ -70,7 +70,7 @@ mkgrent(struct group *p) Py_INCREF(Py_None); } #endif - SET(setIndex++, PyInt_FromLong((long) p->gr_gid)); + SET(setIndex++, PyLong_FromLong((long) p->gr_gid)); SET(setIndex++, w); #undef SET @@ -93,7 +93,7 @@ grp_getgrgid(PyObject *self, PyObject *pyo_id) py_int_id = PyNumber_Int(pyo_id); if (!py_int_id) return NULL; - gid = PyInt_AS_LONG(py_int_id); + gid = PyLong_AS_LONG(py_int_id); Py_DECREF(py_int_id); if ((p = getgrgid(gid)) == NULL) { diff --git a/Modules/itertoolsmodule.c b/Modules/itertoolsmodule.c index 8e5b3d0..fc99bd5 100644 --- a/Modules/itertoolsmodule.c +++ b/Modules/itertoolsmodule.c @@ -1122,7 +1122,7 @@ islice_new(PyTypeObject *type, PyObject *args, PyObject *kwds) numargs = PyTuple_Size(args); if (numargs == 2) { if (a1 != Py_None) { - stop = PyInt_AsSsize_t(a1); + stop = PyLong_AsSsize_t(a1); if (stop == -1) { if (PyErr_Occurred()) PyErr_Clear(); @@ -1133,11 +1133,11 @@ islice_new(PyTypeObject *type, PyObject *args, PyObject *kwds) } } else { if (a1 != Py_None) - start = PyInt_AsSsize_t(a1); + start = PyLong_AsSsize_t(a1); if (start == -1 && PyErr_Occurred()) PyErr_Clear(); if (a2 != Py_None) { - stop = PyInt_AsSsize_t(a2); + stop = PyLong_AsSsize_t(a2); if (stop == -1) { if (PyErr_Occurred()) PyErr_Clear(); @@ -1155,7 +1155,7 @@ islice_new(PyTypeObject *type, PyObject *args, PyObject *kwds) if (a3 != NULL) { if (a3 != Py_None) - step = PyInt_AsSsize_t(a3); + step = PyLong_AsSsize_t(a3); if (step == -1 && PyErr_Occurred()) PyErr_Clear(); } @@ -2052,7 +2052,7 @@ count_new(PyTypeObject *type, PyObject *args, PyObject *kwds) return NULL; if (cnt_arg != NULL) { - cnt = PyInt_AsSsize_t(cnt_arg); + cnt = PyLong_AsSsize_t(cnt_arg); if (cnt == -1 && PyErr_Occurred()) { PyErr_Clear(); if (!PyLong_Check(cnt_arg)) { @@ -2092,12 +2092,12 @@ count_nextlong(countobject *lz) PyObject *stepped_up; if (lz->long_cnt == NULL) { - lz->long_cnt = PyInt_FromSsize_t(PY_SSIZE_T_MAX); + lz->long_cnt = PyLong_FromSsize_t(PY_SSIZE_T_MAX); if (lz->long_cnt == NULL) return NULL; } if (one == NULL) { - one = PyInt_FromLong(1); + one = PyLong_FromLong(1); if (one == NULL) return NULL; } @@ -2115,7 +2115,7 @@ count_next(countobject *lz) { if (lz->cnt == PY_SSIZE_T_MAX) return count_nextlong(lz); - return PyInt_FromSsize_t(lz->cnt++); + return PyLong_FromSsize_t(lz->cnt++); } static PyObject * @@ -2440,7 +2440,7 @@ repeat_len(repeatobject *ro) PyErr_SetString(PyExc_TypeError, "len() of unsized object"); return NULL; } - return PyInt_FromSize_t(ro->cnt); + return PyLong_FromSize_t(ro->cnt); } PyDoc_STRVAR(length_hint_doc, "Private method returning an estimate of len(list(it))."); diff --git a/Modules/md5module.c b/Modules/md5module.c index c5770b3..567383a 100644 --- a/Modules/md5module.c +++ b/Modules/md5module.c @@ -434,7 +434,7 @@ static PyMethodDef MD5_methods[] = { static PyObject * MD5_get_block_size(PyObject *self, void *closure) { - return PyInt_FromLong(MD5_BLOCKSIZE); + return PyLong_FromLong(MD5_BLOCKSIZE); } static PyObject * @@ -446,7 +446,7 @@ MD5_get_name(PyObject *self, void *closure) static PyObject * md5_get_digest_size(PyObject *self, void *closure) { - return PyInt_FromLong(MD5_DIGESTSIZE); + return PyLong_FromLong(MD5_DIGESTSIZE); } diff --git a/Modules/mmapmodule.c b/Modules/mmapmodule.c index 1a58f3d..77aa643 100644 --- a/Modules/mmapmodule.c +++ b/Modules/mmapmodule.c @@ -280,10 +280,10 @@ mmap_find_method(mmap_object *self, for (i = 0; i < len && needle[i] == p[i]; ++i) /* nothing */; if (i == len) { - return PyInt_FromSsize_t(p - self->data); + return PyLong_FromSsize_t(p - self->data); } } - return PyInt_FromLong(-1); + return PyLong_FromLong(-1); } } @@ -373,11 +373,11 @@ mmap_size_method(mmap_object *self, return PyErr_SetFromWindowsErr(error); } if (!high && low < LONG_MAX) - return PyInt_FromLong((long)low); + return PyLong_FromLong((long)low); size = (((PY_LONG_LONG)high)<<32) + low; return PyLong_FromLongLong(size); } else { - return PyInt_FromSsize_t(self->size); + return PyLong_FromSsize_t(self->size); } #endif /* MS_WINDOWS */ @@ -388,7 +388,7 @@ mmap_size_method(mmap_object *self, PyErr_SetFromErrno(mmap_module_error); return NULL; } - return PyInt_FromSsize_t(buf.st_size); + return PyLong_FromSsize_t(buf.st_size); } #endif /* UNIX */ } @@ -501,7 +501,7 @@ static PyObject * mmap_tell_method(mmap_object *self, PyObject *unused) { CHECK_VALID(NULL); - return PyInt_FromSize_t(self->pos); + return PyLong_FromSize_t(self->pos); } static PyObject * @@ -517,7 +517,7 @@ mmap_flush_method(mmap_object *self, PyObject *args) return NULL; } else { #ifdef MS_WINDOWS - return PyInt_FromLong((long) + return PyLong_FromLong((long) FlushViewOfFile(self->data+offset, size)); #endif /* MS_WINDOWS */ #ifdef UNIX @@ -529,7 +529,7 @@ mmap_flush_method(mmap_object *self, PyObject *args) PyErr_SetFromErrno(mmap_module_error); return NULL; } - return PyInt_FromLong(0); + return PyLong_FromLong(0); #endif /* UNIX */ } } @@ -676,7 +676,7 @@ mmap_subscript(mmap_object *self, PyObject *item) "mmap index out of range"); return NULL; } - return PyInt_FromLong(Py_CHARMASK(self->data[i])); + return PyLong_FromLong(Py_CHARMASK(self->data[i])); } else if (PySlice_Check(item)) { Py_ssize_t start, stop, step, slicelen; @@ -1241,7 +1241,7 @@ static struct PyMethodDef mmap_functions[] = { static void setint(PyObject *d, const char *name, long value) { - PyObject *o = PyInt_FromLong(value); + PyObject *o = PyLong_FromLong(value); if (o && PyDict_SetItemString(d, name, o) == 0) { Py_DECREF(o); } diff --git a/Modules/operator.c b/Modules/operator.c index b088d93..08a1ed5 100644 --- a/Modules/operator.c +++ b/Modules/operator.c @@ -46,13 +46,13 @@ used for special class methods; variants without leading and trailing\n\ PyObject *a1, *a2; long r; \ if(! PyArg_UnpackTuple(a,#OP,2,2,&a1,&a2)) return NULL; \ if(-1 == (r=AOP(a1,a2))) return NULL; \ - return PyInt_FromLong(r); } + return PyLong_FromLong(r); } #define spamn2(OP,AOP) static PyObject *OP(PyObject *s, PyObject *a) { \ PyObject *a1, *a2; Py_ssize_t r; \ if(! PyArg_UnpackTuple(a,#OP,2,2,&a1,&a2)) return NULL; \ if(-1 == (r=AOP(a1,a2))) return NULL; \ - return PyInt_FromSsize_t(r); } + return PyLong_FromSsize_t(r); } #define spami2b(OP,AOP) static PyObject *OP(PyObject *s, PyObject *a) { \ PyObject *a1, *a2; long r; \ diff --git a/Modules/ossaudiodev.c b/Modules/ossaudiodev.c index 8cc9462..2bd79d5 100644 --- a/Modules/ossaudiodev.c +++ b/Modules/ossaudiodev.c @@ -235,7 +235,7 @@ _do_ioctl_1(int fd, PyObject *args, char *fname, int cmd) if (ioctl(fd, cmd, &arg) == -1) return PyErr_SetFromErrno(PyExc_IOError); - return PyInt_FromLong(arg); + return PyLong_FromLong(arg); } @@ -260,7 +260,7 @@ _do_ioctl_1_internal(int fd, PyObject *args, char *fname, int cmd) if (ioctl(fd, cmd, &arg) == -1) return PyErr_SetFromErrno(PyExc_IOError); - return PyInt_FromLong(arg); + return PyLong_FromLong(arg); } @@ -320,7 +320,7 @@ oss_getfmts(oss_audio_t *self, PyObject *unused) int mask; if (ioctl(self->fd, SNDCTL_DSP_GETFMTS, &mask) == -1) return PyErr_SetFromErrno(PyExc_IOError); - return PyInt_FromLong(mask); + return PyLong_FromLong(mask); } static PyObject * @@ -404,7 +404,7 @@ oss_write(oss_audio_t *self, PyObject *args) } else { self->ocount += rv; } - return PyInt_FromLong(rv); + return PyLong_FromLong(rv); } static PyObject * @@ -472,7 +472,7 @@ oss_close(oss_audio_t *self, PyObject *unused) static PyObject * oss_fileno(oss_audio_t *self, PyObject *unused) { - return PyInt_FromLong(self->fd); + return PyLong_FromLong(self->fd); } @@ -529,9 +529,9 @@ oss_setparameters(oss_audio_t *self, PyObject *args) rv = PyTuple_New(3); if (rv == NULL) return NULL; - PyTuple_SET_ITEM(rv, 0, PyInt_FromLong(fmt)); - PyTuple_SET_ITEM(rv, 1, PyInt_FromLong(channels)); - PyTuple_SET_ITEM(rv, 2, PyInt_FromLong(rate)); + PyTuple_SET_ITEM(rv, 0, PyLong_FromLong(fmt)); + PyTuple_SET_ITEM(rv, 1, PyLong_FromLong(channels)); + PyTuple_SET_ITEM(rv, 2, PyLong_FromLong(rate)); return rv; } @@ -584,7 +584,7 @@ oss_bufsize(oss_audio_t *self, PyObject *unused) PyErr_SetFromErrno(PyExc_IOError); return NULL; } - return PyInt_FromLong((ai.fragstotal * ai.fragsize) / (nchannels * ssize)); + return PyLong_FromLong((ai.fragstotal * ai.fragsize) / (nchannels * ssize)); } /* obufcount returns the number of samples that are available in the @@ -603,7 +603,7 @@ oss_obufcount(oss_audio_t *self, PyObject *unused) PyErr_SetFromErrno(PyExc_IOError); return NULL; } - return PyInt_FromLong((ai.fragstotal * ai.fragsize - ai.bytes) / + return PyLong_FromLong((ai.fragstotal * ai.fragsize - ai.bytes) / (ssize * nchannels)); } @@ -623,7 +623,7 @@ oss_obuffree(oss_audio_t *self, PyObject *unused) PyErr_SetFromErrno(PyExc_IOError); return NULL; } - return PyInt_FromLong(ai.bytes / (ssize * nchannels)); + return PyLong_FromLong(ai.bytes / (ssize * nchannels)); } static PyObject * @@ -662,7 +662,7 @@ oss_mixer_close(oss_mixer_t *self, PyObject *unused) static PyObject * oss_mixer_fileno(oss_mixer_t *self, PyObject *unused) { - return PyInt_FromLong(self->fd); + return PyLong_FromLong(self->fd); } /* Simple mixer interface methods */ diff --git a/Modules/parsermodule.c b/Modules/parsermodule.c index a8a7ece..87f9e2e 100644 --- a/Modules/parsermodule.c +++ b/Modules/parsermodule.c @@ -89,7 +89,7 @@ node2tuple(node *n, /* node to convert */ v = mkseq(1 + NCH(n) + (TYPE(n) == encoding_decl)); if (v == NULL) return (v); - w = PyInt_FromLong(TYPE(n)); + w = PyLong_FromLong(TYPE(n)); if (w == NULL) { Py_DECREF(v); return ((PyObject*) NULL); @@ -111,12 +111,12 @@ node2tuple(node *n, /* node to convert */ else if (ISTERMINAL(TYPE(n))) { PyObject *result = mkseq(2 + lineno + col_offset); if (result != NULL) { - (void) addelem(result, 0, PyInt_FromLong(TYPE(n))); + (void) addelem(result, 0, PyLong_FromLong(TYPE(n))); (void) addelem(result, 1, PyUnicode_FromString(STR(n))); if (lineno == 1) - (void) addelem(result, 2, PyInt_FromLong(n->n_lineno)); + (void) addelem(result, 2, PyLong_FromLong(n->n_lineno)); if (col_offset == 1) - (void) addelem(result, 3, PyInt_FromLong(n->n_col_offset)); + (void) addelem(result, 3, PyLong_FromLong(n->n_col_offset)); } return (result); } @@ -664,9 +664,9 @@ build_node_children(PyObject *tuple, node *root, int *line_num) if (temp == NULL) ok = 0; else { - ok = PyInt_Check(temp); + ok = PyLong_Check(temp); if (ok) - type = PyInt_AS_LONG(temp); + type = PyLong_AS_LONG(temp); Py_DECREF(temp); } } @@ -702,8 +702,8 @@ build_node_children(PyObject *tuple, node *root, int *line_num) if (len == 3) { PyObject *o = PySequence_GetItem(elem, 2); if (o != NULL) { - if (PyInt_Check(o)) - *line_num = PyInt_AS_LONG(o); + if (PyLong_Check(o)) + *line_num = PyLong_AS_LONG(o); else { PyErr_Format(parser_error, "third item in terminal node must be an" @@ -774,7 +774,7 @@ build_node_tree(PyObject *tuple) long num = -1; if (temp != NULL) - num = PyInt_AsLong(temp); + num = PyLong_AsLong(temp); Py_XDECREF(temp); if (ISTERMINAL(num)) { /* diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c index f183d86..c36b712 100644 --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -1281,7 +1281,7 @@ fill_time(PyObject *v, int index, time_t sec, unsigned long nsec) #if SIZEOF_TIME_T > SIZEOF_LONG ival = PyLong_FromLongLong((PY_LONG_LONG)sec); #else - ival = PyInt_FromLong((long)sec); + ival = PyLong_FromLong((long)sec); #endif if (!ival) return; @@ -1305,27 +1305,27 @@ _pystat_fromstructstat(STRUCT_STAT *st) if (v == NULL) return NULL; - PyStructSequence_SET_ITEM(v, 0, PyInt_FromLong((long)st->st_mode)); + PyStructSequence_SET_ITEM(v, 0, PyLong_FromLong((long)st->st_mode)); #ifdef HAVE_LARGEFILE_SUPPORT PyStructSequence_SET_ITEM(v, 1, PyLong_FromLongLong((PY_LONG_LONG)st->st_ino)); #else - PyStructSequence_SET_ITEM(v, 1, PyInt_FromLong((long)st->st_ino)); + PyStructSequence_SET_ITEM(v, 1, PyLong_FromLong((long)st->st_ino)); #endif #if defined(HAVE_LONG_LONG) && !defined(MS_WINDOWS) PyStructSequence_SET_ITEM(v, 2, PyLong_FromLongLong((PY_LONG_LONG)st->st_dev)); #else - PyStructSequence_SET_ITEM(v, 2, PyInt_FromLong((long)st->st_dev)); + PyStructSequence_SET_ITEM(v, 2, PyLong_FromLong((long)st->st_dev)); #endif - PyStructSequence_SET_ITEM(v, 3, PyInt_FromLong((long)st->st_nlink)); - PyStructSequence_SET_ITEM(v, 4, PyInt_FromLong((long)st->st_uid)); - PyStructSequence_SET_ITEM(v, 5, PyInt_FromLong((long)st->st_gid)); + PyStructSequence_SET_ITEM(v, 3, PyLong_FromLong((long)st->st_nlink)); + PyStructSequence_SET_ITEM(v, 4, PyLong_FromLong((long)st->st_uid)); + PyStructSequence_SET_ITEM(v, 5, PyLong_FromLong((long)st->st_gid)); #ifdef HAVE_LARGEFILE_SUPPORT PyStructSequence_SET_ITEM(v, 6, PyLong_FromLongLong((PY_LONG_LONG)st->st_size)); #else - PyStructSequence_SET_ITEM(v, 6, PyInt_FromLong(st->st_size)); + PyStructSequence_SET_ITEM(v, 6, PyLong_FromLong(st->st_size)); #endif #if defined(HAVE_STAT_TV_NSEC) @@ -1349,19 +1349,19 @@ _pystat_fromstructstat(STRUCT_STAT *st) #ifdef HAVE_STRUCT_STAT_ST_BLKSIZE PyStructSequence_SET_ITEM(v, ST_BLKSIZE_IDX, - PyInt_FromLong((long)st->st_blksize)); + PyLong_FromLong((long)st->st_blksize)); #endif #ifdef HAVE_STRUCT_STAT_ST_BLOCKS PyStructSequence_SET_ITEM(v, ST_BLOCKS_IDX, - PyInt_FromLong((long)st->st_blocks)); + PyLong_FromLong((long)st->st_blocks)); #endif #ifdef HAVE_STRUCT_STAT_ST_RDEV PyStructSequence_SET_ITEM(v, ST_RDEV_IDX, - PyInt_FromLong((long)st->st_rdev)); + PyLong_FromLong((long)st->st_rdev)); #endif #ifdef HAVE_STRUCT_STAT_ST_GEN PyStructSequence_SET_ITEM(v, ST_GEN_IDX, - PyInt_FromLong((long)st->st_gen)); + PyLong_FromLong((long)st->st_gen)); #endif #ifdef HAVE_STRUCT_STAT_ST_BIRTHTIME { @@ -1376,7 +1376,7 @@ _pystat_fromstructstat(STRUCT_STAT *st) if (_stat_float_times) { val = PyFloat_FromDouble(bsec + 1e-9*bnsec); } else { - val = PyInt_FromLong((long)bsec); + val = PyLong_FromLong((long)bsec); } PyStructSequence_SET_ITEM(v, ST_BIRTHTIME_IDX, val); @@ -1384,7 +1384,7 @@ _pystat_fromstructstat(STRUCT_STAT *st) #endif #ifdef HAVE_STRUCT_STAT_ST_FLAGS PyStructSequence_SET_ITEM(v, ST_FLAGS_IDX, - PyInt_FromLong((long)st->st_flags)); + PyLong_FromLong((long)st->st_flags)); #endif if (PyErr_Occurred()) { @@ -2528,7 +2528,7 @@ posix_nice(PyObject *self, PyObject *args) if (value == -1 && errno != 0) /* either nice() or getpriority() returned an error */ return posix_error(); - return PyInt_FromLong((long) value); + return PyLong_FromLong((long) value); } #endif /* HAVE_NICE */ @@ -2631,7 +2631,7 @@ posix_system(PyObject *self, PyObject *args) sts = system(command); #endif Py_END_ALLOW_THREADS - return PyInt_FromLong(sts); + return PyLong_FromLong(sts); } #endif @@ -2649,7 +2649,7 @@ posix_umask(PyObject *self, PyObject *args) i = (int)umask(i); if (i < 0) return posix_error(); - return PyInt_FromLong((long)i); + return PyLong_FromLong((long)i); } @@ -2706,7 +2706,7 @@ extract_time(PyObject *t, long* sec, long* usec) PyObject *intobj = Py_Type(t)->tp_as_number->nb_int(t); if (!intobj) return -1; - intval = PyInt_AsLong(intobj); + intval = PyLong_AsLong(intobj); Py_DECREF(intobj); if (intval == -1 && PyErr_Occurred()) return -1; @@ -2718,7 +2718,7 @@ extract_time(PyObject *t, long* sec, long* usec) *usec = 0; return 0; } - intval = PyInt_AsLong(t); + intval = PyLong_AsLong(t); if (intval == -1 && PyErr_Occurred()) return -1; *sec = intval; @@ -3617,7 +3617,7 @@ posix_fork1(PyObject *self, PyObject *noargs) if (pid == -1) return posix_error(); PyOS_AfterFork(); - return PyInt_FromLong((long)pid); + return PyLong_FromLong((long)pid); } #endif @@ -3636,7 +3636,7 @@ posix_fork(PyObject *self, PyObject *noargs) return posix_error(); if (pid == 0) PyOS_AfterFork(); - return PyInt_FromLong((long)pid); + return PyLong_FromLong((long)pid); } #endif @@ -3757,7 +3757,7 @@ Return the current process's effective group id."); static PyObject * posix_getegid(PyObject *self, PyObject *noargs) { - return PyInt_FromLong((long)getegid()); + return PyLong_FromLong((long)getegid()); } #endif @@ -3770,7 +3770,7 @@ Return the current process's effective user id."); static PyObject * posix_geteuid(PyObject *self, PyObject *noargs) { - return PyInt_FromLong((long)geteuid()); + return PyLong_FromLong((long)geteuid()); } #endif @@ -3783,7 +3783,7 @@ Return the current process's group id."); static PyObject * posix_getgid(PyObject *self, PyObject *noargs) { - return PyInt_FromLong((long)getgid()); + return PyLong_FromLong((long)getgid()); } #endif @@ -3795,7 +3795,7 @@ Return the current process id"); static PyObject * posix_getpid(PyObject *self, PyObject *noargs) { - return PyInt_FromLong((long)getpid()); + return PyLong_FromLong((long)getpid()); } @@ -3826,7 +3826,7 @@ posix_getgroups(PyObject *self, PyObject *noargs) if (result != NULL) { int i; for (i = 0; i < n; ++i) { - PyObject *o = PyInt_FromLong((long)grouplist[i]); + PyObject *o = PyLong_FromLong((long)grouplist[i]); if (o == NULL) { Py_DECREF(result); result = NULL; @@ -3855,7 +3855,7 @@ posix_getpgid(PyObject *self, PyObject *args) pgid = getpgid(pid); if (pgid < 0) return posix_error(); - return PyInt_FromLong((long)pgid); + return PyLong_FromLong((long)pgid); } #endif /* HAVE_GETPGID */ @@ -3869,9 +3869,9 @@ static PyObject * posix_getpgrp(PyObject *self, PyObject *noargs) { #ifdef GETPGRP_HAVE_ARG - return PyInt_FromLong((long)getpgrp(0)); + return PyLong_FromLong((long)getpgrp(0)); #else /* GETPGRP_HAVE_ARG */ - return PyInt_FromLong((long)getpgrp()); + return PyLong_FromLong((long)getpgrp()); #endif /* GETPGRP_HAVE_ARG */ } #endif /* HAVE_GETPGRP */ @@ -3905,7 +3905,7 @@ Return the parent's process id."); static PyObject * posix_getppid(PyObject *self, PyObject *noargs) { - return PyInt_FromLong((long)getppid()); + return PyLong_FromLong((long)getppid()); } #endif @@ -3947,7 +3947,7 @@ Return the current process's user id."); static PyObject * posix_getuid(PyObject *self, PyObject *noargs) { - return PyInt_FromLong((long)getuid()); + return PyLong_FromLong((long)getuid()); } #endif @@ -4237,7 +4237,7 @@ wait_helper(int pid, int status, struct rusage *ru) PyStructSequence_SET_ITEM(result, 1, PyFloat_FromDouble(doubletime(ru->ru_stime))); #define SET_INT(result, index, value)\ - PyStructSequence_SET_ITEM(result, index, PyInt_FromLong(value)) + PyStructSequence_SET_ITEM(result, index, PyLong_FromLong(value)) SET_INT(result, 2, ru->ru_maxrss); SET_INT(result, 3, ru->ru_ixrss); SET_INT(result, 4, ru->ru_idrss); @@ -4569,7 +4569,7 @@ posix_getsid(PyObject *self, PyObject *args) sid = getsid(pid); if (sid < 0) return posix_error(); - return PyInt_FromLong((long)sid); + return PyLong_FromLong((long)sid); } #endif /* HAVE_GETSID */ @@ -4622,7 +4622,7 @@ posix_tcgetpgrp(PyObject *self, PyObject *args) pgid = tcgetpgrp(fd); if (pgid < 0) return posix_error(); - return PyInt_FromLong((long)pgid); + return PyLong_FromLong((long)pgid); } #endif /* HAVE_TCGETPGRP */ @@ -4670,7 +4670,7 @@ posix_open(PyObject *self, PyObject *args) Py_END_ALLOW_THREADS if (fd < 0) return posix_error(); - return PyInt_FromLong((long)fd); + return PyLong_FromLong((long)fd); } /* Drop the argument parsing error as narrow strings are also valid. */ @@ -4689,7 +4689,7 @@ posix_open(PyObject *self, PyObject *args) if (fd < 0) return posix_error_with_allocated_filename(file); PyMem_Free(file); - return PyInt_FromLong((long)fd); + return PyLong_FromLong((long)fd); } @@ -4728,7 +4728,7 @@ posix_dup(PyObject *self, PyObject *args) Py_END_ALLOW_THREADS if (fd < 0) return posix_error(); - return PyInt_FromLong((long)fd); + return PyLong_FromLong((long)fd); } @@ -4778,10 +4778,10 @@ posix_lseek(PyObject *self, PyObject *args) #endif /* SEEK_END */ #if !defined(HAVE_LARGEFILE_SUPPORT) - pos = PyInt_AsLong(posobj); + pos = PyLong_AsLong(posobj); #else pos = PyLong_Check(posobj) ? - PyLong_AsLongLong(posobj) : PyInt_AsLong(posobj); + PyLong_AsLongLong(posobj) : PyLong_AsLong(posobj); #endif if (PyErr_Occurred()) return NULL; @@ -4797,7 +4797,7 @@ posix_lseek(PyObject *self, PyObject *args) return posix_error(); #if !defined(HAVE_LARGEFILE_SUPPORT) - return PyInt_FromLong(res); + return PyLong_FromLong(res); #else return PyLong_FromLongLong(res); #endif @@ -4854,7 +4854,7 @@ posix_write(PyObject *self, PyObject *args) Py_END_ALLOW_THREADS if (size < 0) return posix_error(); - return PyInt_FromSsize_t(size); + return PyLong_FromSsize_t(size); } @@ -5014,7 +5014,7 @@ posix_major(PyObject *self, PyObject *args) int device; if (!PyArg_ParseTuple(args, "i:major", &device)) return NULL; - return PyInt_FromLong((long)major(device)); + return PyLong_FromLong((long)major(device)); } PyDoc_STRVAR(posix_minor__doc__, @@ -5027,7 +5027,7 @@ posix_minor(PyObject *self, PyObject *args) int device; if (!PyArg_ParseTuple(args, "i:minor", &device)) return NULL; - return PyInt_FromLong((long)minor(device)); + return PyLong_FromLong((long)minor(device)); } PyDoc_STRVAR(posix_makedev__doc__, @@ -5040,7 +5040,7 @@ posix_makedev(PyObject *self, PyObject *args) int major, minor; if (!PyArg_ParseTuple(args, "ii:makedev", &major, &minor)) return NULL; - return PyInt_FromLong((long)makedev(major, minor)); + return PyLong_FromLong((long)makedev(major, minor)); } #endif /* device macros */ @@ -5062,10 +5062,10 @@ posix_ftruncate(PyObject *self, PyObject *args) return NULL; #if !defined(HAVE_LARGEFILE_SUPPORT) - length = PyInt_AsLong(lenobj); + length = PyLong_AsLong(lenobj); #else length = PyLong_Check(lenobj) ? - PyLong_AsLongLong(lenobj) : PyInt_AsLong(lenobj); + PyLong_AsLongLong(lenobj) : PyLong_AsLong(lenobj); #endif if (PyErr_Occurred()) return NULL; @@ -5401,19 +5401,19 @@ _pystatvfs_fromstructstatvfs(struct statvfs st) { return NULL; #if !defined(HAVE_LARGEFILE_SUPPORT) - PyStructSequence_SET_ITEM(v, 0, PyInt_FromLong((long) st.f_bsize)); - PyStructSequence_SET_ITEM(v, 1, PyInt_FromLong((long) st.f_frsize)); - PyStructSequence_SET_ITEM(v, 2, PyInt_FromLong((long) st.f_blocks)); - PyStructSequence_SET_ITEM(v, 3, PyInt_FromLong((long) st.f_bfree)); - PyStructSequence_SET_ITEM(v, 4, PyInt_FromLong((long) st.f_bavail)); - PyStructSequence_SET_ITEM(v, 5, PyInt_FromLong((long) st.f_files)); - PyStructSequence_SET_ITEM(v, 6, PyInt_FromLong((long) st.f_ffree)); - PyStructSequence_SET_ITEM(v, 7, PyInt_FromLong((long) st.f_favail)); - PyStructSequence_SET_ITEM(v, 8, PyInt_FromLong((long) st.f_flag)); - PyStructSequence_SET_ITEM(v, 9, PyInt_FromLong((long) st.f_namemax)); + PyStructSequence_SET_ITEM(v, 0, PyLong_FromLong((long) st.f_bsize)); + PyStructSequence_SET_ITEM(v, 1, PyLong_FromLong((long) st.f_frsize)); + PyStructSequence_SET_ITEM(v, 2, PyLong_FromLong((long) st.f_blocks)); + PyStructSequence_SET_ITEM(v, 3, PyLong_FromLong((long) st.f_bfree)); + PyStructSequence_SET_ITEM(v, 4, PyLong_FromLong((long) st.f_bavail)); + PyStructSequence_SET_ITEM(v, 5, PyLong_FromLong((long) st.f_files)); + PyStructSequence_SET_ITEM(v, 6, PyLong_FromLong((long) st.f_ffree)); + PyStructSequence_SET_ITEM(v, 7, PyLong_FromLong((long) st.f_favail)); + PyStructSequence_SET_ITEM(v, 8, PyLong_FromLong((long) st.f_flag)); + PyStructSequence_SET_ITEM(v, 9, PyLong_FromLong((long) st.f_namemax)); #else - PyStructSequence_SET_ITEM(v, 0, PyInt_FromLong((long) st.f_bsize)); - PyStructSequence_SET_ITEM(v, 1, PyInt_FromLong((long) st.f_frsize)); + PyStructSequence_SET_ITEM(v, 0, PyLong_FromLong((long) st.f_bsize)); + PyStructSequence_SET_ITEM(v, 1, PyLong_FromLong((long) st.f_frsize)); PyStructSequence_SET_ITEM(v, 2, PyLong_FromLongLong((PY_LONG_LONG) st.f_blocks)); PyStructSequence_SET_ITEM(v, 3, @@ -5426,8 +5426,8 @@ _pystatvfs_fromstructstatvfs(struct statvfs st) { PyLong_FromLongLong((PY_LONG_LONG) st.f_ffree)); PyStructSequence_SET_ITEM(v, 7, PyLong_FromLongLong((PY_LONG_LONG) st.f_favail)); - PyStructSequence_SET_ITEM(v, 8, PyInt_FromLong((long) st.f_flag)); - PyStructSequence_SET_ITEM(v, 9, PyInt_FromLong((long) st.f_namemax)); + PyStructSequence_SET_ITEM(v, 8, PyLong_FromLong((long) st.f_flag)); + PyStructSequence_SET_ITEM(v, 9, PyLong_FromLong((long) st.f_namemax)); #endif return v; @@ -5501,8 +5501,8 @@ static int conv_confname(PyObject *arg, int *valuep, struct constdef *table, size_t tablesize) { - if (PyInt_Check(arg)) { - *valuep = PyInt_AS_LONG(arg); + if (PyLong_Check(arg)) { + *valuep = PyLong_AS_LONG(arg); return 1; } else { @@ -5625,7 +5625,7 @@ posix_fpathconf(PyObject *self, PyObject *args) if (limit == -1 && errno != 0) posix_error(); else - result = PyInt_FromLong(limit); + result = PyLong_FromLong(limit); } return result; } @@ -5659,7 +5659,7 @@ posix_pathconf(PyObject *self, PyObject *args) posix_error_with_filename(path); } else - result = PyInt_FromLong(limit); + result = PyLong_FromLong(limit); } return result; } @@ -6383,7 +6383,7 @@ posix_sysconf(PyObject *self, PyObject *args) if (value == -1 && errno != 0) posix_error(); else - result = PyInt_FromLong(value); + result = PyLong_FromLong(value); } return result; } @@ -6424,7 +6424,7 @@ setup_confname_table(struct constdef *table, size_t tablesize, return -1; for (i=0; i < tablesize; ++i) { - PyObject *o = PyInt_FromLong(table[i].value); + PyObject *o = PyLong_FromLong(table[i].value); if (o == NULL || PyDict_SetItemString(d, table[i].name, o) == -1) { Py_XDECREF(o); Py_DECREF(d); diff --git a/Modules/pwdmodule.c b/Modules/pwdmodule.c index 57f69e7..9511736 100644 --- a/Modules/pwdmodule.c +++ b/Modules/pwdmodule.c @@ -67,7 +67,7 @@ mkpwent(struct passwd *p) if (v == NULL) return NULL; -#define SETI(i,val) PyStructSequence_SET_ITEM(v, i, PyInt_FromLong((long) val)) +#define SETI(i,val) PyStructSequence_SET_ITEM(v, i, PyLong_FromLong((long) val)) #define SETS(i,val) sets(v, i, val) SETS(setIndex++, p->pw_name); diff --git a/Modules/pyexpat.c b/Modules/pyexpat.c index 738bfd2..5da00a2 100644 --- a/Modules/pyexpat.c +++ b/Modules/pyexpat.c @@ -83,7 +83,7 @@ static struct HandlerInfo handler_info[64]; static int set_error_attr(PyObject *err, char *name, int value) { - PyObject *v = PyInt_FromLong(value); + PyObject *v = PyLong_FromLong(value); if (v == NULL || PyObject_SetAttrString(err, name, v) == -1) { Py_XDECREF(v); @@ -583,7 +583,7 @@ my_##NAME##Handler PARAMS {\ #define INT_HANDLER(NAME, PARAMS, PARAM_FORMAT)\ RC_HANDLER(int, NAME, PARAMS, int rc=0;, PARAM_FORMAT, \ - rc = PyInt_AsLong(rv);, rc, \ + rc = PyLong_AsLong(rv);, rc, \ (xmlparseobject *)userData) VOID_HANDLER(EndElement, @@ -784,7 +784,7 @@ RC_HANDLER(int, ExternalEntityRef, ("(O&NNN)", conv_string_to_unicode ,context, string_intern(self, base), string_intern(self, systemId), string_intern(self, publicId)), - rc = PyInt_AsLong(rv);, rc, + rc = PyLong_AsLong(rv);, rc, XML_GetUserData(parser)) /* XXX UnknownEncodingHandler */ @@ -813,7 +813,7 @@ get_parse_result(xmlparseobject *self, int rv) if (flush_character_buffer(self) < 0) { return NULL; } - return PyInt_FromLong(rv); + return PyLong_FromLong(rv); } PyDoc_STRVAR(xmlparse_Parse__doc__, @@ -846,7 +846,7 @@ readinst(char *buf, int buf_size, PyObject *meth) int len = -1; char *ptr; - if ((bytes = PyInt_FromLong(buf_size)) == NULL) + if ((bytes = PyLong_FromLong(buf_size)) == NULL) goto finally; if ((arg = PyTuple_New(1)) == NULL) { @@ -1103,7 +1103,7 @@ xmlparse_SetParamEntityParsing(xmlparseobject *p, PyObject* args) if (!PyArg_ParseTuple(args, "i", &flag)) return NULL; flag = XML_SetParamEntityParsing(p->itself, flag); - return PyInt_FromLong(flag); + return PyLong_FromLong(flag); } @@ -1342,36 +1342,36 @@ xmlparse_getattr(xmlparseobject *self, char *name) } if (name[0] == 'E') { if (strcmp(name, "ErrorCode") == 0) - return PyInt_FromLong((long) + return PyLong_FromLong((long) XML_GetErrorCode(self->itself)); if (strcmp(name, "ErrorLineNumber") == 0) - return PyInt_FromLong((long) + return PyLong_FromLong((long) XML_GetErrorLineNumber(self->itself)); if (strcmp(name, "ErrorColumnNumber") == 0) - return PyInt_FromLong((long) + return PyLong_FromLong((long) XML_GetErrorColumnNumber(self->itself)); if (strcmp(name, "ErrorByteIndex") == 0) - return PyInt_FromLong((long) + return PyLong_FromLong((long) XML_GetErrorByteIndex(self->itself)); } if (name[0] == 'C') { if (strcmp(name, "CurrentLineNumber") == 0) - return PyInt_FromLong((long) + return PyLong_FromLong((long) XML_GetCurrentLineNumber(self->itself)); if (strcmp(name, "CurrentColumnNumber") == 0) - return PyInt_FromLong((long) + return PyLong_FromLong((long) XML_GetCurrentColumnNumber(self->itself)); if (strcmp(name, "CurrentByteIndex") == 0) - return PyInt_FromLong((long) + return PyLong_FromLong((long) XML_GetCurrentByteIndex(self->itself)); } if (name[0] == 'b') { if (strcmp(name, "buffer_size") == 0) - return PyInt_FromLong((long) self->buffer_size); + return PyLong_FromLong((long) self->buffer_size); if (strcmp(name, "buffer_text") == 0) return get_pybool(self->buffer != NULL); if (strcmp(name, "buffer_used") == 0) - return PyInt_FromLong((long) self->buffer_used); + return PyLong_FromLong((long) self->buffer_used); } if (strcmp(name, "namespace_prefixes") == 0) return get_pybool(self->ns_prefixes); diff --git a/Modules/readline.c b/Modules/readline.c index c915327..d42998e 100644 --- a/Modules/readline.c +++ b/Modules/readline.c @@ -154,7 +154,7 @@ history truncation."); static PyObject* get_history_length(PyObject *self, PyObject *noarg) { - return PyInt_FromLong(_history_length); + return PyLong_FromLong(_history_length); } PyDoc_STRVAR(get_history_length_doc, @@ -271,7 +271,7 @@ static PyObject *endidx = NULL; static PyObject * get_completion_type(PyObject *self, PyObject *noarg) { - return PyInt_FromLong(rl_completion_type); + return PyLong_FromLong(rl_completion_type); } PyDoc_STRVAR(doc_get_completion_type, @@ -490,7 +490,7 @@ get_current_history_length(PyObject *self, PyObject *noarg) HISTORY_STATE *hist_st; hist_st = history_get_history_state(); - return PyInt_FromLong(hist_st ? (long) hist_st->length : (long) 0); + return PyLong_FromLong(hist_st ? (long) hist_st->length : (long) 0); } PyDoc_STRVAR(doc_get_current_history_length, @@ -628,7 +628,7 @@ on_hook(PyObject *func) if (r == Py_None) result = 0; else { - result = PyInt_AsLong(r); + result = PyLong_AsLong(r); if (result == -1 && PyErr_Occurred()) goto error; } @@ -688,7 +688,7 @@ on_completion_display_matches_hook(char **matches, Py_DECREF(m), m=NULL; if (r == NULL || - (r != Py_None && PyInt_AsLong(r) == -1 && PyErr_Occurred())) { + (r != Py_None && PyLong_AsLong(r) == -1 && PyErr_Occurred())) { goto error; } Py_XDECREF(r), r=NULL; @@ -752,8 +752,8 @@ flex_complete(char *text, int start, int end) { Py_XDECREF(begidx); Py_XDECREF(endidx); - begidx = PyInt_FromLong((long) start); - endidx = PyInt_FromLong((long) end); + begidx = PyLong_FromLong((long) start); + endidx = PyLong_FromLong((long) end); return completion_matches(text, *on_completion); } @@ -796,8 +796,8 @@ setup_readline(void) rl_completion_append_character ='\0'; #endif - begidx = PyInt_FromLong(0L); - endidx = PyInt_FromLong(0L); + begidx = PyLong_FromLong(0L); + endidx = PyLong_FromLong(0L); /* Initialize (allows .inputrc to override) * * XXX: A bug in the readline-2.2 library causes a memory leak diff --git a/Modules/resource.c b/Modules/resource.c index d38c660..d67fe99 100644 --- a/Modules/resource.c +++ b/Modules/resource.c @@ -86,20 +86,20 @@ resource_getrusage(PyObject *self, PyObject *args) PyFloat_FromDouble(doubletime(ru.ru_utime))); PyStructSequence_SET_ITEM(result, 1, PyFloat_FromDouble(doubletime(ru.ru_stime))); - PyStructSequence_SET_ITEM(result, 2, PyInt_FromLong(ru.ru_maxrss)); - PyStructSequence_SET_ITEM(result, 3, PyInt_FromLong(ru.ru_ixrss)); - PyStructSequence_SET_ITEM(result, 4, PyInt_FromLong(ru.ru_idrss)); - PyStructSequence_SET_ITEM(result, 5, PyInt_FromLong(ru.ru_isrss)); - PyStructSequence_SET_ITEM(result, 6, PyInt_FromLong(ru.ru_minflt)); - PyStructSequence_SET_ITEM(result, 7, PyInt_FromLong(ru.ru_majflt)); - PyStructSequence_SET_ITEM(result, 8, PyInt_FromLong(ru.ru_nswap)); - PyStructSequence_SET_ITEM(result, 9, PyInt_FromLong(ru.ru_inblock)); - PyStructSequence_SET_ITEM(result, 10, PyInt_FromLong(ru.ru_oublock)); - PyStructSequence_SET_ITEM(result, 11, PyInt_FromLong(ru.ru_msgsnd)); - PyStructSequence_SET_ITEM(result, 12, PyInt_FromLong(ru.ru_msgrcv)); - PyStructSequence_SET_ITEM(result, 13, PyInt_FromLong(ru.ru_nsignals)); - PyStructSequence_SET_ITEM(result, 14, PyInt_FromLong(ru.ru_nvcsw)); - PyStructSequence_SET_ITEM(result, 15, PyInt_FromLong(ru.ru_nivcsw)); + PyStructSequence_SET_ITEM(result, 2, PyLong_FromLong(ru.ru_maxrss)); + PyStructSequence_SET_ITEM(result, 3, PyLong_FromLong(ru.ru_ixrss)); + PyStructSequence_SET_ITEM(result, 4, PyLong_FromLong(ru.ru_idrss)); + PyStructSequence_SET_ITEM(result, 5, PyLong_FromLong(ru.ru_isrss)); + PyStructSequence_SET_ITEM(result, 6, PyLong_FromLong(ru.ru_minflt)); + PyStructSequence_SET_ITEM(result, 7, PyLong_FromLong(ru.ru_majflt)); + PyStructSequence_SET_ITEM(result, 8, PyLong_FromLong(ru.ru_nswap)); + PyStructSequence_SET_ITEM(result, 9, PyLong_FromLong(ru.ru_inblock)); + PyStructSequence_SET_ITEM(result, 10, PyLong_FromLong(ru.ru_oublock)); + PyStructSequence_SET_ITEM(result, 11, PyLong_FromLong(ru.ru_msgsnd)); + PyStructSequence_SET_ITEM(result, 12, PyLong_FromLong(ru.ru_msgrcv)); + PyStructSequence_SET_ITEM(result, 13, PyLong_FromLong(ru.ru_nsignals)); + PyStructSequence_SET_ITEM(result, 14, PyLong_FromLong(ru.ru_nvcsw)); + PyStructSequence_SET_ITEM(result, 15, PyLong_FromLong(ru.ru_nivcsw)); if (PyErr_Occurred()) { Py_DECREF(result); @@ -158,20 +158,20 @@ resource_setrlimit(PyObject *self, PyObject *args) } #if !defined(HAVE_LARGEFILE_SUPPORT) - rl.rlim_cur = PyInt_AsLong(curobj); + rl.rlim_cur = PyLong_AsLong(curobj); if (rl.rlim_cur == -1 && PyErr_Occurred()) return NULL; - rl.rlim_max = PyInt_AsLong(maxobj); + rl.rlim_max = PyLong_AsLong(maxobj); if (rl.rlim_max == -1 && PyErr_Occurred()) return NULL; #else /* The limits are probably bigger than a long */ rl.rlim_cur = PyLong_Check(curobj) ? - PyLong_AsLongLong(curobj) : PyInt_AsLong(curobj); + PyLong_AsLongLong(curobj) : PyLong_AsLong(curobj); if (rl.rlim_cur == -1 && PyErr_Occurred()) return NULL; rl.rlim_max = PyLong_Check(maxobj) ? - PyLong_AsLongLong(maxobj) : PyInt_AsLong(maxobj); + PyLong_AsLongLong(maxobj) : PyLong_AsLong(maxobj); if (rl.rlim_max == -1 && PyErr_Occurred()) return NULL; #endif @@ -320,7 +320,7 @@ initresource(void) } else #endif { - v = PyInt_FromLong((long) RLIM_INFINITY); + v = PyLong_FromLong((long) RLIM_INFINITY); } if (v) { PyModule_AddObject(m, "RLIM_INFINITY", v); diff --git a/Modules/selectmodule.c b/Modules/selectmodule.c index 8bb2df8..4925b9d 100644 --- a/Modules/selectmodule.c +++ b/Modules/selectmodule.c @@ -355,8 +355,8 @@ update_ufd_array(pollObject *self) i = pos = 0; while (PyDict_Next(self->dict, &pos, &key, &value)) { - self->ufds[i].fd = PyInt_AsLong(key); - self->ufds[i].events = (short)PyInt_AsLong(value); + self->ufds[i].fd = PyLong_AsLong(key); + self->ufds[i].events = (short)PyLong_AsLong(value); i++; } self->ufd_uptodate = 1; @@ -386,10 +386,10 @@ poll_register(pollObject *self, PyObject *args) /* Add entry to the internal dictionary: the key is the file descriptor, and the value is the event mask. */ - key = PyInt_FromLong(fd); + key = PyLong_FromLong(fd); if (key == NULL) return NULL; - value = PyInt_FromLong(events); + value = PyLong_FromLong(events); if (value == NULL) { Py_DECREF(key); return NULL; @@ -421,7 +421,7 @@ poll_unregister(pollObject *self, PyObject *o) return NULL; /* Check whether the fd is already in the array */ - key = PyInt_FromLong(fd); + key = PyLong_FromLong(fd); if (key == NULL) return NULL; @@ -467,7 +467,7 @@ poll_poll(pollObject *self, PyObject *args) tout = PyNumber_Int(tout); if (!tout) return NULL; - timeout = PyInt_AsLong(tout); + timeout = PyLong_AsLong(tout); Py_DECREF(tout); if (timeout == -1 && PyErr_Occurred()) return NULL; @@ -505,7 +505,7 @@ poll_poll(pollObject *self, PyObject *args) value = PyTuple_New(2); if (value == NULL) goto error; - num = PyInt_FromLong(self->ufds[i].fd); + num = PyLong_FromLong(self->ufds[i].fd); if (num == NULL) { Py_DECREF(value); goto error; @@ -516,7 +516,7 @@ poll_poll(pollObject *self, PyObject *args) is a 16-bit short, and IBM assigned POLLNVAL to be 0x8000, so the conversion to int results in a negative number. See SF bug #923315. */ - num = PyInt_FromLong(self->ufds[i].revents & 0xffff); + num = PyLong_FromLong(self->ufds[i].revents & 0xffff); if (num == NULL) { Py_DECREF(value); goto error; diff --git a/Modules/sha1module.c b/Modules/sha1module.c index 6ba03ad..aeba185 100644 --- a/Modules/sha1module.c +++ b/Modules/sha1module.c @@ -410,7 +410,7 @@ static PyMethodDef SHA1_methods[] = { static PyObject * SHA1_get_block_size(PyObject *self, void *closure) { - return PyInt_FromLong(SHA1_BLOCKSIZE); + return PyLong_FromLong(SHA1_BLOCKSIZE); } static PyObject * @@ -422,7 +422,7 @@ SHA1_get_name(PyObject *self, void *closure) static PyObject * sha1_get_digest_size(PyObject *self, void *closure) { - return PyInt_FromLong(SHA1_DIGESTSIZE); + return PyLong_FromLong(SHA1_DIGESTSIZE); } diff --git a/Modules/sha256module.c b/Modules/sha256module.c index a5dc9ad..928d1d4 100644 --- a/Modules/sha256module.c +++ b/Modules/sha256module.c @@ -503,7 +503,7 @@ static PyMethodDef SHA_methods[] = { static PyObject * SHA256_get_block_size(PyObject *self, void *closure) { - return PyInt_FromLong(SHA_BLOCKSIZE); + return PyLong_FromLong(SHA_BLOCKSIZE); } static PyObject * diff --git a/Modules/sha512module.c b/Modules/sha512module.c index c330e1b..761d44a 100644 --- a/Modules/sha512module.c +++ b/Modules/sha512module.c @@ -569,7 +569,7 @@ static PyMethodDef SHA_methods[] = { static PyObject * SHA512_get_block_size(PyObject *self, void *closure) { - return PyInt_FromLong(SHA_BLOCKSIZE); + return PyLong_FromLong(SHA_BLOCKSIZE); } static PyObject * diff --git a/Modules/signalmodule.c b/Modules/signalmodule.c index a729604..5f38b9b 100644 --- a/Modules/signalmodule.c +++ b/Modules/signalmodule.c @@ -149,7 +149,7 @@ signal_alarm(PyObject *self, PyObject *args) if (!PyArg_ParseTuple(args, "i:alarm", &t)) return NULL; /* alarm() returns the number of seconds remaining */ - return PyInt_FromLong((long)alarm(t)); + return PyLong_FromLong((long)alarm(t)); } PyDoc_STRVAR(alarm_doc, @@ -331,7 +331,7 @@ initsignal(void) if (!x || PyDict_SetItemString(d, "SIG_IGN", x) < 0) goto finally; - x = PyInt_FromLong((long)NSIG); + x = PyLong_FromLong((long)NSIG); if (!x || PyDict_SetItemString(d, "NSIG", x) < 0) goto finally; Py_DECREF(x); @@ -363,192 +363,192 @@ initsignal(void) } #ifdef SIGHUP - x = PyInt_FromLong(SIGHUP); + x = PyLong_FromLong(SIGHUP); PyDict_SetItemString(d, "SIGHUP", x); Py_XDECREF(x); #endif #ifdef SIGINT - x = PyInt_FromLong(SIGINT); + x = PyLong_FromLong(SIGINT); PyDict_SetItemString(d, "SIGINT", x); Py_XDECREF(x); #endif #ifdef SIGBREAK - x = PyInt_FromLong(SIGBREAK); + x = PyLong_FromLong(SIGBREAK); PyDict_SetItemString(d, "SIGBREAK", x); Py_XDECREF(x); #endif #ifdef SIGQUIT - x = PyInt_FromLong(SIGQUIT); + x = PyLong_FromLong(SIGQUIT); PyDict_SetItemString(d, "SIGQUIT", x); Py_XDECREF(x); #endif #ifdef SIGILL - x = PyInt_FromLong(SIGILL); + x = PyLong_FromLong(SIGILL); PyDict_SetItemString(d, "SIGILL", x); Py_XDECREF(x); #endif #ifdef SIGTRAP - x = PyInt_FromLong(SIGTRAP); + x = PyLong_FromLong(SIGTRAP); PyDict_SetItemString(d, "SIGTRAP", x); Py_XDECREF(x); #endif #ifdef SIGIOT - x = PyInt_FromLong(SIGIOT); + x = PyLong_FromLong(SIGIOT); PyDict_SetItemString(d, "SIGIOT", x); Py_XDECREF(x); #endif #ifdef SIGABRT - x = PyInt_FromLong(SIGABRT); + x = PyLong_FromLong(SIGABRT); PyDict_SetItemString(d, "SIGABRT", x); Py_XDECREF(x); #endif #ifdef SIGEMT - x = PyInt_FromLong(SIGEMT); + x = PyLong_FromLong(SIGEMT); PyDict_SetItemString(d, "SIGEMT", x); Py_XDECREF(x); #endif #ifdef SIGFPE - x = PyInt_FromLong(SIGFPE); + x = PyLong_FromLong(SIGFPE); PyDict_SetItemString(d, "SIGFPE", x); Py_XDECREF(x); #endif #ifdef SIGKILL - x = PyInt_FromLong(SIGKILL); + x = PyLong_FromLong(SIGKILL); PyDict_SetItemString(d, "SIGKILL", x); Py_XDECREF(x); #endif #ifdef SIGBUS - x = PyInt_FromLong(SIGBUS); + x = PyLong_FromLong(SIGBUS); PyDict_SetItemString(d, "SIGBUS", x); Py_XDECREF(x); #endif #ifdef SIGSEGV - x = PyInt_FromLong(SIGSEGV); + x = PyLong_FromLong(SIGSEGV); PyDict_SetItemString(d, "SIGSEGV", x); Py_XDECREF(x); #endif #ifdef SIGSYS - x = PyInt_FromLong(SIGSYS); + x = PyLong_FromLong(SIGSYS); PyDict_SetItemString(d, "SIGSYS", x); Py_XDECREF(x); #endif #ifdef SIGPIPE - x = PyInt_FromLong(SIGPIPE); + x = PyLong_FromLong(SIGPIPE); PyDict_SetItemString(d, "SIGPIPE", x); Py_XDECREF(x); #endif #ifdef SIGALRM - x = PyInt_FromLong(SIGALRM); + x = PyLong_FromLong(SIGALRM); PyDict_SetItemString(d, "SIGALRM", x); Py_XDECREF(x); #endif #ifdef SIGTERM - x = PyInt_FromLong(SIGTERM); + x = PyLong_FromLong(SIGTERM); PyDict_SetItemString(d, "SIGTERM", x); Py_XDECREF(x); #endif #ifdef SIGUSR1 - x = PyInt_FromLong(SIGUSR1); + x = PyLong_FromLong(SIGUSR1); PyDict_SetItemString(d, "SIGUSR1", x); Py_XDECREF(x); #endif #ifdef SIGUSR2 - x = PyInt_FromLong(SIGUSR2); + x = PyLong_FromLong(SIGUSR2); PyDict_SetItemString(d, "SIGUSR2", x); Py_XDECREF(x); #endif #ifdef SIGCLD - x = PyInt_FromLong(SIGCLD); + x = PyLong_FromLong(SIGCLD); PyDict_SetItemString(d, "SIGCLD", x); Py_XDECREF(x); #endif #ifdef SIGCHLD - x = PyInt_FromLong(SIGCHLD); + x = PyLong_FromLong(SIGCHLD); PyDict_SetItemString(d, "SIGCHLD", x); Py_XDECREF(x); #endif #ifdef SIGPWR - x = PyInt_FromLong(SIGPWR); + x = PyLong_FromLong(SIGPWR); PyDict_SetItemString(d, "SIGPWR", x); Py_XDECREF(x); #endif #ifdef SIGIO - x = PyInt_FromLong(SIGIO); + x = PyLong_FromLong(SIGIO); PyDict_SetItemString(d, "SIGIO", x); Py_XDECREF(x); #endif #ifdef SIGURG - x = PyInt_FromLong(SIGURG); + x = PyLong_FromLong(SIGURG); PyDict_SetItemString(d, "SIGURG", x); Py_XDECREF(x); #endif #ifdef SIGWINCH - x = PyInt_FromLong(SIGWINCH); + x = PyLong_FromLong(SIGWINCH); PyDict_SetItemString(d, "SIGWINCH", x); Py_XDECREF(x); #endif #ifdef SIGPOLL - x = PyInt_FromLong(SIGPOLL); + x = PyLong_FromLong(SIGPOLL); PyDict_SetItemString(d, "SIGPOLL", x); Py_XDECREF(x); #endif #ifdef SIGSTOP - x = PyInt_FromLong(SIGSTOP); + x = PyLong_FromLong(SIGSTOP); PyDict_SetItemString(d, "SIGSTOP", x); Py_XDECREF(x); #endif #ifdef SIGTSTP - x = PyInt_FromLong(SIGTSTP); + x = PyLong_FromLong(SIGTSTP); PyDict_SetItemString(d, "SIGTSTP", x); Py_XDECREF(x); #endif #ifdef SIGCONT - x = PyInt_FromLong(SIGCONT); + x = PyLong_FromLong(SIGCONT); PyDict_SetItemString(d, "SIGCONT", x); Py_XDECREF(x); #endif #ifdef SIGTTIN - x = PyInt_FromLong(SIGTTIN); + x = PyLong_FromLong(SIGTTIN); PyDict_SetItemString(d, "SIGTTIN", x); Py_XDECREF(x); #endif #ifdef SIGTTOU - x = PyInt_FromLong(SIGTTOU); + x = PyLong_FromLong(SIGTTOU); PyDict_SetItemString(d, "SIGTTOU", x); Py_XDECREF(x); #endif #ifdef SIGVTALRM - x = PyInt_FromLong(SIGVTALRM); + x = PyLong_FromLong(SIGVTALRM); PyDict_SetItemString(d, "SIGVTALRM", x); Py_XDECREF(x); #endif #ifdef SIGPROF - x = PyInt_FromLong(SIGPROF); + x = PyLong_FromLong(SIGPROF); PyDict_SetItemString(d, "SIGPROF", x); Py_XDECREF(x); #endif #ifdef SIGXCPU - x = PyInt_FromLong(SIGXCPU); + x = PyLong_FromLong(SIGXCPU); PyDict_SetItemString(d, "SIGXCPU", x); Py_XDECREF(x); #endif #ifdef SIGXFSZ - x = PyInt_FromLong(SIGXFSZ); + x = PyLong_FromLong(SIGXFSZ); PyDict_SetItemString(d, "SIGXFSZ", x); Py_XDECREF(x); #endif #ifdef SIGRTMIN - x = PyInt_FromLong(SIGRTMIN); + x = PyLong_FromLong(SIGRTMIN); PyDict_SetItemString(d, "SIGRTMIN", x); Py_XDECREF(x); #endif #ifdef SIGRTMAX - x = PyInt_FromLong(SIGRTMAX); + x = PyLong_FromLong(SIGRTMAX); PyDict_SetItemString(d, "SIGRTMAX", x); Py_XDECREF(x); #endif #ifdef SIGINFO - x = PyInt_FromLong(SIGINFO); + x = PyLong_FromLong(SIGINFO); PyDict_SetItemString(d, "SIGINFO", x); Py_XDECREF(x); #endif diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c index e4e30b8..926f059 100644 --- a/Modules/socketmodule.c +++ b/Modules/socketmodule.c @@ -1508,7 +1508,7 @@ sock_setblocking(PySocketSockObject *s, PyObject *arg) { int block; - block = PyInt_AsLong(arg); + block = PyLong_AsLong(arg); if (block == -1 && PyErr_Occurred()) return NULL; @@ -1649,7 +1649,7 @@ sock_getsockopt(PySocketSockObject *s, PyObject *args) (void *)&flag, &flagsize); if (res < 0) return s->errorhandler(); - return PyInt_FromLong(flag); + return PyLong_FromLong(flag); } #ifdef __VMS /* socklen_t is unsigned so no negative test is needed, @@ -1874,7 +1874,7 @@ sock_connect_ex(PySocketSockObject *s, PyObject *addro) return NULL; #endif - return PyInt_FromLong((long) res); + return PyLong_FromLong((long) res); } PyDoc_STRVAR(connect_ex_doc, @@ -1965,7 +1965,7 @@ sock_listen(PySocketSockObject *s, PyObject *arg) int backlog; int res; - backlog = PyInt_AsLong(arg); + backlog = PyLong_AsLong(arg); if (backlog == -1 && PyErr_Occurred()) return NULL; Py_BEGIN_ALLOW_THREADS @@ -2167,7 +2167,7 @@ sock_recv_into(PySocketSockObject *s, PyObject *args, PyObject *kwds) /* Return the number of bytes read. Note that we do not do anything special here in the case that readlen < recvlen. */ - return PyInt_FromSsize_t(readlen); + return PyLong_FromSsize_t(readlen); } PyDoc_STRVAR(recv_into_doc, @@ -2375,7 +2375,7 @@ sock_send(PySocketSockObject *s, PyObject *args) } if (n < 0) return s->errorhandler(); - return PyInt_FromLong((long)n); + return PyLong_FromLong((long)n); } PyDoc_STRVAR(send_doc, @@ -2474,7 +2474,7 @@ sock_sendto(PySocketSockObject *s, PyObject *args) } if (n < 0) return s->errorhandler(); - return PyInt_FromLong((long)n); + return PyLong_FromLong((long)n); } PyDoc_STRVAR(sendto_doc, @@ -2492,7 +2492,7 @@ sock_shutdown(PySocketSockObject *s, PyObject *arg) int how; int res; - how = PyInt_AsLong(arg); + how = PyLong_AsLong(arg); if (how == -1 && PyErr_Occurred()) return NULL; Py_BEGIN_ALLOW_THREADS @@ -3071,7 +3071,7 @@ socket_getservbyname(PyObject *self, PyObject *args) PyErr_SetString(socket_error, "service/proto not found"); return NULL; } - return PyInt_FromLong((long) ntohs(sp->s_port)); + return PyLong_FromLong((long) ntohs(sp->s_port)); } PyDoc_STRVAR(getservbyname_doc, @@ -3131,7 +3131,7 @@ socket_getprotobyname(PyObject *self, PyObject *args) PyErr_SetString(socket_error, "protocol not found"); return NULL; } - return PyInt_FromLong((long) sp->p_proto); + return PyLong_FromLong((long) sp->p_proto); } PyDoc_STRVAR(getprotobyname_doc, @@ -3242,7 +3242,7 @@ socket_ntohs(PyObject *self, PyObject *args) return NULL; } x2 = (unsigned int)ntohs((unsigned short)x1); - return PyInt_FromLong(x2); + return PyLong_FromLong(x2); } PyDoc_STRVAR(ntohs_doc, @@ -3301,7 +3301,7 @@ socket_htons(PyObject *self, PyObject *args) return NULL; } x2 = (unsigned int)htons((unsigned short)x1); - return PyInt_FromLong(x2); + return PyLong_FromLong(x2); } PyDoc_STRVAR(htons_doc, @@ -3596,7 +3596,7 @@ socket_getaddrinfo(PyObject *self, PyObject *args) return NULL; } if (PyInt_CheckExact(pobj)) { - PyOS_snprintf(pbuf, sizeof(pbuf), "%ld", PyInt_AsLong(pobj)); + PyOS_snprintf(pbuf, sizeof(pbuf), "%ld", PyLong_AsLong(pobj)); pptr = pbuf; } else if (PyUnicode_Check(pobj)) { pptr = PyUnicode_AsString(pobj); diff --git a/Modules/spwdmodule.c b/Modules/spwdmodule.c index 9dd17e4..08a3d1b 100644 --- a/Modules/spwdmodule.c +++ b/Modules/spwdmodule.c @@ -74,7 +74,7 @@ static PyObject *mkspent(struct spwd *p) if (v == NULL) return NULL; -#define SETI(i,val) PyStructSequence_SET_ITEM(v, i, PyInt_FromLong((long) val)) +#define SETI(i,val) PyStructSequence_SET_ITEM(v, i, PyLong_FromLong((long) val)) #define SETS(i,val) sets(v, i, val) SETS(setIndex++, p->sp_namp); diff --git a/Modules/syslogmodule.c b/Modules/syslogmodule.c index 355ac8f..112b749 100644 --- a/Modules/syslogmodule.c +++ b/Modules/syslogmodule.c @@ -123,7 +123,7 @@ syslog_setlogmask(PyObject *self, PyObject *args) if (!PyArg_ParseTuple(args, "l;mask for priority", &maskpri)) return NULL; omaskpri = setlogmask(maskpri); - return PyInt_FromLong(omaskpri); + return PyLong_FromLong(omaskpri); } static PyObject * @@ -134,7 +134,7 @@ syslog_log_mask(PyObject *self, PyObject *args) if (!PyArg_ParseTuple(args, "l:LOG_MASK", &pri)) return NULL; mask = LOG_MASK(pri); - return PyInt_FromLong(mask); + return PyLong_FromLong(mask); } static PyObject * @@ -145,7 +145,7 @@ syslog_log_upto(PyObject *self, PyObject *args) if (!PyArg_ParseTuple(args, "l:LOG_UPTO", &pri)) return NULL; mask = LOG_UPTO(pri); - return PyInt_FromLong(mask); + return PyLong_FromLong(mask); } /* List of functions defined in the module */ diff --git a/Modules/termios.c b/Modules/termios.c index c53566c..0707ad9 100644 --- a/Modules/termios.c +++ b/Modules/termios.c @@ -101,11 +101,11 @@ termios_tcgetattr(PyObject *self, PyObject *args) MIN and TIME slots are the same as the EOF and EOL slots. So we only do this in noncanonical input mode. */ if ((mode.c_lflag & ICANON) == 0) { - v = PyInt_FromLong((long)mode.c_cc[VMIN]); + v = PyLong_FromLong((long)mode.c_cc[VMIN]); if (v == NULL) goto err; PyList_SetItem(cc, VMIN, v); - v = PyInt_FromLong((long)mode.c_cc[VTIME]); + v = PyLong_FromLong((long)mode.c_cc[VTIME]); if (v == NULL) goto err; PyList_SetItem(cc, VTIME, v); @@ -114,12 +114,12 @@ termios_tcgetattr(PyObject *self, PyObject *args) if (!(v = PyList_New(7))) goto err; - PyList_SetItem(v, 0, PyInt_FromLong((long)mode.c_iflag)); - PyList_SetItem(v, 1, PyInt_FromLong((long)mode.c_oflag)); - PyList_SetItem(v, 2, PyInt_FromLong((long)mode.c_cflag)); - PyList_SetItem(v, 3, PyInt_FromLong((long)mode.c_lflag)); - PyList_SetItem(v, 4, PyInt_FromLong((long)ispeed)); - PyList_SetItem(v, 5, PyInt_FromLong((long)ospeed)); + PyList_SetItem(v, 0, PyLong_FromLong((long)mode.c_iflag)); + PyList_SetItem(v, 1, PyLong_FromLong((long)mode.c_oflag)); + PyList_SetItem(v, 2, PyLong_FromLong((long)mode.c_cflag)); + PyList_SetItem(v, 3, PyLong_FromLong((long)mode.c_lflag)); + PyList_SetItem(v, 4, PyLong_FromLong((long)ispeed)); + PyList_SetItem(v, 5, PyLong_FromLong((long)ospeed)); PyList_SetItem(v, 6, cc); if (PyErr_Occurred()){ Py_DECREF(v); @@ -163,12 +163,12 @@ termios_tcsetattr(PyObject *self, PyObject *args) /* Get the old mode, in case there are any hidden fields... */ if (tcgetattr(fd, &mode) == -1) return PyErr_SetFromErrno(TermiosError); - mode.c_iflag = (tcflag_t) PyInt_AsLong(PyList_GetItem(term, 0)); - mode.c_oflag = (tcflag_t) PyInt_AsLong(PyList_GetItem(term, 1)); - mode.c_cflag = (tcflag_t) PyInt_AsLong(PyList_GetItem(term, 2)); - mode.c_lflag = (tcflag_t) PyInt_AsLong(PyList_GetItem(term, 3)); - ispeed = (speed_t) PyInt_AsLong(PyList_GetItem(term, 4)); - ospeed = (speed_t) PyInt_AsLong(PyList_GetItem(term, 5)); + mode.c_iflag = (tcflag_t) PyLong_AsLong(PyList_GetItem(term, 0)); + mode.c_oflag = (tcflag_t) PyLong_AsLong(PyList_GetItem(term, 1)); + mode.c_cflag = (tcflag_t) PyLong_AsLong(PyList_GetItem(term, 2)); + mode.c_lflag = (tcflag_t) PyLong_AsLong(PyList_GetItem(term, 3)); + ispeed = (speed_t) PyLong_AsLong(PyList_GetItem(term, 4)); + ospeed = (speed_t) PyLong_AsLong(PyList_GetItem(term, 5)); cc = PyList_GetItem(term, 6); if (PyErr_Occurred()) return NULL; @@ -185,8 +185,8 @@ termios_tcsetattr(PyObject *self, PyObject *args) if (PyString_Check(v) && PyString_Size(v) == 1) mode.c_cc[i] = (cc_t) * PyString_AsString(v); - else if (PyInt_Check(v)) - mode.c_cc[i] = (cc_t) PyInt_AsLong(v); + else if (PyLong_Check(v)) + mode.c_cc[i] = (cc_t) PyLong_AsLong(v); else { PyErr_SetString(PyExc_TypeError, "tcsetattr: elements of attributes must be characters or integers"); diff --git a/Modules/threadmodule.c b/Modules/threadmodule.c index 876d5e2..d948154 100644 --- a/Modules/threadmodule.c +++ b/Modules/threadmodule.c @@ -493,7 +493,7 @@ thread_PyThread_start_new_thread(PyObject *self, PyObject *fargs) PyMem_DEL(boot); return NULL; } - return PyInt_FromLong(ident); + return PyLong_FromLong(ident); } PyDoc_STRVAR(start_new_doc, @@ -571,7 +571,7 @@ thread_get_ident(PyObject *self) PyErr_SetString(ThreadError, "no current thread ident"); return NULL; } - return PyInt_FromLong(ident); + return PyLong_FromLong(ident); } PyDoc_STRVAR(get_ident_doc, @@ -616,7 +616,7 @@ thread_stack_size(PyObject *self, PyObject *args) return NULL; } - return PyInt_FromSsize_t((Py_ssize_t) old_size); + return PyLong_FromSsize_t((Py_ssize_t) old_size); } PyDoc_STRVAR(stack_size_doc, diff --git a/Modules/timemodule.c b/Modules/timemodule.c index d7e5cfd..4196381 100644 --- a/Modules/timemodule.c +++ b/Modules/timemodule.c @@ -237,7 +237,7 @@ tmtotuple(struct tm *p) if (v == NULL) return NULL; -#define SET(i,val) PyStructSequence_SET_ITEM(v, i, PyInt_FromLong((long) val)) +#define SET(i,val) PyStructSequence_SET_ITEM(v, i, PyLong_FromLong((long) val)) SET(0, p->tm_year + 1900); SET(1, p->tm_mon + 1); /* Want January == 1 */ @@ -393,7 +393,7 @@ gettmarg(PyObject *args, struct tm *p) PyObject *accept = PyDict_GetItemString(moddict, "accept2dyear"); if (accept == NULL || !PyInt_CheckExact(accept) || - PyInt_AsLong(accept) == 0) { + PyLong_AsLong(accept) == 0) { PyErr_SetString(PyExc_ValueError, "year >= 1900 required"); return 0; diff --git a/Modules/unicodedata.c b/Modules/unicodedata.c index 87d71ac..060642b 100644 --- a/Modules/unicodedata.c +++ b/Modules/unicodedata.c @@ -143,7 +143,7 @@ unicodedata_decimal(PyObject *self, PyObject *args) return defobj; } } - return PyInt_FromLong(rc); + return PyLong_FromLong(rc); } PyDoc_STRVAR(unicodedata_digit__doc__, @@ -178,7 +178,7 @@ unicodedata_digit(PyObject *self, PyObject *args) return defobj; } } - return PyInt_FromLong(rc); + return PyLong_FromLong(rc); } PyDoc_STRVAR(unicodedata_numeric__doc__, @@ -320,7 +320,7 @@ unicodedata_combining(PyObject *self, PyObject *args) if (old->category_changed == 0) index = 0; /* unassigned */ } - return PyInt_FromLong(index); + return PyLong_FromLong(index); } PyDoc_STRVAR(unicodedata_mirrored__doc__, @@ -350,7 +350,7 @@ unicodedata_mirrored(PyObject *self, PyObject *args) if (old->category_changed == 0) index = 0; /* unassigned */ } - return PyInt_FromLong(index); + return PyLong_FromLong(index); } PyDoc_STRVAR(unicodedata_east_asian_width__doc__, diff --git a/Modules/xxmodule.c b/Modules/xxmodule.c index 75285f0..7c262c7 100644 --- a/Modules/xxmodule.c +++ b/Modules/xxmodule.c @@ -156,7 +156,7 @@ xx_foo(PyObject *self, PyObject *args) if (!PyArg_ParseTuple(args, "ll:foo", &i, &j)) return NULL; res = i+j; /* XXX Do something here */ - return PyInt_FromLong(res); + return PyLong_FromLong(res); } @@ -187,7 +187,7 @@ xx_bug(PyObject *self, PyObject *args) item = PyList_GetItem(list, 0); /* Py_INCREF(item); */ - PyList_SetItem(list, 1, PyInt_FromLong(0L)); + PyList_SetItem(list, 1, PyLong_FromLong(0L)); PyObject_Print(item, stdout, 0); printf("\n"); /* Py_DECREF(item); */ diff --git a/Modules/xxsubtype.c b/Modules/xxsubtype.c index 0cf0b81..6eb77d2 100644 --- a/Modules/xxsubtype.c +++ b/Modules/xxsubtype.c @@ -28,7 +28,7 @@ spamlist_getstate(spamlistobject *self, PyObject *args) { if (!PyArg_ParseTuple(args, ":getstate")) return NULL; - return PyInt_FromLong(self->state); + return PyLong_FromLong(self->state); } static PyObject * @@ -91,7 +91,7 @@ spamlist_init(spamlistobject *self, PyObject *args, PyObject *kwds) static PyObject * spamlist_state_get(spamlistobject *self) { - return PyInt_FromLong(self->state); + return PyLong_FromLong(self->state); } static PyGetSetDef spamlist_getsets[] = { @@ -153,7 +153,7 @@ spamdict_getstate(spamdictobject *self, PyObject *args) { if (!PyArg_ParseTuple(args, ":getstate")) return NULL; - return PyInt_FromLong(self->state); + return PyLong_FromLong(self->state); } static PyObject * diff --git a/Modules/zipimport.c b/Modules/zipimport.c index 3a19ab6..5f41e8d 100644 --- a/Modules/zipimport.c +++ b/Modules/zipimport.c @@ -1028,8 +1028,8 @@ get_mtime_of_source(ZipImporter *self, char *path) /* fetch the time stamp of the .py file for comparison with an embedded pyc time stamp */ int time, date; - time = PyInt_AsLong(PyTuple_GetItem(toc_entry, 5)); - date = PyInt_AsLong(PyTuple_GetItem(toc_entry, 6)); + time = PyLong_AsLong(PyTuple_GetItem(toc_entry, 5)); + date = PyLong_AsLong(PyTuple_GetItem(toc_entry, 6)); mtime = parse_dostime(time, date); } path[lastchar] = savechar; diff --git a/Modules/zlibmodule.c b/Modules/zlibmodule.c index 8f3202d..55e892a 100644 --- a/Modules/zlibmodule.c +++ b/Modules/zlibmodule.c @@ -922,7 +922,7 @@ PyZlib_adler32(PyObject *self, PyObject *args) if (!PyArg_ParseTuple(args, "s#|k:adler32", &buf, &len, &adler32val)) return NULL; adler32val = adler32(adler32val, buf, len); - return PyInt_FromLong(adler32val); + return PyLong_FromLong(adler32val); } PyDoc_STRVAR(crc32__doc__, @@ -940,7 +940,7 @@ PyZlib_crc32(PyObject *self, PyObject *args) if (!PyArg_ParseTuple(args, "s#|k:crc32", &buf, &len, &crc32val)) return NULL; crc32val = crc32(crc32val, buf, len); - return PyInt_FromLong(crc32val); + return PyLong_FromLong(crc32val); } diff --git a/Objects/abstract.c b/Objects/abstract.c index 01fbcbf..965d088 100644 --- a/Objects/abstract.c +++ b/Objects/abstract.c @@ -93,7 +93,7 @@ _PyObject_LengthHint(PyObject *o) PyErr_Fetch(&err_type, &err_value, &err_tb); ro = PyObject_CallMethod(o, "__length_hint__", NULL); if (ro != NULL) { - rv = PyInt_AsLong(ro); + rv = PyLong_AsLong(ro); Py_DECREF(ro); Py_XDECREF(err_type); Py_XDECREF(err_value); @@ -1188,8 +1188,8 @@ PyNumber_AsSsize_t(PyObject *item, PyObject *err) if (value == NULL) return -1; - /* We're done if PyInt_AsSsize_t() returns without error. */ - result = PyInt_AsSsize_t(value); + /* We're done if PyLong_AsSsize_t() returns without error. */ + result = PyLong_AsSsize_t(value); if (result != -1 || !(runerr = PyErr_Occurred())) goto finish; @@ -1413,7 +1413,7 @@ PySequence_Repeat(PyObject *o, Py_ssize_t count) to nb_multiply if o appears to be a sequence. */ if (PySequence_Check(o)) { PyObject *n, *result; - n = PyInt_FromSsize_t(count); + n = PyLong_FromSsize_t(count); if (n == NULL) return NULL; result = binary_op1(o, n, NB_SLOT(nb_multiply)); @@ -1465,7 +1465,7 @@ PySequence_InPlaceRepeat(PyObject *o, Py_ssize_t count) if (PySequence_Check(o)) { PyObject *n, *result; - n = PyInt_FromSsize_t(count); + n = PyLong_FromSsize_t(count); if (n == NULL) return NULL; result = binary_iop1(o, n, NB_SLOT(nb_inplace_multiply), diff --git a/Objects/bytesobject.c b/Objects/bytesobject.c index 9409d49..fae29e2 100644 --- a/Objects/bytesobject.c +++ b/Objects/bytesobject.c @@ -34,8 +34,8 @@ _getbytevalue(PyObject* arg, int *value) { long face_value; - if (PyInt_Check(arg)) { - face_value = PyInt_AsLong(arg); + if (PyLong_Check(arg)) { + face_value = PyLong_AsLong(arg); if (face_value < 0 || face_value >= 256) { PyErr_SetString(PyExc_ValueError, "byte must be in range(0, 256)"); return 0; @@ -350,7 +350,7 @@ bytes_getitem(PyBytesObject *self, Py_ssize_t i) PyErr_SetString(PyExc_IndexError, "bytearray index out of range"); return NULL; } - return PyInt_FromLong((unsigned char)(self->ob_bytes[i])); + return PyLong_FromLong((unsigned char)(self->ob_bytes[i])); } static PyObject * @@ -369,7 +369,7 @@ bytes_subscript(PyBytesObject *self, PyObject *item) PyErr_SetString(PyExc_IndexError, "bytearray index out of range"); return NULL; } - return PyInt_FromLong((unsigned char)(self->ob_bytes[i])); + return PyLong_FromLong((unsigned char)(self->ob_bytes[i])); } else if (PySlice_Check(item)) { Py_ssize_t start, stop, step, slicelength, cur, i; @@ -1091,7 +1091,7 @@ bytes_find(PyBytesObject *self, PyObject *args) Py_ssize_t result = bytes_find_internal(self, args, +1); if (result == -2) return NULL; - return PyInt_FromSsize_t(result); + return PyLong_FromSsize_t(result); } PyDoc_STRVAR(count__doc__, @@ -1119,7 +1119,7 @@ bytes_count(PyBytesObject *self, PyObject *args) _adjust_indices(&start, &end, PyBytes_GET_SIZE(self)); - count_obj = PyInt_FromSsize_t( + count_obj = PyLong_FromSsize_t( stringlib_count(str + start, end - start, vsub.buf, vsub.len) ); PyObject_ReleaseBuffer(sub_obj, &vsub); @@ -1143,7 +1143,7 @@ bytes_index(PyBytesObject *self, PyObject *args) "subsection not found"); return NULL; } - return PyInt_FromSsize_t(result); + return PyLong_FromSsize_t(result); } @@ -1162,7 +1162,7 @@ bytes_rfind(PyBytesObject *self, PyObject *args) Py_ssize_t result = bytes_find_internal(self, args, -1); if (result == -2) return NULL; - return PyInt_FromSsize_t(result); + return PyLong_FromSsize_t(result); } @@ -1182,7 +1182,7 @@ bytes_rindex(PyBytesObject *self, PyObject *args) "subsection not found"); return NULL; } - return PyInt_FromSsize_t(result); + return PyLong_FromSsize_t(result); } @@ -2622,7 +2622,7 @@ bytes_pop(PyBytesObject *self, PyObject *args) if (PyBytes_Resize((PyObject *)self, n - 1) < 0) return NULL; - return PyInt_FromLong(value); + return PyLong_FromLong(value); } PyDoc_STRVAR(remove__doc__, @@ -2809,7 +2809,7 @@ Returns the number of bytes actually allocated."); static PyObject * bytes_alloc(PyBytesObject *self) { - return PyInt_FromSsize_t(self->ob_alloc); + return PyLong_FromSsize_t(self->ob_alloc); } PyDoc_STRVAR(join_doc, @@ -3161,7 +3161,7 @@ bytesiter_next(bytesiterobject *it) assert(PyBytes_Check(seq)); if (it->it_index < PyBytes_GET_SIZE(seq)) { - item = PyInt_FromLong( + item = PyLong_FromLong( (unsigned char)seq->ob_bytes[it->it_index]); if (item != NULL) ++it->it_index; @@ -3179,7 +3179,7 @@ bytesiter_length_hint(bytesiterobject *it) Py_ssize_t len = 0; if (it->it_seq) len = PyBytes_GET_SIZE(it->it_seq) - it->it_index; - return PyInt_FromSsize_t(len); + return PyLong_FromSsize_t(len); } PyDoc_STRVAR(length_hint_doc, diff --git a/Objects/dictobject.c b/Objects/dictobject.c index dad9855..ae400b6 100644 --- a/Objects/dictobject.c +++ b/Objects/dictobject.c @@ -2094,7 +2094,7 @@ dictiter_len(dictiterobject *di) Py_ssize_t len = 0; if (di->di_dict != NULL && di->di_used == di->di_dict->ma_used) len = di->len; - return PyInt_FromSize_t(len); + return PyLong_FromSize_t(len); } PyDoc_STRVAR(length_hint_doc, diff --git a/Objects/enumobject.c b/Objects/enumobject.c index 0a3694d..6dc5a59 100644 --- a/Objects/enumobject.c +++ b/Objects/enumobject.c @@ -67,12 +67,12 @@ enum_next_long(enumobject *en, PyObject* next_item) PyObject *stepped_up; if (en->en_longindex == NULL) { - en->en_longindex = PyInt_FromLong(LONG_MAX); + en->en_longindex = PyLong_FromLong(LONG_MAX); if (en->en_longindex == NULL) return NULL; } if (one == NULL) { - one = PyInt_FromLong(1); + one = PyLong_FromLong(1); if (one == NULL) return NULL; } @@ -115,7 +115,7 @@ enum_next(enumobject *en) if (en->en_index == LONG_MAX) return enum_next_long(en, next_item); - next_index = PyInt_FromLong(en->en_index); + next_index = PyLong_FromLong(en->en_index); if (next_index == NULL) { Py_DECREF(next_item); return NULL; @@ -279,12 +279,12 @@ reversed_len(reversedobject *ro) Py_ssize_t position, seqsize; if (ro->seq == NULL) - return PyInt_FromLong(0); + return PyLong_FromLong(0); seqsize = PySequence_Size(ro->seq); if (seqsize == -1) return NULL; position = ro->index + 1; - return PyInt_FromSsize_t((seqsize < position) ? 0 : position); + return PyLong_FromSsize_t((seqsize < position) ? 0 : position); } PyDoc_STRVAR(length_hint_doc, "Private method returning an estimate of len(list(it))."); diff --git a/Objects/exceptions.c b/Objects/exceptions.c index 14e1bfb..4c6a122 100644 --- a/Objects/exceptions.c +++ b/Objects/exceptions.c @@ -720,7 +720,7 @@ WindowsError_init(PyWindowsErrorObject *self, PyObject *args, PyObject *kwds) /* Set errno to the POSIX errno, and winerror to the Win32 error code. */ - errcode = PyInt_AsLong(self->myerrno); + errcode = PyLong_AsLong(self->myerrno); if (errcode == -1 && PyErr_Occurred()) return -1; posix_errno = winerror_to_errno(errcode); @@ -728,7 +728,7 @@ WindowsError_init(PyWindowsErrorObject *self, PyObject *args, PyObject *kwds) Py_CLEAR(self->winerror); self->winerror = self->myerrno; - o_errcode = PyInt_FromLong(posix_errno); + o_errcode = PyLong_FromLong(posix_errno); if (!o_errcode) return -1; @@ -945,7 +945,7 @@ SyntaxError_str(PySyntaxErrorObject *self) return PyUnicode_FromFormat("%S (%s, line %ld)", self->msg ? self->msg : Py_None, my_basename(filename), - PyInt_AsLong(self->lineno)); + PyLong_AsLong(self->lineno)); else if (filename) return PyUnicode_FromFormat("%S (%s)", self->msg ? self->msg : Py_None, @@ -953,7 +953,7 @@ SyntaxError_str(PySyntaxErrorObject *self) else /* only have_lineno */ return PyUnicode_FromFormat("%S (line %ld)", self->msg ? self->msg : Py_None, - PyInt_AsLong(self->lineno)); + PyLong_AsLong(self->lineno)); } static PyMemberDef SyntaxError_members[] = { diff --git a/Objects/fileobject.c b/Objects/fileobject.c index 5d69911..f740977 100644 --- a/Objects/fileobject.c +++ b/Objects/fileobject.c @@ -413,7 +413,7 @@ stdprinter_write(PyStdPrinter_Object *self, PyObject *args) static PyObject * stdprinter_fileno(PyStdPrinter_Object *self) { - return PyInt_FromLong((long) self->fd); + return PyLong_FromLong((long) self->fd); } static PyObject * diff --git a/Objects/floatobject.c b/Objects/floatobject.c index d3b7c9e..d346ef6 100644 --- a/Objects/floatobject.c +++ b/Objects/floatobject.c @@ -72,7 +72,7 @@ PyFloat_GetInfo(void) if (PyDict_SetItemString(d, key, tmp)) return NULL; \ Py_DECREF(tmp) #define SET_INT_CONST(d, key, const) \ - tmp = PyInt_FromLong(const); \ + tmp = PyLong_FromLong(const); \ if (tmp == NULL) return NULL; \ if (PyDict_SetItemString(d, key, tmp)) return NULL; \ Py_DECREF(tmp) @@ -481,7 +481,7 @@ float_richcompare(PyObject *v, PyObject *w, int op) */ PyObject *temp; - one = PyInt_FromLong(1); + one = PyLong_FromLong(1); if (one == NULL) goto Error; @@ -808,7 +808,7 @@ float_trunc(PyObject *v) */ if (LONG_MIN < wholepart && wholepart < LONG_MAX) { const long aslong = (long)wholepart; - return PyInt_FromLong(aslong); + return PyLong_FromLong(aslong); } return PyLong_FromDouble(wholepart); } diff --git a/Objects/frameobject.c b/Objects/frameobject.c index cf41ddd..0e6d9f8 100644 --- a/Objects/frameobject.c +++ b/Objects/frameobject.c @@ -44,7 +44,7 @@ frame_getlineno(PyFrameObject *f, void *closure) else lineno = PyCode_Addr2Line(f->f_code, f->f_lasti); - return PyInt_FromLong(lineno); + return PyLong_FromLong(lineno); } /* Setter for f_lineno - you can set f_lineno from within a trace function in @@ -104,7 +104,7 @@ frame_setlineno(PyFrameObject *f, PyObject* p_new_lineno) } /* Fail if the line comes before the start of the code block. */ - new_lineno = (int) PyInt_AsLong(p_new_lineno); + new_lineno = (int) PyLong_AsLong(p_new_lineno); if (new_lineno < f->f_code->co_firstlineno) { PyErr_Format(PyExc_ValueError, "line %d comes before the current code block", diff --git a/Objects/iterobject.c b/Objects/iterobject.c index 12b603a..e48700c 100644 --- a/Objects/iterobject.c +++ b/Objects/iterobject.c @@ -81,9 +81,9 @@ iter_len(seqiterobject *it) return NULL; len = seqsize - it->it_index; if (len >= 0) - return PyInt_FromSsize_t(len); + return PyLong_FromSsize_t(len); } - return PyInt_FromLong(0); + return PyLong_FromLong(0); } PyDoc_STRVAR(length_hint_doc, "Private method returning an estimate of len(list(it))."); diff --git a/Objects/listobject.c b/Objects/listobject.c index 01ada08..43e8a3f 100644 --- a/Objects/listobject.c +++ b/Objects/listobject.c @@ -931,7 +931,7 @@ islt(PyObject *x, PyObject *y, PyObject *compare) Py_DECREF(res); return -1; } - i = PyInt_AsLong(res); + i = PyLong_AsLong(res); Py_DECREF(res); return i < 0; } @@ -2226,7 +2226,7 @@ listindex(PyListObject *self, PyObject *args) for (i = start; i < stop && i < Py_Size(self); i++) { int cmp = PyObject_RichCompareBool(self->ob_item[i], v, Py_EQ); if (cmp > 0) - return PyInt_FromSsize_t(i); + return PyLong_FromSsize_t(i); else if (cmp < 0) return NULL; } @@ -2247,7 +2247,7 @@ listcount(PyListObject *self, PyObject *v) else if (cmp < 0) return NULL; } - return PyInt_FromSsize_t(count); + return PyLong_FromSsize_t(count); } static PyObject * @@ -2823,9 +2823,9 @@ listiter_len(listiterobject *it) if (it->it_seq) { len = PyList_GET_SIZE(it->it_seq) - it->it_index; if (len >= 0) - return PyInt_FromSsize_t(len); + return PyLong_FromSsize_t(len); } - return PyInt_FromLong(0); + return PyLong_FromLong(0); } /*********************** List Reverse Iterator **************************/ diff --git a/Objects/longobject.c b/Objects/longobject.c index d827e7e..1e20485 100644 --- a/Objects/longobject.c +++ b/Objects/longobject.c @@ -59,7 +59,7 @@ get_small_int(int ival) be a small integer, so negating it must go to PyLong_FromLong */ #define NEGATE(x) \ do if (Py_Refcnt(x) == 1) Py_Size(x) = -Py_Size(x); \ - else { PyObject* tmp=PyInt_FromLong(-MEDIUM_VALUE(x)); \ + else { PyObject* tmp=PyLong_FromLong(-MEDIUM_VALUE(x)); \ Py_DECREF(x); (x) = (PyLongObject*)tmp; } \ while(0) /* For long multiplication, use the O(N**2) school algorithm unless @@ -976,7 +976,7 @@ PyLong_FromVoidPtr(void *p) #endif /* special-case null pointer */ if (!p) - return PyInt_FromLong(0); + return PyLong_FromLong(0); return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG)(Py_uintptr_t)p); } @@ -2315,7 +2315,7 @@ long_add(PyLongObject *a, PyLongObject *b) CHECK_BINOP(a, b); if (ABS(Py_Size(a)) <= 1 && ABS(Py_Size(b)) <= 1) { - PyObject *result = PyInt_FromLong(MEDIUM_VALUE(a) + + PyObject *result = PyLong_FromLong(MEDIUM_VALUE(a) + MEDIUM_VALUE(b)); return result; } diff --git a/Objects/memoryobject.c b/Objects/memoryobject.c index 2f177c2..c60c53c 100644 --- a/Objects/memoryobject.c +++ b/Objects/memoryobject.c @@ -303,7 +303,7 @@ memory_format_get(PyMemoryViewObject *self) static PyObject * memory_itemsize_get(PyMemoryViewObject *self) { - return PyInt_FromSsize_t(self->view.itemsize); + return PyLong_FromSsize_t(self->view.itemsize); } static PyObject * @@ -320,7 +320,7 @@ _IntTupleFromSsizet(int len, Py_ssize_t *vals) intTuple = PyTuple_New(len); if (!intTuple) return NULL; for(i=0; iview.len); + return PyLong_FromSsize_t(self->view.len); } static PyObject * @@ -363,7 +363,7 @@ memory_readonly_get(PyMemoryViewObject *self) static PyObject * memory_ndim_get(PyMemoryViewObject *self) { - return PyInt_FromLong(self->view.ndim); + return PyLong_FromLong(self->view.ndim); } static PyGetSetDef memory_getsetlist[] ={ diff --git a/Objects/rangeobject.c b/Objects/rangeobject.c index 0b7be43..fa9e09b 100644 --- a/Objects/rangeobject.c +++ b/Objects/rangeobject.c @@ -24,7 +24,7 @@ validate_step(PyObject *step) { /* No step specified, use a step of 1. */ if (!step) - return PyInt_FromLong(1); + return PyLong_FromLong(1); step = PyNumber_Index(step); if (step) { @@ -63,8 +63,8 @@ range_new(PyTypeObject *type, PyObject *args, PyObject *kw) stop = PyNumber_Index(stop); if (!stop) goto Fail; - start = PyInt_FromLong(0); - step = PyInt_FromLong(1); + start = PyLong_FromLong(0); + step = PyLong_FromLong(1); if (!start || !step) goto Fail; } @@ -113,7 +113,7 @@ range_dealloc(rangeobject *r) /* Return number of items in range (lo, hi, step), when arguments are * PyInt or PyLong objects. step > 0 required. Return a value < 0 if * & only if the true value is too large to fit in a signed long. - * Arguments MUST return 1 with either PyInt_Check() or + * Arguments MUST return 1 with either PyLong_Check() or * PyLong_Check(). Return -1 when there is an error. */ static PyObject* @@ -332,14 +332,14 @@ static PyObject * rangeiter_next(rangeiterobject *r) { if (r->index < r->len) - return PyInt_FromLong(r->start + (r->index++) * r->step); + return PyLong_FromLong(r->start + (r->index++) * r->step); return NULL; } static PyObject * rangeiter_len(rangeiterobject *r) { - return PyInt_FromLong(r->len - r->index); + return PyLong_FromLong(r->len - r->index); } typedef struct { diff --git a/Objects/setobject.c b/Objects/setobject.c index 11ca407..f22268e 100644 --- a/Objects/setobject.c +++ b/Objects/setobject.c @@ -801,7 +801,7 @@ setiter_len(setiterobject *si) Py_ssize_t len = 0; if (si->si_set != NULL && si->si_used == si->si_set->used) len = si->len; - return PyInt_FromLong(len); + return PyLong_FromLong(len); } PyDoc_STRVAR(length_hint_doc, "Private method returning an estimate of len(list(it))."); diff --git a/Objects/sliceobject.c b/Objects/sliceobject.c index 28b92d0..dec4d45 100644 --- a/Objects/sliceobject.c +++ b/Objects/sliceobject.c @@ -83,10 +83,10 @@ PyObject * _PySlice_FromIndices(Py_ssize_t istart, Py_ssize_t istop) { PyObject *start, *end, *slice; - start = PyInt_FromSsize_t(istart); + start = PyLong_FromSsize_t(istart); if (!start) return NULL; - end = PyInt_FromSsize_t(istop); + end = PyLong_FromSsize_t(istop); if (!end) { Py_DECREF(start); return NULL; @@ -107,20 +107,20 @@ PySlice_GetIndices(PySliceObject *r, Py_ssize_t length, *step = 1; } else { if (!PyLong_Check(r->step)) return -1; - *step = PyInt_AsSsize_t(r->step); + *step = PyLong_AsSsize_t(r->step); } if (r->start == Py_None) { *start = *step < 0 ? length-1 : 0; } else { - if (!PyInt_Check(r->start)) return -1; - *start = PyInt_AsSsize_t(r->start); + if (!PyLong_Check(r->start)) return -1; + *start = PyLong_AsSsize_t(r->start); if (*start < 0) *start += length; } if (r->stop == Py_None) { *stop = *step < 0 ? -1 : length; } else { - if (!PyInt_Check(r->stop)) return -1; - *stop = PyInt_AsSsize_t(r->stop); + if (!PyLong_Check(r->stop)) return -1; + *stop = PyLong_AsSsize_t(r->stop); if (*stop < 0) *stop += length; } if (*stop > length) return -1; diff --git a/Objects/stringlib/formatter.h b/Objects/stringlib/formatter.h index ee0971d..b4f6e3c 100644 --- a/Objects/stringlib/formatter.h +++ b/Objects/stringlib/formatter.h @@ -469,7 +469,7 @@ format_long_internal(PyObject *value, const InternalFormatSpec *format) /* taken from unicodeobject.c formatchar() */ /* Integer input truncated to a character */ - x = PyInt_AsLong(value); + x = PyLong_AsLong(value); if (x == -1 && PyErr_Occurred()) goto done; #ifdef Py_UNICODE_WIDE diff --git a/Objects/stringlib/string_format.h b/Objects/stringlib/string_format.h index b771149..10d150f 100644 --- a/Objects/stringlib/string_format.h +++ b/Objects/stringlib/string_format.h @@ -204,7 +204,7 @@ static PyObject * getitem_idx(PyObject *obj, Py_ssize_t idx) { PyObject *newobj; - PyObject *idx_obj = PyInt_FromSsize_t(idx); + PyObject *idx_obj = PyLong_FromSsize_t(idx); if (idx_obj == NULL) return NULL; newobj = PyObject_GetItem(obj, idx_obj); @@ -1160,7 +1160,7 @@ fieldnameiter_next(fieldnameiterobject *it) /* either an integer or a string */ if (idx != -1) - obj = PyInt_FromSsize_t(idx); + obj = PyLong_FromSsize_t(idx); else obj = SubString_new_object(&name); if (obj == NULL) @@ -1245,7 +1245,7 @@ formatter_field_name_split(PyUnicodeObject *self) /* first becomes an integer, if possible; else a string */ if (first_idx != -1) - first_obj = PyInt_FromSsize_t(first_idx); + first_obj = PyLong_FromSsize_t(first_idx); else /* convert "first" into a string object */ first_obj = SubString_new_object(&first); diff --git a/Objects/stringobject.c b/Objects/stringobject.c index 887b28a..1c0a70d 100644 --- a/Objects/stringobject.c +++ b/Objects/stringobject.c @@ -803,7 +803,7 @@ string_item(PyStringObject *a, register Py_ssize_t i) PyErr_SetString(PyExc_IndexError, "string index out of range"); return NULL; } - return PyInt_FromLong((unsigned char)a->ob_sval[i]); + return PyLong_FromLong((unsigned char)a->ob_sval[i]); } static PyObject* @@ -922,7 +922,7 @@ string_subscript(PyStringObject* self, PyObject* item) "string index out of range"); return NULL; } - return PyInt_FromLong((unsigned char)self->ob_sval[i]); + return PyLong_FromLong((unsigned char)self->ob_sval[i]); } else if (PySlice_Check(item)) { Py_ssize_t start, stop, step, slicelength, cur, i; @@ -1586,7 +1586,7 @@ string_find(PyStringObject *self, PyObject *args) Py_ssize_t result = string_find_internal(self, args, +1); if (result == -2) return NULL; - return PyInt_FromSsize_t(result); + return PyLong_FromSsize_t(result); } @@ -1606,7 +1606,7 @@ string_index(PyStringObject *self, PyObject *args) "substring not found"); return NULL; } - return PyInt_FromSsize_t(result); + return PyLong_FromSsize_t(result); } @@ -1625,7 +1625,7 @@ string_rfind(PyStringObject *self, PyObject *args) Py_ssize_t result = string_find_internal(self, args, -1); if (result == -2) return NULL; - return PyInt_FromSsize_t(result); + return PyLong_FromSsize_t(result); } @@ -1645,7 +1645,7 @@ string_rindex(PyStringObject *self, PyObject *args) "substring not found"); return NULL; } - return PyInt_FromSsize_t(result); + return PyLong_FromSsize_t(result); } @@ -1808,7 +1808,7 @@ string_count(PyStringObject *self, PyObject *args) string_adjust_indices(&start, &end, PyString_GET_SIZE(self)); - return PyInt_FromSsize_t( + return PyLong_FromSsize_t( stringlib_count(str + start, end - start, sub, sub_len) ); } @@ -3332,7 +3332,7 @@ striter_next(striterobject *it) assert(PyString_Check(seq)); if (it->it_index < PyString_GET_SIZE(seq)) { - item = PyInt_FromLong( + item = PyLong_FromLong( (unsigned char)seq->ob_sval[it->it_index]); if (item != NULL) ++it->it_index; @@ -3350,7 +3350,7 @@ striter_len(striterobject *it) Py_ssize_t len = 0; if (it->it_seq) len = PyString_GET_SIZE(it->it_seq) - it->it_index; - return PyInt_FromSsize_t(len); + return PyLong_FromSsize_t(len); } PyDoc_STRVAR(length_hint_doc, diff --git a/Objects/structseq.c b/Objects/structseq.c index 1b6aafd..91cf57b 100644 --- a/Objects/structseq.c +++ b/Objects/structseq.c @@ -14,14 +14,14 @@ static char unnamed_fields_key[] = "n_unnamed_fields"; char *PyStructSequence_UnnamedField = "unnamed field"; #define VISIBLE_SIZE(op) Py_Size(op) -#define VISIBLE_SIZE_TP(tp) PyInt_AsLong( \ +#define VISIBLE_SIZE_TP(tp) PyLong_AsLong( \ PyDict_GetItemString((tp)->tp_dict, visible_length_key)) -#define REAL_SIZE_TP(tp) PyInt_AsLong( \ +#define REAL_SIZE_TP(tp) PyLong_AsLong( \ PyDict_GetItemString((tp)->tp_dict, real_length_key)) #define REAL_SIZE(op) REAL_SIZE_TP(Py_Type(op)) -#define UNNAMED_FIELDS_TP(tp) PyInt_AsLong( \ +#define UNNAMED_FIELDS_TP(tp) PyLong_AsLong( \ PyDict_GetItemString((tp)->tp_dict, unnamed_fields_key)) #define UNNAMED_FIELDS(op) UNNAMED_FIELDS_TP(Py_Type(op)) @@ -451,9 +451,9 @@ PyStructSequence_InitType(PyTypeObject *type, PyStructSequence_Desc *desc) dict = type->tp_dict; PyDict_SetItemString(dict, visible_length_key, - PyInt_FromLong((long) desc->n_in_sequence)); + PyLong_FromLong((long) desc->n_in_sequence)); PyDict_SetItemString(dict, real_length_key, - PyInt_FromLong((long) n_members)); + PyLong_FromLong((long) n_members)); PyDict_SetItemString(dict, unnamed_fields_key, - PyInt_FromLong((long) n_unnamed_members)); + PyLong_FromLong((long) n_unnamed_members)); } diff --git a/Objects/tupleobject.c b/Objects/tupleobject.c index fcfd09d..f1e8057 100644 --- a/Objects/tupleobject.c +++ b/Objects/tupleobject.c @@ -828,7 +828,7 @@ tupleiter_len(tupleiterobject *it) Py_ssize_t len = 0; if (it->it_seq) len = PyTuple_GET_SIZE(it->it_seq) - it->it_index; - return PyInt_FromSsize_t(len); + return PyLong_FromSsize_t(len); } PyDoc_STRVAR(length_hint_doc, "Private method returning an estimate of len(list(it))."); diff --git a/Objects/typeobject.c b/Objects/typeobject.c index 99ba799..55a8ec6 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -3623,7 +3623,7 @@ wrap_lenfunc(PyObject *self, PyObject *args, void *wrapped) res = (*func)(self); if (res == -1 && PyErr_Occurred()) return NULL; - return PyInt_FromLong((long)res); + return PyLong_FromLong((long)res); } static PyObject * @@ -3887,7 +3887,7 @@ wrap_cmpfunc(PyObject *self, PyObject *args, void *wrapped) res = (*func)(self, other); if (PyErr_Occurred()) return NULL; - return PyInt_FromLong((long)res); + return PyLong_FromLong((long)res); } /* Helper to check for object.__setattr__ or __delattr__ applied to a type. @@ -3958,7 +3958,7 @@ wrap_hashfunc(PyObject *self, PyObject *args, void *wrapped) res = (*func)(self); if (res == -1 && PyErr_Occurred()) return NULL; - return PyInt_FromLong(res); + return PyLong_FromLong(res); } static PyObject * @@ -4270,7 +4270,7 @@ slot_sq_length(PyObject *self) if (res == NULL) return -1; - len = PyInt_AsSsize_t(res); + len = PyLong_AsSsize_t(res); Py_DECREF(res); if (len < 0) { if (!PyErr_Occurred()) @@ -4305,7 +4305,7 @@ slot_sq_item(PyObject *self, Py_ssize_t i) return NULL; } } - ival = PyInt_FromSsize_t(i); + ival = PyLong_FromSsize_t(i); if (ival != NULL) { args = PyTuple_New(1); if (args != NULL) { @@ -4538,7 +4538,7 @@ half_compare(PyObject *self, PyObject *other) if (res != Py_NotImplemented) { if (res == NULL) return -2; - c = PyInt_AsLong(res); + c = PyLong_AsLong(res); Py_DECREF(res); if (c == -1 && PyErr_Occurred()) return -2; @@ -4639,7 +4639,7 @@ slot_tp_hash(PyObject *self) if (PyLong_Check(res)) h = PyLong_Type.tp_hash(res); else - h = PyInt_AsLong(res); + h = PyLong_AsLong(res); Py_DECREF(res); if (h == -1 && !PyErr_Occurred()) h = -2; diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c index 26349ef..6d1d069 100644 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -3980,7 +3980,7 @@ PyObject *PyUnicode_DecodeCharmap(const char *s, PyObject *w, *x; /* Get mapping (char ordinal -> integer, Unicode char or None) */ - w = PyInt_FromLong((long)ch); + w = PyLong_FromLong((long)ch); if (w == NULL) goto onError; x = PyObject_GetItem(mapping, w); @@ -3996,8 +3996,8 @@ PyObject *PyUnicode_DecodeCharmap(const char *s, } /* Apply mapping */ - if (PyInt_Check(x)) { - long value = PyInt_AS_LONG(x); + if (PyLong_Check(x)) { + long value = PyLong_AS_LONG(x); if (value < 0 || value > 65535) { PyErr_SetString(PyExc_TypeError, "character mapping must be in range(65536)"); @@ -4091,7 +4091,7 @@ static PyObject* encoding_map_size(PyObject *obj, PyObject* args) { struct encoding_map *map = (struct encoding_map*)obj; - return PyInt_FromLong(sizeof(*map) - 1 + 16*map->count2 + + return PyLong_FromLong(sizeof(*map) - 1 + 16*map->count2 + 128*map->count3); } @@ -4208,8 +4208,8 @@ PyUnicode_BuildEncodingMap(PyObject* string) return NULL; for (i = 0; i < 256; i++) { key = value = NULL; - key = PyInt_FromLong(decode[i]); - value = PyInt_FromLong(i); + key = PyLong_FromLong(decode[i]); + value = PyLong_FromLong(i); if (!key || !value) goto failed1; if (PyDict_SetItem(result, key, value) == -1) @@ -4297,7 +4297,7 @@ encoding_map_lookup(Py_UNICODE c, PyObject *mapping) error occurred). */ static PyObject *charmapencode_lookup(Py_UNICODE c, PyObject *mapping) { - PyObject *w = PyInt_FromLong((long)c); + PyObject *w = PyLong_FromLong((long)c); PyObject *x; if (w == NULL) @@ -4316,8 +4316,8 @@ static PyObject *charmapencode_lookup(Py_UNICODE c, PyObject *mapping) } else if (x == Py_None) return x; - else if (PyInt_Check(x)) { - long value = PyInt_AS_LONG(x); + else if (PyLong_Check(x)) { + long value = PyLong_AS_LONG(x); if (value < 0 || value > 255) { PyErr_SetString(PyExc_TypeError, "character mapping must be in range(256)"); @@ -4387,7 +4387,7 @@ charmapencode_result charmapencode_output(Py_UNICODE c, PyObject *mapping, Py_DECREF(rep); return enc_FAILED; } else { - if (PyInt_Check(rep)) { + if (PyLong_Check(rep)) { Py_ssize_t requiredsize = *outpos+1; if (outsize max) { PyErr_Format(PyExc_TypeError, @@ -4790,9 +4790,9 @@ int charmaptranslate_output(const Py_UNICODE *startinp, const Py_UNICODE *curinp } else if (*res==Py_None) ; - else if (PyInt_Check(*res)) { + else if (PyLong_Check(*res)) { /* no overflow check, because we know that the space is enough */ - *(*outp)++ = (Py_UNICODE)PyInt_AS_LONG(*res); + *(*outp)++ = (Py_UNICODE)PyLong_AS_LONG(*res); } else if (PyUnicode_Check(*res)) { Py_ssize_t repsize = PyUnicode_GET_SIZE(*res); @@ -6469,7 +6469,7 @@ unicode_count(PyUnicodeObject *self, PyObject *args) FIX_START_END(self); - result = PyInt_FromSsize_t( + result = PyLong_FromSsize_t( stringlib_count(self->str + start, end - start, substring->str, substring->length) ); @@ -6622,7 +6622,7 @@ unicode_find(PyUnicodeObject *self, PyObject *args) Py_DECREF(substring); - return PyInt_FromSsize_t(result); + return PyLong_FromSsize_t(result); } static PyObject * @@ -6688,7 +6688,7 @@ unicode_index(PyUnicodeObject *self, PyObject *args) return NULL; } - return PyInt_FromSsize_t(result); + return PyLong_FromSsize_t(result); } PyDoc_STRVAR(islower__doc__, @@ -7514,7 +7514,7 @@ unicode_rfind(PyUnicodeObject *self, PyObject *args) Py_DECREF(substring); - return PyInt_FromSsize_t(result); + return PyLong_FromSsize_t(result); } PyDoc_STRVAR(rindex__doc__, @@ -7545,7 +7545,7 @@ unicode_rindex(PyUnicodeObject *self, PyObject *args) PyErr_SetString(PyExc_ValueError, "substring not found"); return NULL; } - return PyInt_FromSsize_t(result); + return PyLong_FromSsize_t(result); } PyDoc_STRVAR(rjust__doc__, @@ -7833,8 +7833,8 @@ unicode_maketrans(PyUnicodeObject *null, PyObject *args) } /* create entries for translating chars in x to those in y */ for (i = 0; i < PyUnicode_GET_SIZE(x); i++) { - key = PyInt_FromLong(PyUnicode_AS_UNICODE(x)[i]); - value = PyInt_FromLong(PyUnicode_AS_UNICODE(y)[i]); + key = PyLong_FromLong(PyUnicode_AS_UNICODE(x)[i]); + value = PyLong_FromLong(PyUnicode_AS_UNICODE(y)[i]); if (!key || !value) goto err; res = PyDict_SetItem(new, key, value); @@ -7846,7 +7846,7 @@ unicode_maketrans(PyUnicodeObject *null, PyObject *args) /* create entries for deleting chars in z */ if (z != NULL) { for (i = 0; i < PyUnicode_GET_SIZE(z); i++) { - key = PyInt_FromLong(PyUnicode_AS_UNICODE(z)[i]); + key = PyLong_FromLong(PyUnicode_AS_UNICODE(z)[i]); if (!key) goto err; res = PyDict_SetItem(new, key, Py_None); @@ -7872,14 +7872,14 @@ unicode_maketrans(PyUnicodeObject *null, PyObject *args) "table must be of length 1"); goto err; } - newkey = PyInt_FromLong(PyUnicode_AS_UNICODE(key)[0]); + newkey = PyLong_FromLong(PyUnicode_AS_UNICODE(key)[0]); if (!newkey) goto err; res = PyDict_SetItem(new, newkey, value); Py_DECREF(newkey); if (res < 0) goto err; - } else if (PyInt_Check(key)) { + } else if (PyLong_Check(key)) { /* just keep integer keys */ if (PyDict_SetItem(new, key, value) < 0) goto err; @@ -7970,7 +7970,7 @@ unicode_zfill(PyUnicodeObject *self, PyObject *args) static PyObject* unicode_freelistsize(PyUnicodeObject *self) { - return PyInt_FromLong(unicode_freelist_size); + return PyLong_FromLong(unicode_freelist_size); } #endif @@ -8368,7 +8368,7 @@ formatint(Py_UNICODE *buf, char *sign; long x; - x = PyInt_AsLong(v); + x = PyLong_AsLong(v); if (x == -1 && PyErr_Occurred()) return -1; if (x < 0 && type == 'u') { @@ -8441,7 +8441,7 @@ formatchar(Py_UNICODE *buf, else { /* Integer input truncated to a character */ long x; - x = PyInt_AsLong(v); + x = PyLong_AsLong(v); if (x == -1 && PyErr_Occurred()) goto onError; #ifdef Py_UNICODE_WIDE @@ -8613,12 +8613,12 @@ PyObject *PyUnicode_Format(PyObject *format, v = getnextarg(args, arglen, &argidx); if (v == NULL) goto onError; - if (!PyInt_Check(v)) { + if (!PyLong_Check(v)) { PyErr_SetString(PyExc_TypeError, "* wants int"); goto onError; } - width = PyInt_AsLong(v); + width = PyLong_AsLong(v); if (width == -1 && PyErr_Occurred()) goto onError; if (width < 0) { @@ -8650,12 +8650,12 @@ PyObject *PyUnicode_Format(PyObject *format, v = getnextarg(args, arglen, &argidx); if (v == NULL) goto onError; - if (!PyInt_Check(v)) { + if (!PyLong_Check(v)) { PyErr_SetString(PyExc_TypeError, "* wants int"); goto onError; } - prec = PyInt_AsLong(v); + prec = PyLong_AsLong(v); if (prec == -1 && PyErr_Occurred()) goto onError; if (prec < 0) @@ -9250,7 +9250,7 @@ unicodeiter_len(unicodeiterobject *it) Py_ssize_t len = 0; if (it->it_seq) len = PyUnicode_GET_SIZE(it->it_seq) - it->it_index; - return PyInt_FromSsize_t(len); + return PyLong_FromSsize_t(len); } PyDoc_STRVAR(length_hint_doc, "Private method returning an estimate of len(list(it))."); diff --git a/PC/_msi.c b/PC/_msi.c index 70e0cc4..8dc7734 100644 --- a/PC/_msi.c +++ b/PC/_msi.c @@ -335,7 +335,7 @@ msierror(int status) static PyObject* record_getfieldcount(msiobj* record, PyObject* args) { - return PyInt_FromLong(MsiRecordGetFieldCount(record->h)); + return PyLong_FromLong(MsiRecordGetFieldCount(record->h)); } static PyObject* @@ -502,7 +502,7 @@ summary_getproperty(msiobj* si, PyObject *args) switch(type) { case VT_I2: case VT_I4: - return PyInt_FromLong(ival); + return PyLong_FromLong(ival); case VT_FILETIME: PyErr_SetString(PyExc_NotImplementedError, "FILETIME result"); return NULL; @@ -526,7 +526,7 @@ summary_getpropertycount(msiobj* si, PyObject *args) if (status != ERROR_SUCCESS) return msierror(status); - return PyInt_FromLong(result); + return PyLong_FromLong(result); } static PyObject* @@ -544,7 +544,7 @@ summary_setproperty(msiobj* si, PyObject *args) 0, NULL, PyString_AsString(data)); } else if (PyInt_CheckExact(data)) { status = MsiSummaryInfoSetProperty(si->h, field, VT_I4, - PyInt_AsLong(data), NULL, NULL); + PyLong_AsLong(data), NULL, NULL); } else { PyErr_SetString(PyExc_TypeError, "unsupported type"); return NULL; diff --git a/PC/_subprocess.c b/PC/_subprocess.c index e711e13..fec7b22 100644 --- a/PC/_subprocess.c +++ b/PC/_subprocess.c @@ -79,7 +79,7 @@ sp_handle_detach(sp_handle_object* self, PyObject* args) self->handle = NULL; /* note: return the current handle, as an integer */ - return PyInt_FromLong((long) handle); + return PyLong_FromLong((long) handle); } static PyObject* @@ -119,7 +119,7 @@ sp_handle_getattr(sp_handle_object* self, char* name) static PyObject* sp_handle_as_int(sp_handle_object* self) { - return PyInt_FromLong((long) self->handle); + return PyLong_FromLong((long) self->handle); } static PyNumberMethods sp_handle_as_number; @@ -164,7 +164,7 @@ sp_GetStdHandle(PyObject* self, PyObject* args) } /* note: returns integer, not handle object */ - return PyInt_FromLong((long) handle); + return PyLong_FromLong((long) handle); } static PyObject * @@ -253,7 +253,7 @@ getint(PyObject* obj, char* name) PyErr_Clear(); /* FIXME: propagate error? */ return 0; } - ret = (int) PyInt_AsLong(value); + ret = (int) PyLong_AsLong(value); Py_DECREF(value); return ret; } @@ -462,7 +462,7 @@ sp_GetExitCodeProcess(PyObject* self, PyObject* args) if (! result) return PyErr_SetFromWindowsErr(GetLastError()); - return PyInt_FromLong(exit_code); + return PyLong_FromLong(exit_code); } static PyObject * @@ -484,7 +484,7 @@ sp_WaitForSingleObject(PyObject* self, PyObject* args) if (result == WAIT_FAILED) return PyErr_SetFromWindowsErr(GetLastError()); - return PyInt_FromLong((int) result); + return PyLong_FromLong((int) result); } static PyObject * @@ -493,7 +493,7 @@ sp_GetVersion(PyObject* self, PyObject* args) if (! PyArg_ParseTuple(args, ":GetVersion")) return NULL; - return PyInt_FromLong((int) GetVersion()); + return PyLong_FromLong((int) GetVersion()); } static PyObject * @@ -534,7 +534,7 @@ static PyMethodDef sp_functions[] = { static void defint(PyObject* d, const char* name, int value) { - PyObject* v = PyInt_FromLong((long) value); + PyObject* v = PyLong_FromLong((long) value); if (v) { PyDict_SetItemString(d, (char*) name, v); Py_DECREF(v); diff --git a/PC/_winreg.c b/PC/_winreg.c index 4deb5a9..e1145b1 100644 --- a/PC/_winreg.c +++ b/PC/_winreg.c @@ -614,8 +614,8 @@ PyWinObject_CloseHKEY(PyObject *obHandle) ok = PyHKEY_Close(obHandle); } #if SIZEOF_LONG >= SIZEOF_HKEY - else if (PyInt_Check(obHandle)) { - long rc = RegCloseKey((HKEY)PyInt_AsLong(obHandle)); + else if (PyLong_Check(obHandle)) { + long rc = RegCloseKey((HKEY)PyLong_AsLong(obHandle)); ok = (rc == ERROR_SUCCESS); if (!ok) PyErr_SetFromWindowsErrWithFunction(rc, "RegCloseKey"); @@ -810,9 +810,9 @@ Reg2Py(BYTE *retDataBuf, DWORD retDataSize, DWORD typ) switch (typ) { case REG_DWORD: if (retDataSize == 0) - obData = PyInt_FromLong(0); + obData = PyLong_FromLong(0); else - obData = PyInt_FromLong(*(int *)retDataBuf); + obData = PyLong_FromLong(*(int *)retDataBuf); break; case REG_SZ: case REG_EXPAND_SZ: @@ -1362,7 +1362,7 @@ static struct PyMethodDef winreg_methods[] = { static void insint(PyObject * d, char * name, long value) { - PyObject *v = PyInt_FromLong(value); + PyObject *v = PyLong_FromLong(value); if (!v || PyDict_SetItemString(d, name, v)) PyErr_Clear(); Py_XDECREF(v); diff --git a/PC/msvcrtmodule.c b/PC/msvcrtmodule.c index ef73c6f..ae6b911 100755 --- a/PC/msvcrtmodule.c +++ b/PC/msvcrtmodule.c @@ -74,7 +74,7 @@ msvcrt_setmode(PyObject *self, PyObject *args) if (flags == -1) return PyErr_SetFromErrno(PyExc_IOError); - return PyInt_FromLong(flags); + return PyLong_FromLong(flags); } // Convert an OS file handle to a C runtime file descriptor. @@ -92,7 +92,7 @@ msvcrt_open_osfhandle(PyObject *self, PyObject *args) if (fd == -1) return PyErr_SetFromErrno(PyExc_IOError); - return PyInt_FromLong(fd); + return PyLong_FromLong(fd); } // Convert a C runtime file descriptor to an OS file handle. @@ -126,7 +126,7 @@ msvcrt_kbhit(PyObject *self, PyObject *args) return NULL; ok = _kbhit(); - return PyInt_FromLong(ok); + return PyLong_FromLong(ok); } static PyObject * @@ -192,7 +192,7 @@ msvcrt_ungetch(PyObject *self, PyObject *args) static void insertint(PyObject *d, char *name, int value) { - PyObject *v = PyInt_FromLong((long) value); + PyObject *v = PyLong_FromLong((long) value); if (v == NULL) { /* Don't bother reporting this error */ PyErr_Clear(); @@ -214,7 +214,7 @@ msvcrt_setreportfile(PyObject *self, PyObject *args) if (!PyArg_ParseTuple(args, "ii", &type, &file)) return NULL; res = _CrtSetReportFile(type, (_HFILE)file); - return PyInt_FromLong((long)res); + return PyLong_FromLong((long)res); Py_INCREF(Py_None); return Py_None; } diff --git a/Python/Python-ast.c b/Python/Python-ast.c index 0ccf489..c46176c 100644 --- a/Python/Python-ast.c +++ b/Python/Python-ast.c @@ -464,7 +464,7 @@ static PyObject* ast2obj_object(void *o) static PyObject* ast2obj_int(long b) { - return PyInt_FromLong(b); + return PyLong_FromLong(b); } static int init_types(void) diff --git a/Python/ast.c b/Python/ast.c index da75975..6ad43dd 100644 --- a/Python/ast.c +++ b/Python/ast.c @@ -110,7 +110,7 @@ ast_error_finish(const char *filename) if (!errstr) return; Py_INCREF(errstr); - lineno = PyInt_AsLong(PyTuple_GetItem(value, 1)); + lineno = PyLong_AsLong(PyTuple_GetItem(value, 1)); if (lineno == -1) { Py_DECREF(errstr); return; @@ -3074,7 +3074,7 @@ parsenumber(const char *s) if (*end == '\0') { if (errno != 0) return PyLong_FromString((char *)s, (char **)0, 0); - return PyInt_FromLong(x); + return PyLong_FromLong(x); } /* XXX Huge floats may silently fail */ #ifndef WITHOUT_COMPLEX diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c index 053e083..b57083b 100644 --- a/Python/bltinmodule.c +++ b/Python/bltinmodule.c @@ -378,7 +378,7 @@ builtin_cmp(PyObject *self, PyObject *args) return NULL; if (PyObject_Cmp(a, b, &c) < 0) return NULL; - return PyInt_FromLong((long)c); + return PyLong_FromLong((long)c); } PyDoc_STRVAR(cmp_doc, @@ -890,7 +890,7 @@ builtin_hash(PyObject *self, PyObject *v) x = PyObject_Hash(v); if (x == -1) return NULL; - return PyInt_FromLong(x); + return PyLong_FromLong(x); } PyDoc_STRVAR(hash_doc, @@ -946,7 +946,7 @@ builtin_len(PyObject *self, PyObject *v) res = PyObject_Size(v); if (res < 0 && PyErr_Occurred()) return NULL; - return PyInt_FromSsize_t(res); + return PyLong_FromSsize_t(res); } PyDoc_STRVAR(len_doc, @@ -1105,14 +1105,14 @@ builtin_ord(PyObject *self, PyObject* obj) size = PyString_GET_SIZE(obj); if (size == 1) { ord = (long)((unsigned char)*PyString_AS_STRING(obj)); - return PyInt_FromLong(ord); + return PyLong_FromLong(ord); } } else if (PyUnicode_Check(obj)) { size = PyUnicode_GET_SIZE(obj); if (size == 1) { ord = (long)*PyUnicode_AS_UNICODE(obj); - return PyInt_FromLong(ord); + return PyLong_FromLong(ord); } #ifndef Py_UNICODE_WIDE if (size == 2) { @@ -1123,7 +1123,7 @@ builtin_ord(PyObject *self, PyObject* obj) 0xDC00 <= c1 && c1 <= 0xDFFF) { ord = ((((c0 & 0x03FF) << 10) | (c1 & 0x03FF)) + 0x00010000); - return PyInt_FromLong(ord); + return PyLong_FromLong(ord); } } #endif @@ -1133,7 +1133,7 @@ builtin_ord(PyObject *self, PyObject* obj) size = PyBytes_GET_SIZE(obj); if (size == 1) { ord = (long)((unsigned char)*PyBytes_AS_STRING(obj)); - return PyInt_FromLong(ord); + return PyLong_FromLong(ord); } } else { @@ -1300,7 +1300,7 @@ builtin_input(PyObject *self, PyObject *args) tty = 0; } else { - fd = PyInt_AsLong(tmp); + fd = PyLong_AsLong(tmp); Py_DECREF(tmp); if (fd < 0 && PyErr_Occurred()) return NULL; @@ -1311,7 +1311,7 @@ builtin_input(PyObject *self, PyObject *args) if (tmp == NULL) PyErr_Clear(); else { - fd = PyInt_AsLong(tmp); + fd = PyLong_AsLong(tmp); Py_DECREF(tmp); if (fd < 0 && PyErr_Occurred()) return NULL; @@ -1595,7 +1595,7 @@ builtin_sum(PyObject *self, PyObject *args) return NULL; if (result == NULL) { - result = PyInt_FromLong(0); + result = PyLong_FromLong(0); if (result == NULL) { Py_DECREF(iter); return NULL; @@ -1624,7 +1624,7 @@ builtin_sum(PyObject *self, PyObject *args) to the more general routine. */ if (PyInt_CheckExact(result)) { - long i_result = PyInt_AS_LONG(result); + long i_result = PyLong_AS_LONG(result); Py_DECREF(result); result = NULL; while(result == NULL) { @@ -1633,10 +1633,10 @@ builtin_sum(PyObject *self, PyObject *args) Py_DECREF(iter); if (PyErr_Occurred()) return NULL; - return PyInt_FromLong(i_result); + return PyLong_FromLong(i_result); } if (PyInt_CheckExact(item)) { - long b = PyInt_AS_LONG(item); + long b = PyLong_AS_LONG(item); long x = i_result + b; if ((x^i_result) >= 0 || (x^b) >= 0) { i_result = x; @@ -1645,7 +1645,7 @@ builtin_sum(PyObject *self, PyObject *args) } } /* Either overflowed or is not an int. Restore real objects and process normally */ - result = PyInt_FromLong(i_result); + result = PyLong_FromLong(i_result); temp = PyNumber_Add(result, item); Py_DECREF(result); Py_DECREF(item); @@ -1678,7 +1678,7 @@ builtin_sum(PyObject *self, PyObject *args) } if (PyInt_CheckExact(item)) { PyFPE_START_PROTECT("add", return 0) - f_result += (double)PyInt_AS_LONG(item); + f_result += (double)PyLong_AS_LONG(item); PyFPE_END_PROTECT(f_result) Py_DECREF(item); continue; diff --git a/Python/ceval.c b/Python/ceval.c index b4efa33..d223f5e 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -1121,12 +1121,12 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag) if (PyInt_CheckExact(v) && PyInt_CheckExact(w)) { /* INLINE: int + int */ register long a, b, i; - a = PyInt_AS_LONG(v); - b = PyInt_AS_LONG(w); + a = PyLong_AS_LONG(v); + b = PyLong_AS_LONG(w); i = a + b; if ((i^a) < 0 && (i^b) < 0) goto slow_add; - x = PyInt_FromLong(i); + x = PyLong_FromLong(i); } else if (PyUnicode_CheckExact(v) && PyUnicode_CheckExact(w)) { @@ -1151,12 +1151,12 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag) if (PyInt_CheckExact(v) && PyInt_CheckExact(w)) { /* INLINE: int - int */ register long a, b, i; - a = PyInt_AS_LONG(v); - b = PyInt_AS_LONG(w); + a = PyLong_AS_LONG(v); + b = PyLong_AS_LONG(w); i = a - b; if ((i^a) < 0 && (i^~b) < 0) goto slow_sub; - x = PyInt_FromLong(i); + x = PyLong_FromLong(i); } else { slow_sub: @@ -1173,7 +1173,7 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag) v = TOP(); if (PyList_CheckExact(v) && PyInt_CheckExact(w)) { /* INLINE: list[int] */ - Py_ssize_t i = PyInt_AsSsize_t(w); + Py_ssize_t i = PyLong_AsSsize_t(w); if (i < 0) i += PyList_GET_SIZE(v); if (i >= 0 && i < PyList_GET_SIZE(v)) { @@ -1322,12 +1322,12 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag) if (PyInt_CheckExact(v) && PyInt_CheckExact(w)) { /* INLINE: int + int */ register long a, b, i; - a = PyInt_AS_LONG(v); - b = PyInt_AS_LONG(w); + a = PyLong_AS_LONG(v); + b = PyLong_AS_LONG(w); i = a + b; if ((i^a) < 0 && (i^b) < 0) goto slow_iadd; - x = PyInt_FromLong(i); + x = PyLong_FromLong(i); } else if (PyUnicode_CheckExact(v) && PyUnicode_CheckExact(w)) { @@ -1352,12 +1352,12 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag) if (PyInt_CheckExact(v) && PyInt_CheckExact(w)) { /* INLINE: int - int */ register long a, b, i; - a = PyInt_AS_LONG(v); - b = PyInt_AS_LONG(w); + a = PyLong_AS_LONG(v); + b = PyLong_AS_LONG(w); i = a - b; if ((i^a) < 0 && (i^~b) < 0) goto slow_isub; - x = PyInt_FromLong(i); + x = PyLong_FromLong(i); } else { slow_isub: @@ -1518,8 +1518,8 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag) case END_FINALLY: v = POP(); - if (PyInt_Check(v)) { - why = (enum why_code) PyInt_AS_LONG(v); + if (PyLong_Check(v)) { + why = (enum why_code) PyLong_AS_LONG(v); assert(why != WHY_YIELD); if (why == WHY_RETURN || why == WHY_CONTINUE) @@ -1869,8 +1869,8 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag) /* INLINE: cmp(int, int) */ register long a, b; register int res; - a = PyInt_AS_LONG(v); - b = PyInt_AS_LONG(w); + a = PyLong_AS_LONG(v); + b = PyLong_AS_LONG(w); switch (oparg) { case PyCmp_LT: res = a < b; break; case PyCmp_LE: res = a <= b; break; @@ -1907,7 +1907,7 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag) } v = POP(); u = TOP(); - if (PyInt_AsLong(u) != -1 || PyErr_Occurred()) + if (PyLong_AsLong(u) != -1 || PyErr_Occurred()) w = PyTuple_Pack(5, w, f->f_globals, @@ -2066,7 +2066,7 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag) goto fast_block_end; case CONTINUE_LOOP: - retval = PyInt_FromLong(oparg); + retval = PyLong_FromLong(oparg); if (!retval) { x = NULL; break; @@ -2109,7 +2109,7 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag) x = TOP(); u = SECOND(); - if (PyInt_Check(u) || u == Py_None) { + if (PyLong_Check(u) || u == Py_None) { u = v = w = Py_None; } else { @@ -2392,7 +2392,7 @@ fast_block_end: PyFrame_BlockSetup(f, b->b_type, b->b_handler, b->b_level); why = WHY_NOT; - JUMPTO(PyInt_AS_LONG(retval)); + JUMPTO(PyLong_AS_LONG(retval)); Py_DECREF(retval); break; } @@ -2438,7 +2438,7 @@ fast_block_end: else { if (why & (WHY_RETURN | WHY_CONTINUE)) PUSH(retval); - v = PyInt_FromLong((long)why); + v = PyLong_FromLong((long)why); PUSH(v); } why = WHY_NOT; @@ -3797,11 +3797,11 @@ _PyEval_SliceIndex(PyObject *v, Py_ssize_t *pi) if (v != NULL) { Py_ssize_t x; if (PyInt_CheckExact(v)) { - /* XXX(nnorwitz): I think PyInt_AS_LONG is correct, + /* XXX(nnorwitz): I think PyLong_AS_LONG is correct, however, it looks like it should be AsSsize_t. There should be a comment here explaining why. */ - x = PyInt_AS_LONG(v); + x = PyLong_AS_LONG(v); } else if (PyIndex_Check(v)) { x = PyNumber_AsSsize_t(v, NULL); @@ -4051,7 +4051,7 @@ getarray(long a[256]) PyObject *l = PyList_New(256); if (l == NULL) return NULL; for (i = 0; i < 256; i++) { - PyObject *x = PyInt_FromLong(a[i]); + PyObject *x = PyLong_FromLong(a[i]); if (x == NULL) { Py_DECREF(l); return NULL; diff --git a/Python/compile.c b/Python/compile.c index 80c97eb..8951331 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -335,7 +335,7 @@ list2dict(PyObject *list) n = PyList_Size(list); for (i = 0; i < n; i++) { - v = PyInt_FromLong(i); + v = PyLong_FromLong(i); if (!v) { Py_DECREF(dict); return NULL; @@ -375,12 +375,12 @@ dictbytype(PyObject *src, int scope_type, int flag, int offset) while (PyDict_Next(src, &pos, &k, &v)) { /* XXX this should probably be a macro in symtable.h */ long vi; - assert(PyInt_Check(v)); - vi = PyInt_AS_LONG(v); + assert(PyLong_Check(v)); + vi = PyLong_AS_LONG(v); scope = (vi >> SCOPE_OFFSET) & SCOPE_MASK; if (scope == scope_type || vi & flag) { - PyObject *tuple, *item = PyInt_FromLong(i); + PyObject *tuple, *item = PyLong_FromLong(i); if (item == NULL) { Py_DECREF(dest); return NULL; @@ -907,7 +907,7 @@ compiler_add_o(struct compiler *c, PyObject *dict, PyObject *o) if (PyErr_Occurred()) return -1; arg = PyDict_Size(dict); - v = PyInt_FromLong(arg); + v = PyLong_FromLong(arg); if (!v) { Py_DECREF(t); return -1; @@ -920,7 +920,7 @@ compiler_add_o(struct compiler *c, PyObject *dict, PyObject *o) Py_DECREF(v); } else - arg = PyInt_AsLong(v); + arg = PyLong_AsLong(v); Py_DECREF(t); return arg; } @@ -1208,7 +1208,7 @@ compiler_lookup_arg(PyObject *dict, PyObject *name) Py_DECREF(k); if (v == NULL) return -1; - return PyInt_AS_LONG(v); + return PyLong_AS_LONG(v); } static int @@ -2065,7 +2065,7 @@ compiler_import(struct compiler *c, stmt_ty s) int r; PyObject *level; - level = PyInt_FromLong(0); + level = PyLong_FromLong(0); if (level == NULL) return 0; @@ -2108,7 +2108,7 @@ compiler_from_import(struct compiler *c, stmt_ty s) if (!names) return 0; - level = PyInt_FromLong(s->v.ImportFrom.level); + level = PyLong_FromLong(s->v.ImportFrom.level); if (!level) { Py_DECREF(names); return 0; @@ -3916,7 +3916,7 @@ dict_keys_inorder(PyObject *dict, int offset) if (tuple == NULL) return NULL; while (PyDict_Next(dict, &pos, &k, &v)) { - i = PyInt_AS_LONG(v); + i = PyLong_AS_LONG(v); k = PyTuple_GET_ITEM(k, 0); Py_INCREF(k); assert((i - offset) < size); diff --git a/Python/errors.c b/Python/errors.c index 063187b..79f711d 100644 --- a/Python/errors.c +++ b/Python/errors.c @@ -752,7 +752,7 @@ PyErr_SyntaxLocation(const char *filename, int lineno) PyErr_NormalizeException(&exc, &v, &tb); /* XXX check that it is, indeed, a syntax error. It might not * be, though. */ - tmp = PyInt_FromLong(lineno); + tmp = PyLong_FromLong(lineno); if (tmp == NULL) PyErr_Clear(); else { diff --git a/Python/getargs.c b/Python/getargs.c index f6cdd7c..aeeb04c 100644 --- a/Python/getargs.c +++ b/Python/getargs.c @@ -556,7 +556,7 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags, long ival; if (float_argument_error(arg)) return converterr("integer", arg, msgbuf, bufsize); - ival = PyInt_AsLong(arg); + ival = PyLong_AsLong(arg); if (ival == -1 && PyErr_Occurred()) return converterr("integer", arg, msgbuf, bufsize); else if (ival < 0) { @@ -580,7 +580,7 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags, long ival; if (float_argument_error(arg)) return converterr("integer", arg, msgbuf, bufsize); - ival = PyInt_AsUnsignedLongMask(arg); + ival = PyLong_AsUnsignedLongMask(arg); if (ival == -1 && PyErr_Occurred()) return converterr("integer", arg, msgbuf, bufsize); else @@ -593,7 +593,7 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags, long ival; if (float_argument_error(arg)) return converterr("integer", arg, msgbuf, bufsize); - ival = PyInt_AsLong(arg); + ival = PyLong_AsLong(arg); if (ival == -1 && PyErr_Occurred()) return converterr("integer", arg, msgbuf, bufsize); else if (ival < SHRT_MIN) { @@ -617,7 +617,7 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags, long ival; if (float_argument_error(arg)) return converterr("integer", arg, msgbuf, bufsize); - ival = PyInt_AsUnsignedLongMask(arg); + ival = PyLong_AsUnsignedLongMask(arg); if (ival == -1 && PyErr_Occurred()) return converterr("integer", arg, msgbuf, bufsize); else @@ -630,7 +630,7 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags, long ival; if (float_argument_error(arg)) return converterr("integer", arg, msgbuf, bufsize); - ival = PyInt_AsLong(arg); + ival = PyLong_AsLong(arg); if (ival == -1 && PyErr_Occurred()) return converterr("integer", arg, msgbuf, bufsize); else if (ival > INT_MAX) { @@ -654,7 +654,7 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags, unsigned int ival; if (float_argument_error(arg)) return converterr("integer", arg, msgbuf, bufsize); - ival = (unsigned int)PyInt_AsUnsignedLongMask(arg); + ival = (unsigned int)PyLong_AsUnsignedLongMask(arg); if (ival == (unsigned int)-1 && PyErr_Occurred()) return converterr("integer", arg, msgbuf, bufsize); else @@ -672,7 +672,7 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags, return converterr("integer", arg, msgbuf, bufsize); iobj = PyNumber_Index(arg); if (iobj != NULL) - ival = PyInt_AsSsize_t(arg); + ival = PyLong_AsSsize_t(arg); if (ival == -1 && PyErr_Occurred()) return converterr("integer", arg, msgbuf, bufsize); *p = ival; @@ -685,7 +685,7 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags, long ival; if (float_argument_error(arg)) return converterr("integer", arg, msgbuf, bufsize); - ival = PyInt_AsLong(arg); + ival = PyLong_AsLong(arg); if (ival == -1 && PyErr_Occurred()) return converterr("integer", arg, msgbuf, bufsize); else diff --git a/Python/import.c b/Python/import.c index 419f3e9..221c2dd 100644 --- a/Python/import.c +++ b/Python/import.c @@ -2687,7 +2687,7 @@ imp_is_builtin(PyObject *self, PyObject *args) char *name; if (!PyArg_ParseTuple(args, "s:is_builtin", &name)) return NULL; - return PyInt_FromLong(is_builtin(name)); + return PyLong_FromLong(is_builtin(name)); } static PyObject * @@ -2921,7 +2921,7 @@ setint(PyObject *d, char *name, int value) PyObject *v; int err; - v = PyInt_FromLong((long)value); + v = PyLong_FromLong((long)value); err = PyDict_SetItemString(d, name, v); Py_XDECREF(v); return err; diff --git a/Python/mactoolboxglue.c b/Python/mactoolboxglue.c index 454553e..6688b02 100644 --- a/Python/mactoolboxglue.c +++ b/Python/mactoolboxglue.c @@ -348,9 +348,9 @@ PyMac_BuildFixed(Fixed f) int PyMac_Getwide(PyObject *v, wide *rv) { - if (PyInt_Check(v)) { + if (PyLong_Check(v)) { rv->hi = 0; - rv->lo = PyInt_AsLong(v); + rv->lo = PyLong_AsLong(v); if( rv->lo & 0x80000000 ) rv->hi = -1; return 1; @@ -364,7 +364,7 @@ PyMac_Buildwide(wide *w) { if ( (w->hi == 0 && (w->lo & 0x80000000) == 0) || (w->hi == -1 && (w->lo & 0x80000000) ) ) - return PyInt_FromLong(w->lo); + return PyLong_FromLong(w->lo); return Py_BuildValue("(ll)", w->hi, w->lo); } diff --git a/Python/marshal.c b/Python/marshal.c index 3e106c2..c06ef8b 100644 --- a/Python/marshal.c +++ b/Python/marshal.c @@ -460,7 +460,7 @@ r_long64(RFILE *p) long hi4 = r_long(p); #if SIZEOF_LONG > 4 long x = (hi4 << 32) | (lo4 & 0xFFFFFFFFL); - return PyInt_FromLong(x); + return PyLong_FromLong(x); #else unsigned char buf[8]; int one = 1; @@ -533,7 +533,7 @@ r_object(RFILE *p) break; case TYPE_INT: - retval = PyInt_FromLong(r_long(p)); + retval = PyLong_FromLong(r_long(p)); break; case TYPE_INT64: diff --git a/Python/modsupport.c b/Python/modsupport.c index 144fb4f..aca57a4 100644 --- a/Python/modsupport.c +++ b/Python/modsupport.c @@ -307,10 +307,10 @@ do_mkvalue(const char **p_format, va_list *p_va, int flags) case 'B': case 'h': case 'i': - return PyInt_FromLong((long)va_arg(*p_va, int)); + return PyLong_FromLong((long)va_arg(*p_va, int)); case 'H': - return PyInt_FromLong((long)va_arg(*p_va, unsigned int)); + return PyLong_FromLong((long)va_arg(*p_va, unsigned int)); case 'I': { @@ -319,16 +319,16 @@ do_mkvalue(const char **p_format, va_list *p_va, int flags) if (n > (unsigned long)PyInt_GetMax()) return PyLong_FromUnsignedLong((unsigned long)n); else - return PyInt_FromLong(n); + return PyLong_FromLong(n); } case 'n': #if SIZEOF_SIZE_T!=SIZEOF_LONG - return PyInt_FromSsize_t(va_arg(*p_va, Py_ssize_t)); + return PyLong_FromSsize_t(va_arg(*p_va, Py_ssize_t)); #endif /* Fall through from 'n' to 'l' if Py_ssize_t is long */ case 'l': - return PyInt_FromLong(va_arg(*p_va, long)); + return PyLong_FromLong(va_arg(*p_va, long)); case 'k': { @@ -337,7 +337,7 @@ do_mkvalue(const char **p_format, va_list *p_va, int flags) if (n > (unsigned long)PyInt_GetMax()) return PyLong_FromUnsignedLong(n); else - return PyInt_FromLong(n); + return PyLong_FromLong(n); } #ifdef HAVE_LONG_LONG @@ -702,7 +702,7 @@ PyModule_AddObject(PyObject *m, const char *name, PyObject *o) int PyModule_AddIntConstant(PyObject *m, const char *name, long value) { - return PyModule_AddObject(m, name, PyInt_FromLong(value)); + return PyModule_AddObject(m, name, PyLong_FromLong(value)); } int diff --git a/Python/pystate.c b/Python/pystate.c index 1914ba8..030138d 100644 --- a/Python/pystate.c +++ b/Python/pystate.c @@ -445,7 +445,7 @@ _PyThread_CurrentFrames(void) struct _frame *frame = t->frame; if (frame == NULL) continue; - id = PyInt_FromLong(t->thread_id); + id = PyLong_FromLong(t->thread_id); if (id == NULL) goto Fail; stat = PyDict_SetItem(result, id, (PyObject *)frame); diff --git a/Python/pythonrun.c b/Python/pythonrun.c index d1a062b..f46b90e 100644 --- a/Python/pythonrun.c +++ b/Python/pythonrun.c @@ -1109,7 +1109,7 @@ parse_syntax_error(PyObject *err, PyObject **message, const char **filename, Py_DECREF(v); if (!(v = PyObject_GetAttrString(err, "lineno"))) goto finally; - hold = PyInt_AsLong(v); + hold = PyLong_AsLong(v); Py_DECREF(v); v = NULL; if (hold < 0 && PyErr_Occurred()) @@ -1123,7 +1123,7 @@ parse_syntax_error(PyObject *err, PyObject **message, const char **filename, Py_DECREF(v); v = NULL; } else { - hold = PyInt_AsLong(v); + hold = PyLong_AsLong(v); Py_DECREF(v); v = NULL; if (hold < 0 && PyErr_Occurred()) @@ -1213,8 +1213,8 @@ handle_system_exit(void) /* If we failed to dig out the 'code' attribute, just let the else clause below print the error. */ } - if (PyInt_Check(value)) - exitcode = (int)PyInt_AsLong(value); + if (PyLong_Check(value)) + exitcode = (int)PyLong_AsLong(value); else { PyObject_Print(value, stderr, Py_PRINT_RAW); PySys_WriteStderr("\n"); diff --git a/Python/structmember.c b/Python/structmember.c index c4b7d80..f8588cc 100644 --- a/Python/structmember.c +++ b/Python/structmember.c @@ -13,31 +13,31 @@ PyMember_GetOne(const char *addr, PyMemberDef *l) addr += l->offset; switch (l->type) { case T_BYTE: - v = PyInt_FromLong(*(char*)addr); + v = PyLong_FromLong(*(char*)addr); break; case T_UBYTE: v = PyLong_FromUnsignedLong(*(unsigned char*)addr); break; case T_SHORT: - v = PyInt_FromLong(*(short*)addr); + v = PyLong_FromLong(*(short*)addr); break; case T_USHORT: v = PyLong_FromUnsignedLong(*(unsigned short*)addr); break; case T_INT: - v = PyInt_FromLong(*(int*)addr); + v = PyLong_FromLong(*(int*)addr); break; case T_UINT: v = PyLong_FromUnsignedLong(*(unsigned int*)addr); break; case T_LONG: - v = PyInt_FromLong(*(long*)addr); + v = PyLong_FromLong(*(long*)addr); break; case T_ULONG: v = PyLong_FromUnsignedLong(*(unsigned long*)addr); break; case T_PYSSIZET: - v = PyInt_FromSsize_t(*(Py_ssize_t*)addr); + v = PyLong_FromSsize_t(*(Py_ssize_t*)addr); break; case T_FLOAT: v = PyFloat_FromDouble((double)*(float*)addr); @@ -114,7 +114,7 @@ PyMember_SetOne(char *addr, PyMemberDef *l, PyObject *v) addr += l->offset; switch (l->type) { case T_BYTE:{ - long long_val = PyInt_AsLong(v); + long long_val = PyLong_AsLong(v); if ((long_val == -1) && PyErr_Occurred()) return -1; *(char*)addr = (char)long_val; @@ -125,7 +125,7 @@ PyMember_SetOne(char *addr, PyMemberDef *l, PyObject *v) break; } case T_UBYTE:{ - long long_val = PyInt_AsLong(v); + long long_val = PyLong_AsLong(v); if ((long_val == -1) && PyErr_Occurred()) return -1; *(unsigned char*)addr = (unsigned char)long_val; @@ -134,7 +134,7 @@ PyMember_SetOne(char *addr, PyMemberDef *l, PyObject *v) break; } case T_SHORT:{ - long long_val = PyInt_AsLong(v); + long long_val = PyLong_AsLong(v); if ((long_val == -1) && PyErr_Occurred()) return -1; *(short*)addr = (short)long_val; @@ -143,7 +143,7 @@ PyMember_SetOne(char *addr, PyMemberDef *l, PyObject *v) break; } case T_USHORT:{ - long long_val = PyInt_AsLong(v); + long long_val = PyLong_AsLong(v); if ((long_val == -1) && PyErr_Occurred()) return -1; *(unsigned short*)addr = (unsigned short)long_val; @@ -152,7 +152,7 @@ PyMember_SetOne(char *addr, PyMemberDef *l, PyObject *v) break; } case T_INT:{ - long long_val = PyInt_AsLong(v); + long long_val = PyLong_AsLong(v); if ((long_val == -1) && PyErr_Occurred()) return -1; *(int *)addr = (int)long_val; @@ -199,7 +199,7 @@ PyMember_SetOne(char *addr, PyMemberDef *l, PyObject *v) break; } case T_PYSSIZET:{ - *(Py_ssize_t*)addr = PyInt_AsSsize_t(v); + *(Py_ssize_t*)addr = PyLong_AsSsize_t(v); if ((*(Py_ssize_t*)addr == (Py_ssize_t)-1) && PyErr_Occurred()) return -1; @@ -248,7 +248,7 @@ PyMember_SetOne(char *addr, PyMemberDef *l, PyObject *v) if (PyLong_Check(v)) *(unsigned PY_LONG_LONG*)addr = value = PyLong_AsUnsignedLongLong(v); else - *(unsigned PY_LONG_LONG*)addr = value = PyInt_AsLong(v); + *(unsigned PY_LONG_LONG*)addr = value = PyLong_AsLong(v); if ((value == (unsigned PY_LONG_LONG)-1) && PyErr_Occurred()) return -1; break; diff --git a/Python/symtable.c b/Python/symtable.c index 968fe25..84d0067 100644 --- a/Python/symtable.c +++ b/Python/symtable.c @@ -90,7 +90,7 @@ ste_repr(PySTEntryObject *ste) { return PyUnicode_FromFormat("", ste->ste_name, - PyInt_AS_LONG(ste->ste_id), ste->ste_lineno); + PyLong_AS_LONG(ste->ste_id), ste->ste_lineno); } static void @@ -310,8 +310,8 @@ PyST_GetScope(PySTEntryObject *ste, PyObject *name) PyObject *v = PyDict_GetItem(ste->ste_symbols, name); if (!v) return 0; - assert(PyInt_Check(v)); - return (PyInt_AS_LONG(v) >> SCOPE_OFFSET) & SCOPE_MASK; + assert(PyLong_Check(v)); + return (PyLong_AS_LONG(v) >> SCOPE_OFFSET) & SCOPE_MASK; } @@ -361,7 +361,7 @@ PyST_GetScope(PySTEntryObject *ste, PyObject *name) */ #define SET_SCOPE(DICT, NAME, I) { \ - PyObject *o = PyInt_FromLong(I); \ + PyObject *o = PyLong_FromLong(I); \ if (!o) \ return 0; \ if (PyDict_SetItem((DICT), (NAME), o) < 0) { \ @@ -476,13 +476,13 @@ analyze_cells(PyObject *scopes, PyObject *free, const char *restricted) int success = 0; Py_ssize_t pos = 0; - v_cell = PyInt_FromLong(CELL); + v_cell = PyLong_FromLong(CELL); if (!v_cell) return 0; while (PyDict_Next(scopes, &pos, &name, &v)) { long scope; - assert(PyInt_Check(v)); - scope = PyInt_AS_LONG(v); + assert(PyLong_Check(v)); + scope = PyLong_AS_LONG(v); if (scope != LOCAL) continue; if (!PySet_Contains(free, name)) @@ -548,13 +548,13 @@ update_symbols(PyObject *symbols, PyObject *scopes, /* Update scope information for all symbols in this scope */ while (PyDict_Next(symbols, &pos, &name, &v)) { long scope, flags; - assert(PyInt_Check(v)); - flags = PyInt_AS_LONG(v); + assert(PyLong_Check(v)); + flags = PyLong_AS_LONG(v); v_scope = PyDict_GetItem(scopes, name); - assert(v_scope && PyInt_Check(v_scope)); - scope = PyInt_AS_LONG(v_scope); + assert(v_scope && PyLong_Check(v_scope)); + scope = PyLong_AS_LONG(v_scope); flags |= (scope << SCOPE_OFFSET); - v_new = PyInt_FromLong(flags); + v_new = PyLong_FromLong(flags); if (!v_new) return 0; if (PyDict_SetItem(symbols, name, v_new) < 0) { @@ -565,7 +565,7 @@ update_symbols(PyObject *symbols, PyObject *scopes, } /* Record not yet resolved free variables from children (if any) */ - v_free = PyInt_FromLong(FREE << SCOPE_OFFSET); + v_free = PyLong_FromLong(FREE << SCOPE_OFFSET); if (!v_free) return 0; @@ -583,9 +583,9 @@ update_symbols(PyObject *symbols, PyObject *scopes, or global in the class scope. */ if (classflag && - PyInt_AS_LONG(v) & (DEF_BOUND | DEF_GLOBAL)) { - long flags = PyInt_AS_LONG(v) | DEF_FREE_CLASS; - v_new = PyInt_FromLong(flags); + PyLong_AS_LONG(v) & (DEF_BOUND | DEF_GLOBAL)) { + long flags = PyLong_AS_LONG(v) | DEF_FREE_CLASS; + v_new = PyLong_FromLong(flags); if (!v_new) { goto error; } @@ -675,7 +675,7 @@ analyze_block(PySTEntryObject *ste, PyObject *bound, PyObject *free, assert(PySTEntry_Check(ste)); assert(PyDict_Check(ste->ste_symbols)); while (PyDict_Next(ste->ste_symbols, &pos, &name, &v)) { - long flags = PyInt_AS_LONG(v); + long flags = PyLong_AS_LONG(v); if (!analyze_name(ste, scopes, name, flags, bound, local, free, global)) goto error; @@ -849,7 +849,7 @@ symtable_lookup(struct symtable *st, PyObject *name) Py_DECREF(mangled); if (!o) return 0; - return PyInt_AsLong(o); + return PyLong_AsLong(o); } static int @@ -865,7 +865,7 @@ symtable_add_def(struct symtable *st, PyObject *name, int flag) return 0; dict = st->st_cur->ste_symbols; if ((o = PyDict_GetItem(dict, mangled))) { - val = PyInt_AS_LONG(o); + val = PyLong_AS_LONG(o); if ((flag & DEF_PARAM) && (val & DEF_PARAM)) { /* Is it better to use 'mangled' or 'name' here? */ PyErr_Format(PyExc_SyntaxError, DUPLICATE_ARGUMENT, name); @@ -876,7 +876,7 @@ symtable_add_def(struct symtable *st, PyObject *name, int flag) val |= flag; } else val = flag; - o = PyInt_FromLong(val); + o = PyLong_FromLong(val); if (o == NULL) goto error; if (PyDict_SetItem(dict, mangled, o) < 0) { @@ -893,9 +893,9 @@ symtable_add_def(struct symtable *st, PyObject *name, int flag) perhaps only DEF_FREE_GLOBAL */ val = flag; if ((o = PyDict_GetItem(st->st_global, mangled))) { - val |= PyInt_AS_LONG(o); + val |= PyLong_AS_LONG(o); } - o = PyInt_FromLong(val); + o = PyLong_FromLong(val); if (o == NULL) goto error; if (PyDict_SetItem(st->st_global, mangled, o) < 0) { diff --git a/Python/sysmodule.c b/Python/sysmodule.c index e793707..e77b1f6 100644 --- a/Python/sysmodule.c +++ b/Python/sysmodule.c @@ -411,7 +411,7 @@ n instructions. This also affects how often thread switches occur." static PyObject * sys_getcheckinterval(PyObject *self, PyObject *args) { - return PyInt_FromLong(_Py_CheckInterval); + return PyLong_FromLong(_Py_CheckInterval); } PyDoc_STRVAR(getcheckinterval_doc, @@ -473,7 +473,7 @@ dependent." static PyObject * sys_getrecursionlimit(PyObject *self) { - return PyInt_FromLong(Py_GetRecursionLimit()); + return PyLong_FromLong(Py_GetRecursionLimit()); } PyDoc_STRVAR(getrecursionlimit_doc, @@ -543,7 +543,7 @@ sys_getdlopenflags(PyObject *self, PyObject *args) PyThreadState *tstate = PyThreadState_GET(); if (!tstate) return NULL; - return PyInt_FromLong(tstate->interp->dlopenflags); + return PyLong_FromLong(tstate->interp->dlopenflags); } PyDoc_STRVAR(getdlopenflags_doc, @@ -573,14 +573,14 @@ sys_mdebug(PyObject *self, PyObject *args) static PyObject * sys_getrefcount(PyObject *self, PyObject *arg) { - return PyInt_FromSsize_t(arg->ob_refcnt); + return PyLong_FromSsize_t(arg->ob_refcnt); } #ifdef Py_REF_DEBUG static PyObject * sys_gettotalrefcount(PyObject *self) { - return PyInt_FromSsize_t(_Py_GetRefTotal()); + return PyLong_FromSsize_t(_Py_GetRefTotal()); } #endif /* Py_REF_DEBUG */ @@ -1034,7 +1034,7 @@ _PySys_Init(void) v = PyUnicode_FromString(Py_GetVersion())); Py_XDECREF(v); PyDict_SetItemString(sysdict, "hexversion", - v = PyInt_FromLong(PY_VERSION_HEX)); + v = PyLong_FromLong(PY_VERSION_HEX)); Py_XDECREF(v); svnversion_init(); v = Py_BuildValue("(UUU)", "CPython", branch, svn_revision); @@ -1066,7 +1066,7 @@ _PySys_Init(void) PY_MICRO_VERSION, s, PY_RELEASE_SERIAL)); SET_SYS_FROM_STRING("api_version", - PyInt_FromLong(PYTHON_API_VERSION)); + PyLong_FromLong(PYTHON_API_VERSION)); SET_SYS_FROM_STRING("copyright", PyUnicode_FromString(Py_GetCopyright())); SET_SYS_FROM_STRING("platform", @@ -1079,13 +1079,13 @@ _PySys_Init(void) SET_SYS_FROM_STRING("exec_prefix", PyUnicode_DecodeFSDefault(Py_GetExecPrefix())); SET_SYS_FROM_STRING("maxint", - PyInt_FromLong(PyInt_GetMax())); + PyLong_FromLong(PyInt_GetMax())); SET_SYS_FROM_STRING("maxsize", - PyInt_FromSsize_t(PY_SSIZE_T_MAX)); + PyLong_FromSsize_t(PY_SSIZE_T_MAX)); SET_SYS_FROM_STRING("float_info", PyFloat_GetInfo()); SET_SYS_FROM_STRING("maxunicode", - PyInt_FromLong(PyUnicode_GetMax())); + PyLong_FromLong(PyUnicode_GetMax())); SET_SYS_FROM_STRING("builtin_module_names", list_builtin_module_names()); { diff --git a/Python/traceback.c b/Python/traceback.c index 9d7a2e0..df2a3a3 100644 --- a/Python/traceback.c +++ b/Python/traceback.c @@ -256,7 +256,7 @@ PyTraceBack_Print(PyObject *v, PyObject *f) } limitv = PySys_GetObject("tracebacklimit"); if (limitv && PyInt_CheckExact(limitv)) { - limit = PyInt_AsLong(limitv); + limit = PyLong_AsLong(limitv); if (limit <= 0) return 0; } -- cgit v0.12