Cleanup: Replaced most PyInt_ aliases with PyLong_ and disabled the aliases in intobject.h

This commit is contained in:
Christian Heimes 2007-12-02 14:31:20 +00:00
parent 1a3284ed69
commit 217cfd1c86
123 changed files with 888 additions and 885 deletions

View File

@ -48,7 +48,7 @@ main(int argc, char **argv)
static PyObject * static PyObject *
xyzzy_foo(PyObject *self, PyObject* args) xyzzy_foo(PyObject *self, PyObject* args)
{ {
return PyInt_FromLong(42L); return PyLong_FromLong(42L);
} }
static PyMethodDef xyzzy_methods[] = { static PyMethodDef xyzzy_methods[] = {

View File

@ -26,7 +26,7 @@ main(int argc, char *argv[])
if (pFunc && PyCallable_Check(pFunc)) { if (pFunc && PyCallable_Check(pFunc)) {
pArgs = PyTuple_New(argc - 3); pArgs = PyTuple_New(argc - 3);
for (i = 0; i < argc - 3; ++i) { for (i = 0; i < argc - 3; ++i) {
pValue = PyInt_FromLong(atoi(argv[i + 3])); pValue = PyLong_FromLong(atoi(argv[i + 3]));
if (!pValue) { if (!pValue) {
Py_DECREF(pArgs); Py_DECREF(pArgs);
Py_DECREF(pModule); Py_DECREF(pModule);
@ -39,7 +39,7 @@ main(int argc, char *argv[])
pValue = PyObject_CallObject(pFunc, pArgs); pValue = PyObject_CallObject(pFunc, pArgs);
Py_DECREF(pArgs); Py_DECREF(pArgs);
if (pValue != NULL) { if (pValue != NULL) {
printf("Result of call: %ld\n", PyInt_AsLong(pValue)); printf("Result of call: %ld\n", PyLong_AsLong(pValue));
Py_DECREF(pValue); Py_DECREF(pValue);
} }
else { else {

View File

@ -10,7 +10,7 @@ static PyObject *
Shoddy_increment(Shoddy *self, PyObject *unused) Shoddy_increment(Shoddy *self, PyObject *unused)
{ {
self->state++; self->state++;
return PyInt_FromLong(self->state); return PyLong_FromLong(self->state);
} }

View File

@ -29,23 +29,24 @@ typedef struct {
PyAPI_DATA(PyTypeObject) PyInt_Type; PyAPI_DATA(PyTypeObject) PyInt_Type;
*/ */
#define PyInt_Check(op) PyLong_Check(op)
#define PyInt_CheckExact(op) (PyLong_CheckExact(op) && _PyLong_FitsInLong(op)) #define PyInt_CheckExact(op) (PyLong_CheckExact(op) && _PyLong_FitsInLong(op))
#define PyInt_FromString PyLong_FromString #ifdef 0
#define PyInt_FromUnicode PyLong_FromUnicode # define PyInt_Check(op) PyLong_Check(op)
#define PyInt_FromLong PyLong_FromLong # define PyInt_FromString PyLong_FromString
#define PyInt_FromSize_t PyLong_FromSize_t # define PyInt_FromUnicode PyLong_FromUnicode
#define PyInt_FromSsize_t PyLong_FromSsize_t # define PyInt_FromLong PyLong_FromLong
#define PyInt_AsLong PyLong_AsLong # define PyInt_FromSize_t PyLong_FromSize_t
#define PyInt_AsSsize_t PyLong_AsSsize_t # define PyInt_FromSsize_t PyLong_FromSsize_t
#define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask # define PyInt_AsLong PyLong_AsLong
#define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask # 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); 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 /* 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. * are necessary for systems that need the magic of PyAPI_FUNC.
*/ */

View File

@ -26,6 +26,10 @@ PyAPI_FUNC(size_t) PyLong_AsSize_t(PyObject *);
PyAPI_FUNC(unsigned long) PyLong_AsUnsignedLong(PyObject *); PyAPI_FUNC(unsigned long) PyLong_AsUnsignedLong(PyObject *);
PyAPI_FUNC(unsigned long) PyLong_AsUnsignedLongMask(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 */ /* Used by socketmodule.c */
#if SIZEOF_SOCKET_T <= SIZEOF_LONG #if SIZEOF_SOCKET_T <= SIZEOF_LONG
#define PyLong_FromSocket_t(fd) PyLong_FromLong((SOCKET_T)(fd)) #define PyLong_FromSocket_t(fd) PyLong_FromLong((SOCKET_T)(fd))

View File

@ -139,7 +139,7 @@ static PyObject *PyCurses_ ## X (PyObject *self, PyObject *args) \
static PyObject *PyCurses_ ## X (PyObject *self) \ static PyObject *PyCurses_ ## X (PyObject *self) \
{ \ { \
PyCursesInitialised \ PyCursesInitialised \
return PyInt_FromLong((long) X()); } return PyLong_FromLong((long) X()); }
#define NoArgReturnStringFunction(X) \ #define NoArgReturnStringFunction(X) \

View File

@ -125,7 +125,6 @@ PyAPI_FUNC(void) _PyImport_Init(void);
PyAPI_FUNC(void) _PyExc_Init(void); PyAPI_FUNC(void) _PyExc_Init(void);
PyAPI_FUNC(void) _PyImportHooks_Init(void); PyAPI_FUNC(void) _PyImportHooks_Init(void);
PyAPI_FUNC(int) _PyFrame_Init(void); PyAPI_FUNC(int) _PyFrame_Init(void);
PyAPI_FUNC(int) _PyInt_Init(void);
PyAPI_FUNC(void) _PyFloat_Init(void); PyAPI_FUNC(void) _PyFloat_Init(void);
PyAPI_FUNC(int) PyBytes_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) PySet_Fini(void);
PyAPI_FUNC(void) PyString_Fini(void); PyAPI_FUNC(void) PyString_Fini(void);
PyAPI_FUNC(void) PyBytes_Fini(void); PyAPI_FUNC(void) PyBytes_Fini(void);
PyAPI_FUNC(void) PyInt_Fini(void);
PyAPI_FUNC(void) PyFloat_Fini(void); PyAPI_FUNC(void) PyFloat_Fini(void);
PyAPI_FUNC(void) PyOS_FiniInterrupts(void); PyAPI_FUNC(void) PyOS_FiniInterrupts(void);

View File

@ -195,7 +195,7 @@ rf_tell(rfobject *self, PyObject *args)
PyMac_Error(err); PyMac_Error(err);
return NULL; return NULL;
} }
return PyInt_FromLong(where); return PyLong_FromLong(where);
} }
static char rf_close__doc__[] = static char rf_close__doc__[] =

View File

@ -102,8 +102,8 @@ myEventHandler(EventHandlerCallRef handlerRef, EventRef event, void *outPyObject
} else { } else {
if (retValue == Py_None) if (retValue == Py_None)
status = noErr; status = noErr;
else if (PyInt_Check(retValue)) { else if (PyLong_Check(retValue)) {
status = PyInt_AsLong(retValue); status = PyLong_AsLong(retValue);
} else } else
status = noErr; /* wrong object type, complain? */ status = noErr; /* wrong object type, complain? */
Py_DECREF(retValue); Py_DECREF(retValue);

View File

@ -114,7 +114,7 @@ PyCF_CF2Python_simple(CFTypeRef src) {
long l; long l;
if (!CFNumberGetValue(src, kCFNumberLongType, &l)) if (!CFNumberGetValue(src, kCFNumberLongType, &l))
/* XXXX Out of range! */; /* XXXX Out of range! */;
return PyInt_FromLong(l); return PyLong_FromLong(l);
} }
} }
/* XXXX Should return as CFTypeRef, really... */ /* XXXX Should return as CFTypeRef, really... */
@ -258,8 +258,8 @@ PyCF_Python2CF_simple(PyObject *src, CFTypeRef *dst) {
*dst = kCFBooleanFalse; *dst = kCFBooleanFalse;
return 1; return 1;
} }
if (PyInt_Check(src)) { if (PyLong_Check(src)) {
long v = PyInt_AsLong(src); long v = PyLong_AsLong(src);
*dst = CFNumberCreate(NULL, kCFNumberLongType, &v); *dst = CFNumberCreate(NULL, kCFNumberLongType, &v);
return 1; return 1;
} }

View File

@ -3250,7 +3250,7 @@ static PyObject *CtlObj_TrackControl(ControlObject *_self, PyObject *_args)
PyMac_GetPoint, &startPoint, &callback)) PyMac_GetPoint, &startPoint, &callback))
return NULL; return NULL;
if (callback && callback != Py_None) { 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; upp = (ControlActionUPP)-1;
else { else {
settrackfunc(callback); settrackfunc(callback);
@ -3283,7 +3283,7 @@ static PyObject *CtlObj_HandleControlClick(ControlObject *_self, PyObject *_args
&callback)) &callback))
return NULL; return NULL;
if (callback && callback != Py_None) { 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; upp = (ControlActionUPP)-1;
else { else {
settrackfunc(callback); settrackfunc(callback);

View File

@ -55,8 +55,8 @@ static pascal Boolean Dlg_UnivFilterProc(DialogPtr dialog,
} }
else { else {
Dlg_FilterProc_callback = callback; Dlg_FilterProc_callback = callback;
if (PyInt_Check(res)) { if (PyLong_Check(res)) {
*itemHit = PyInt_AsLong(res); *itemHit = PyLong_AsLong(res);
rv = 1; rv = 1;
} }
else else
@ -150,7 +150,7 @@ PyObject *DlgObj_New(DialogPtr itself)
int DlgObj_Convert(PyObject *v, DialogPtr *p_itself) int DlgObj_Convert(PyObject *v, DialogPtr *p_itself)
{ {
if (v == Py_None) { *p_itself = NULL; return 1; } 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; } return 1; }
if (!DlgObj_Check(v)) if (!DlgObj_Check(v))
{ {

View File

@ -40,7 +40,7 @@ gestalt_gestalt(PyObject *self, PyObject *args)
iErr = Gestalt ( selector, &response ); iErr = Gestalt ( selector, &response );
if (iErr != 0) if (iErr != 0)
return PyMac_Error(iErr); return PyMac_Error(iErr);
return PyInt_FromLong(response); return PyLong_FromLong(response);
} }
static struct PyMethodDef gestalt_methods[] = { static struct PyMethodDef gestalt_methods[] = {

View File

@ -1488,14 +1488,14 @@ static PyMethodDef BMObj_methods[] = {
static PyObject *BMObj_get_baseAddr(BitMapObject *self, void *closure) 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 #define BMObj_set_baseAddr NULL
static PyObject *BMObj_get_rowBytes(BitMapObject *self, void *closure) 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 #define BMObj_set_rowBytes NULL

View File

@ -556,7 +556,7 @@ static int ResObj_set_data(ResourceObject *self, PyObject *v, void *closure)
static PyObject *ResObj_get_size(ResourceObject *self, 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 #define ResObj_set_size NULL

View File

@ -409,7 +409,7 @@ sndih_getSampleSizeAvailable(self, args)
if( (rsizes = PyTuple_New(arg.numsizes)) == NULL) if( (rsizes = PyTuple_New(arg.numsizes)) == NULL)
return NULL; return NULL;
for( i=0; i<arg.numsizes; i++ ) for( i=0; i<arg.numsizes; i++ )
PyTuple_SetItem(rsizes, i, PyInt_FromLong((long)fsizes[i])); PyTuple_SetItem(rsizes, i, PyLong_FromLong((long)fsizes[i]));
return rsizes; return rsizes;
} }

View File

@ -74,7 +74,7 @@ int WinObj_Convert(PyObject *v, WindowPtr *p_itself)
{ {
if (v == Py_None) { *p_itself = NULL; return 1; } if (v == Py_None) { *p_itself = NULL; return 1; }
if (PyInt_Check(v)) { *p_itself = (WindowPtr)PyInt_AsLong(v); return 1; } if (PyLong_Check(v)) { *p_itself = (WindowPtr)PyLong_AsLong(v); return 1; }
{ {
DialogRef dlg; DialogRef dlg;

View File

@ -48,7 +48,7 @@ bisect_right(PyObject *self, PyObject *args, PyObject *kw)
index = internal_bisect_right(list, item, lo, hi); index = internal_bisect_right(list, item, lo, hi);
if (index < 0) if (index < 0)
return NULL; return NULL;
return PyInt_FromLong(index); return PyLong_FromLong(index);
} }
PyDoc_STRVAR(bisect_right_doc, PyDoc_STRVAR(bisect_right_doc,
@ -145,7 +145,7 @@ bisect_left(PyObject *self, PyObject *args, PyObject *kw)
index = internal_bisect_left(list, item, lo, hi); index = internal_bisect_left(list, item, lo, hi);
if (index < 0) if (index < 0)
return NULL; return NULL;
return PyInt_FromLong(index); return PyLong_FromLong(index);
} }
PyDoc_STRVAR(bisect_left_doc, PyDoc_STRVAR(bisect_left_doc,

View File

@ -394,7 +394,7 @@ make_key_dbt(DBObject* self, PyObject* keyobj, DBT* key, int* pflags,
/* no need to do anything, the structure has already been zeroed */ /* no need to do anything, the structure has already been zeroed */
} }
else if (PyInt_Check(keyobj)) { else if (PyLong_Check(keyobj)) {
/* verify access method type */ /* verify access method type */
type = _DB_get_type(self); type = _DB_get_type(self);
if (type == -1) if (type == -1)
@ -413,7 +413,7 @@ make_key_dbt(DBObject* self, PyObject* keyobj, DBT* key, int* pflags,
/* Make a key out of the requested recno, use allocated space so DB /* Make a key out of the requested recno, use allocated space so DB
* will be able to realloc room for the real key if needed. */ * will be able to realloc room for the real key if needed. */
recno = PyInt_AS_LONG(keyobj); recno = PyLong_AS_LONG(keyobj);
key->data = malloc(sizeof(db_recno_t)); key->data = malloc(sizeof(db_recno_t));
if (key->data == NULL) { if (key->data == NULL) {
PyErr_SetString(PyExc_MemoryError, "Key memory allocation failed"); 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 */ /* add an integer to a dictionary using the given name as a key */
static void _addIntToDict(PyObject* dict, char *name, int value) 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)) if (!v || PyDict_SetItemString(dict, name, v))
PyErr_Clear(); PyErr_Clear();
@ -755,7 +755,7 @@ static void _addTimeTToDict(PyObject* dict, char *name, time_t value)
v = PyLong_FromLongLong((PY_LONG_LONG) value); v = PyLong_FromLongLong((PY_LONG_LONG) value);
else else
#endif #endif
v = PyInt_FromLong((long) value); v = PyLong_FromLong((long) value);
if (!v || PyDict_SetItemString(dict, name, v)) if (!v || PyDict_SetItemString(dict, name, v))
PyErr_Clear(); PyErr_Clear();
@ -1132,7 +1132,7 @@ DB_append(DBObject* self, PyObject* args)
} }
free_buf_view(dataobj, data_buf_view); 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) { else if (result == Py_None) {
retval = DB_DONOTINDEX; retval = DB_DONOTINDEX;
} }
else if (PyInt_Check(result)) { else if (PyLong_Check(result)) {
retval = PyInt_AsLong(result); retval = PyLong_AsLong(result);
} }
else if (PyBytes_Check(result) || PyString_Check(result)) { else if (PyBytes_Check(result) || PyString_Check(result)) {
char* data; char* data;
@ -1457,7 +1457,7 @@ DB_fd(DBObject* self, PyObject* args)
err = self->db->fd(self->db, &the_fd); err = self->db->fd(self->db, &the_fd);
MYDB_END_ALLOW_THREADS; MYDB_END_ALLOW_THREADS;
RETURN_IF_ERR(); 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 || if (self->primaryDBType == DB_RECNO ||
self->primaryDBType == DB_QUEUE) self->primaryDBType == DB_QUEUE)
pkeyObj = PyInt_FromLong(*(int *)pkey.data); pkeyObj = PyLong_FromLong(*(int *)pkey.data);
else else
pkeyObj = PyString_FromStringAndSize(pkey.data, pkey.size); pkeyObj = PyString_FromStringAndSize(pkey.data, pkey.size);
@ -1603,7 +1603,7 @@ DB_pget(DBObject* self, PyObject* args, PyObject* kwargs)
PyObject *keyObj; PyObject *keyObj;
int type = _DB_get_type(self); int type = _DB_get_type(self);
if (type == DB_RECNO || type == DB_QUEUE) if (type == DB_RECNO || type == DB_QUEUE)
keyObj = PyInt_FromLong(*(int *)key.data); keyObj = PyLong_FromLong(*(int *)key.data);
else else
keyObj = PyString_FromStringAndSize(key.data, key.size); keyObj = PyString_FromStringAndSize(key.data, key.size);
#if (PY_VERSION_HEX >= 0x02040000) #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); err = self->db->get(self->db, txn, &key, &data, flags);
MYDB_END_ALLOW_THREADS; MYDB_END_ALLOW_THREADS;
if (err == DB_BUFFER_SMALL) { if (err == DB_BUFFER_SMALL) {
retval = PyInt_FromLong((long)data.size); retval = PyLong_FromLong((long)data.size);
err = 0; err = 0;
} }
@ -1769,7 +1769,7 @@ DB_get_byteswapped(DBObject* self, PyObject* args)
retval = self->db->get_byteswapped(self->db); retval = self->db->get_byteswapped(self->db);
MYDB_END_ALLOW_THREADS; MYDB_END_ALLOW_THREADS;
#endif #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); type = _DB_get_type(self);
if (type == -1) if (type == -1)
return NULL; 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) if (flags & DB_APPEND)
retval = PyInt_FromLong(*((db_recno_t*)key.data)); retval = PyLong_FromLong(*((db_recno_t*)key.data));
else { else {
retval = Py_None; retval = Py_None;
Py_INCREF(retval); Py_INCREF(retval);
@ -2130,8 +2130,8 @@ _db_compareCallback(DB* db,
/* we're in a callback within the DB code, we can't raise */ /* we're in a callback within the DB code, we can't raise */
PyErr_Print(); PyErr_Print();
res = _default_cmp(leftKey, rightKey); res = _default_cmp(leftKey, rightKey);
} else if (PyInt_Check(result)) { } else if (PyLong_Check(result)) {
res = PyInt_AsLong(result); res = PyLong_AsLong(result);
} else { } else {
PyErr_SetString(PyExc_TypeError, PyErr_SetString(PyExc_TypeError,
"DB_bt_compare callback MUST return an int."); "DB_bt_compare callback MUST return an int.");
@ -2175,11 +2175,11 @@ DB_set_bt_compare(DBObject* self, PyObject* args)
Py_DECREF(tuple); Py_DECREF(tuple);
if (result == NULL) if (result == NULL)
return NULL; return NULL;
if (!PyInt_Check(result)) { if (!PyLong_Check(result)) {
PyErr_SetString(PyExc_TypeError, PyErr_SetString(PyExc_TypeError,
"callback MUST return an int"); "callback MUST return an int");
return NULL; return NULL;
} else if (PyInt_AsLong(result) != 0) { } else if (PyLong_AsLong(result) != 0) {
PyErr_SetString(PyExc_TypeError, PyErr_SetString(PyExc_TypeError,
"callback failed to return 0 on two empty strings"); "callback failed to return 0 on two empty strings");
return NULL; return NULL;
@ -2581,7 +2581,7 @@ DB_truncate(DBObject* self, PyObject* args, PyObject* kwargs)
err = self->db->truncate(self->db, txn, &count, flags); err = self->db->truncate(self->db, txn, &count, flags);
MYDB_END_ALLOW_THREADS; MYDB_END_ALLOW_THREADS;
RETURN_IF_ERR(); RETURN_IF_ERR();
return PyInt_FromLong(count); return PyLong_FromLong(count);
} }
#endif #endif
@ -2662,7 +2662,7 @@ DB_set_get_returns_none(DBObject* self, PyObject* args)
++oldValue; ++oldValue;
self->moduleFlags.getReturnsNone = (flags >= 1); self->moduleFlags.getReturnsNone = (flags >= 1);
self->moduleFlags.cursorSetReturnsNone = (flags >= 2); self->moduleFlags.cursorSetReturnsNone = (flags >= 2);
return PyInt_FromLong(oldValue); return PyLong_FromLong(oldValue);
} }
#if (DBVER >= 41) #if (DBVER >= 41)
@ -2866,9 +2866,9 @@ DB_has_key(DBObject* self, PyObject* args)
FREE_DBT_VIEW(key, keyobj, key_buf_view); FREE_DBT_VIEW(key, keyobj, key_buf_view);
if (err == DB_BUFFER_SMALL || err == 0) { if (err == DB_BUFFER_SMALL || err == 0) {
return PyInt_FromLong(1); return PyLong_FromLong(1);
} else if (err == DB_NOTFOUND || err == DB_KEYEMPTY) { } else if (err == DB_NOTFOUND || err == DB_KEYEMPTY) {
return PyInt_FromLong(0); return PyLong_FromLong(0);
} }
makeDBError(err); makeDBError(err);
@ -2936,7 +2936,7 @@ _DB_make_list(DBObject* self, DB_TXN* txn, int type)
break; break;
case DB_RECNO: case DB_RECNO:
case DB_QUEUE: case DB_QUEUE:
item = PyInt_FromLong(*((db_recno_t*)key.data)); item = PyLong_FromLong(*((db_recno_t*)key.data));
break; break;
} }
break; break;
@ -3071,7 +3071,7 @@ DBC_count(DBCursorObject* self, PyObject* args)
MYDB_END_ALLOW_THREADS; MYDB_END_ALLOW_THREADS;
RETURN_IF_ERR(); 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 || if (self->mydb->primaryDBType == DB_RECNO ||
self->mydb->primaryDBType == DB_QUEUE) self->mydb->primaryDBType == DB_QUEUE)
pkeyObj = PyInt_FromLong(*(int *)pkey.data); pkeyObj = PyLong_FromLong(*(int *)pkey.data);
else else
pkeyObj = PyString_FromStringAndSize(pkey.data, pkey.size); pkeyObj = PyString_FromStringAndSize(pkey.data, pkey.size);
@ -3303,7 +3303,7 @@ DBC_pget(DBCursorObject* self, PyObject* args, PyObject *kwargs)
PyObject *keyObj; PyObject *keyObj;
int type = _DB_get_type(self->mydb); int type = _DB_get_type(self->mydb);
if (type == DB_RECNO || type == DB_QUEUE) if (type == DB_RECNO || type == DB_QUEUE)
keyObj = PyInt_FromLong(*(int *)key.data); keyObj = PyLong_FromLong(*(int *)key.data);
else else
keyObj = PyString_FromStringAndSize(key.data, key.size); keyObj = PyString_FromStringAndSize(key.data, key.size);
retval = PyTuple_Pack(3, keyObj, pkeyObj, dataObj); retval = PyTuple_Pack(3, keyObj, pkeyObj, dataObj);
@ -3359,7 +3359,7 @@ DBC_get_recno(DBCursorObject* self, PyObject* args)
recno = *((db_recno_t*)data.data); recno = *((db_recno_t*)data.data);
free_dbt(&key); free_dbt(&key);
free_dbt(&data); 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; MYDB_END_ALLOW_THREADS;
if (err == DB_BUFFER_SMALL || !err) { if (err == DB_BUFFER_SMALL || !err) {
/* DB_BUFFER_SMALL means positive size, !err means zero length value */ /* 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; err = 0;
} }
@ -4336,7 +4336,7 @@ DBEnv_lock_detect(DBEnvObject* self, PyObject* args)
#endif #endif
MYDB_END_ALLOW_THREADS; MYDB_END_ALLOW_THREADS;
RETURN_IF_ERR(); 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; MYDB_END_ALLOW_THREADS;
RETURN_IF_ERR(); RETURN_IF_ERR();
return PyInt_FromLong((long)theID); return PyLong_FromLong((long)theID);
} }
#if (DBVER >= 40) #if (DBVER >= 40)
@ -4695,7 +4695,7 @@ DBEnv_set_get_returns_none(DBEnvObject* self, PyObject* args)
++oldValue; ++oldValue;
self->moduleFlags.getReturnsNone = (flags >= 1); self->moduleFlags.getReturnsNone = (flags >= 1);
self->moduleFlags.cursorSetReturnsNone = (flags >= 2); 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); id = txn_id(self->txn);
#endif #endif
MYDB_END_ALLOW_THREADS; MYDB_END_ALLOW_THREADS;
return PyInt_FromLong(id); return PyLong_FromLong(id);
} }
#if (DBVER >= 43) #if (DBVER >= 43)
@ -5022,7 +5022,7 @@ DBSequence_get_cachesize(DBSequenceObject* self, PyObject* args)
MYDB_END_ALLOW_THREADS MYDB_END_ALLOW_THREADS
RETURN_IF_ERR(); RETURN_IF_ERR();
return PyInt_FromLong(size); return PyLong_FromLong(size);
} }
static PyObject* static PyObject*
@ -5056,7 +5056,7 @@ DBSequence_get_flags(DBSequenceObject* self, PyObject* args)
MYDB_END_ALLOW_THREADS MYDB_END_ALLOW_THREADS
RETURN_IF_ERR(); RETURN_IF_ERR();
return PyInt_FromLong((int)flags); return PyLong_FromLong((int)flags);
} }
static PyObject* static PyObject*

View File

@ -775,7 +775,7 @@ deque_init(dequeobject *deque, PyObject *args, PyObject *kwdargs)
if (!PyArg_ParseTupleAndKeywords(args, kwdargs, "|OO:deque", kwlist, &iterable, &maxlenobj)) if (!PyArg_ParseTupleAndKeywords(args, kwdargs, "|OO:deque", kwlist, &iterable, &maxlenobj))
return -1; return -1;
if (maxlenobj != NULL && maxlenobj != Py_None) { if (maxlenobj != NULL && maxlenobj != Py_None) {
maxlen = PyInt_AsLong(maxlenobj); maxlen = PyLong_AsLong(maxlenobj);
if (maxlen == -1 && PyErr_Occurred()) if (maxlen == -1 && PyErr_Occurred())
return -1; return -1;
if (maxlen < 0) { if (maxlen < 0) {
@ -954,7 +954,7 @@ dequeiter_next(dequeiterobject *it)
static PyObject * static PyObject *
dequeiter_len(dequeiterobject *it) 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))."); PyDoc_STRVAR(length_hint_doc, "Private method returning an estimate of len(list(it)).");

View File

@ -162,7 +162,7 @@ Dialect_get_quotechar(DialectObj *self)
static PyObject * static PyObject *
Dialect_get_quoting(DialectObj *self) Dialect_get_quoting(DialectObj *self)
{ {
return PyInt_FromLong(self->quoting); return PyLong_FromLong(self->quoting);
} }
static int static int
@ -186,7 +186,7 @@ _set_int(const char *name, int *target, PyObject *src, int dflt)
"\"%s\" must be an integer", name); "\"%s\" must be an integer", name);
return -1; return -1;
} }
*target = PyInt_AsLong(src); *target = PyLong_AsLong(src);
} }
return 0; return 0;
} }
@ -1390,9 +1390,9 @@ csv_field_size_limit(PyObject *module, PyObject *args)
"limit must be an integer"); "limit must be an integer");
return NULL; return NULL;
} }
field_limit = PyInt_AsLong(new_limit); field_limit = PyLong_AsLong(new_limit);
} }
return PyInt_FromLong(old_limit); return PyLong_FromLong(old_limit);
} }
/* /*

View File

@ -236,7 +236,7 @@ static PyObject *
CDataType_from_address(PyObject *type, PyObject *value) CDataType_from_address(PyObject *type, PyObject *value)
{ {
void *buf; void *buf;
if (!PyInt_Check(value)) { if (!PyLong_Check(value)) {
PyErr_SetString(PyExc_TypeError, PyErr_SetString(PyExc_TypeError,
"integer expected"); "integer expected");
return NULL; return NULL;
@ -265,7 +265,7 @@ CDataType_in_dll(PyObject *type, PyObject *args)
obj = PyObject_GetAttrString(dll, "_handle"); obj = PyObject_GetAttrString(dll, "_handle");
if (!obj) if (!obj)
return NULL; return NULL;
if (!PyInt_Check(obj)) { if (!PyLong_Check(obj)) {
PyErr_SetString(PyExc_TypeError, PyErr_SetString(PyExc_TypeError,
"the _handle attribute of the second argument must be an integer"); "the _handle attribute of the second argument must be an integer");
Py_DECREF(obj); Py_DECREF(obj);
@ -641,7 +641,7 @@ PointerType_from_param(PyObject *type, PyObject *value)
StgDictObject *typedict; StgDictObject *typedict;
if (value == Py_None) if (value == Py_None)
return PyInt_FromLong(0); /* NULL pointer */ return PyLong_FromLong(0); /* NULL pointer */
typedict = PyType_stgdict(type); typedict = PyType_stgdict(type);
assert(typedict); /* Cannot be NULL for pointer types */ 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"); "which must be a positive integer");
return NULL; return NULL;
} }
length = PyInt_AS_LONG(proto); length = PyLong_AS_LONG(proto);
proto = PyDict_GetItemString(typedict, "_type_"); /* Borrowed ref */ proto = PyDict_GetItemString(typedict, "_type_"); /* Borrowed ref */
if (!proto) { if (!proto) {
@ -1233,7 +1233,7 @@ c_void_p_from_param(PyObject *type, PyObject *value)
} }
/* Should probably allow buffer interface as well */ /* Should probably allow buffer interface as well */
/* int, long */ /* int, long */
if (PyInt_Check(value)) { if (PyLong_Check(value)) {
PyCArgObject *parg; PyCArgObject *parg;
struct fielddesc *fd = getentry("P"); struct fielddesc *fd = getentry("P");
@ -1784,12 +1784,12 @@ make_funcptrtype_dict(StgDictObject *stgdict)
stgdict->ffi_type_pointer = ffi_type_pointer; stgdict->ffi_type_pointer = ffi_type_pointer;
ob = PyDict_GetItemString((PyObject *)stgdict, "_flags_"); ob = PyDict_GetItemString((PyObject *)stgdict, "_flags_");
if (!ob || !PyInt_Check(ob)) { if (!ob || !PyLong_Check(ob)) {
PyErr_SetString(PyExc_TypeError, PyErr_SetString(PyExc_TypeError,
"class must define _flags_ which must be an integer"); "class must define _flags_ which must be an integer");
return -1; return -1;
} }
stgdict->flags = PyInt_AS_LONG(ob); stgdict->flags = PyLong_AS_LONG(ob);
/* _argtypes_ is optional... */ /* _argtypes_ is optional... */
ob = PyDict_GetItemString((PyObject *)stgdict, "_argtypes_"); ob = PyDict_GetItemString((PyObject *)stgdict, "_argtypes_");
@ -2697,11 +2697,11 @@ static int
_get_name(PyObject *obj, char **pname) _get_name(PyObject *obj, char **pname)
{ {
#ifdef MS_WIN32 #ifdef MS_WIN32
if (PyInt_Check(obj)) { if (PyLong_Check(obj)) {
/* We have to use MAKEINTRESOURCEA for Windows CE. /* We have to use MAKEINTRESOURCEA for Windows CE.
Works on Windows as well, of course. Works on Windows as well, of course.
*/ */
*pname = MAKEINTRESOURCEA(PyInt_AsUnsignedLongMask(obj) & 0xFFFF); *pname = MAKEINTRESOURCEA(PyLong_AsUnsignedLongMask(obj) & 0xFFFF);
return 1; return 1;
} }
#endif #endif
@ -2738,7 +2738,7 @@ CFuncPtr_FromDll(PyTypeObject *type, PyObject *args, PyObject *kwds)
obj = PyObject_GetAttrString(dll, "_handle"); obj = PyObject_GetAttrString(dll, "_handle");
if (!obj) if (!obj)
return NULL; return NULL;
if (!PyInt_Check(obj)) { if (!PyLong_Check(obj)) {
PyErr_SetString(PyExc_TypeError, PyErr_SetString(PyExc_TypeError,
"the _handle attribute of the second argument must be an integer"); "the _handle attribute of the second argument must be an integer");
Py_DECREF(obj); Py_DECREF(obj);
@ -2858,12 +2858,12 @@ CFuncPtr_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
return CFuncPtr_FromDll(type, args, kwds); return CFuncPtr_FromDll(type, args, kwds);
#ifdef MS_WIN32 #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); return CFuncPtr_FromVtblIndex(type, args, kwds);
#endif #endif
if (1 == PyTuple_GET_SIZE(args) if (1 == PyTuple_GET_SIZE(args)
&& (PyInt_Check(PyTuple_GET_ITEM(args, 0)))) { && (PyLong_Check(PyTuple_GET_ITEM(args, 0)))) {
CDataObject *ob; CDataObject *ob;
void *ptr = PyLong_AsVoidPtr(PyTuple_GET_ITEM(args, 0)); void *ptr = PyLong_AsVoidPtr(PyTuple_GET_ITEM(args, 0));
if (ptr == NULL) if (ptr == NULL)
@ -3068,7 +3068,7 @@ _build_callargs(CFuncPtrObject *self, PyObject *argtypes,
calls below. */ calls below. */
/* We HAVE already checked that the tuple can be parsed with "i|ZO", so... */ /* We HAVE already checked that the tuple can be parsed with "i|ZO", so... */
Py_ssize_t tsize = PyTuple_GET_SIZE(item); 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; name = tsize > 1 ? PyTuple_GET_ITEM(item, 1) : NULL;
defval = tsize > 2 ? PyTuple_GET_ITEM(item, 2) : 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, /* ['in', 'lcid'] parameter. Always taken from defval,
if given, else the integer 0. */ if given, else the integer 0. */
if (defval == NULL) { if (defval == NULL) {
defval = PyInt_FromLong(0); defval = PyLong_FromLong(0);
if (defval == NULL) if (defval == NULL)
goto error; goto error;
} else } else
@ -4864,11 +4864,11 @@ init_ctypes(void)
return; return;
PyModule_AddObject(m, "COMError", ComError); PyModule_AddObject(m, "COMError", ComError);
PyModule_AddObject(m, "FUNCFLAG_HRESULT", PyInt_FromLong(FUNCFLAG_HRESULT)); PyModule_AddObject(m, "FUNCFLAG_HRESULT", PyLong_FromLong(FUNCFLAG_HRESULT));
PyModule_AddObject(m, "FUNCFLAG_STDCALL", PyInt_FromLong(FUNCFLAG_STDCALL)); PyModule_AddObject(m, "FUNCFLAG_STDCALL", PyLong_FromLong(FUNCFLAG_STDCALL));
#endif #endif
PyModule_AddObject(m, "FUNCFLAG_CDECL", PyInt_FromLong(FUNCFLAG_CDECL)); PyModule_AddObject(m, "FUNCFLAG_CDECL", PyLong_FromLong(FUNCFLAG_CDECL));
PyModule_AddObject(m, "FUNCFLAG_PYTHONAPI", PyInt_FromLong(FUNCFLAG_PYTHONAPI)); PyModule_AddObject(m, "FUNCFLAG_PYTHONAPI", PyLong_FromLong(FUNCFLAG_PYTHONAPI));
PyModule_AddStringConstant(m, "__version__", "1.1.0"); PyModule_AddStringConstant(m, "__version__", "1.1.0");
PyModule_AddObject(m, "_memmove_addr", PyLong_FromVoidPtr(memmove)); PyModule_AddObject(m, "_memmove_addr", PyLong_FromVoidPtr(memmove));
@ -4891,8 +4891,8 @@ init_ctypes(void)
#define RTLD_GLOBAL RTLD_LOCAL #define RTLD_GLOBAL RTLD_LOCAL
#endif #endif
PyModule_AddObject(m, "RTLD_LOCAL", PyInt_FromLong(RTLD_LOCAL)); PyModule_AddObject(m, "RTLD_LOCAL", PyLong_FromLong(RTLD_LOCAL));
PyModule_AddObject(m, "RTLD_GLOBAL", PyInt_FromLong(RTLD_GLOBAL)); PyModule_AddObject(m, "RTLD_GLOBAL", PyLong_FromLong(RTLD_GLOBAL));
PyExc_ArgError = PyErr_NewException("ctypes.ArgumentError", NULL, NULL); PyExc_ArgError = PyErr_NewException("ctypes.ArgumentError", NULL, NULL);
if (PyExc_ArgError) { if (PyExc_ArgError) {

View File

@ -408,7 +408,7 @@ long Call_GetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
return E_FAIL; return E_FAIL;
} }
retval = PyInt_AsLong(result); retval = PyLong_AsLong(result);
if (PyErr_Occurred()) { if (PyErr_Occurred()) {
PyErr_WriteUnraisable(context ? context : Py_None); PyErr_WriteUnraisable(context ? context : Py_None);
retval = E_FAIL; retval = E_FAIL;
@ -469,7 +469,7 @@ long Call_CanUnloadNow(void)
return E_FAIL; return E_FAIL;
} }
retval = PyInt_AsLong(result); retval = PyLong_AsLong(result);
if (PyErr_Occurred()) { if (PyErr_Occurred()) {
PyErr_WriteUnraisable(context ? context : Py_None); PyErr_WriteUnraisable(context ? context : Py_None);
retval = E_FAIL; retval = E_FAIL;

View File

@ -269,7 +269,7 @@ check_hresult(PyObject *self, PyObject *args)
return NULL; return NULL;
if (FAILED(hr)) if (FAILED(hr))
return PyErr_SetFromWindowsErr(hr); return PyErr_SetFromWindowsErr(hr);
return PyInt_FromLong(hr); return PyLong_FromLong(hr);
} }
#endif #endif
@ -727,7 +727,7 @@ static PyObject *GetResult(PyObject *restype, void *result, PyObject *checker)
PyObject *retval, *v; PyObject *retval, *v;
if (restype == NULL) if (restype == NULL)
return PyInt_FromLong(*(int *)result); return PyLong_FromLong(*(int *)result);
if (restype == Py_None) { if (restype == Py_None) {
Py_INCREF(Py_None); Py_INCREF(Py_None);
@ -1020,12 +1020,12 @@ PyObject *_CallProc(PPROC pProc,
if (*(int *)resbuf & 0x80000000) if (*(int *)resbuf & 0x80000000)
retval = GetComError(*(HRESULT *)resbuf, iid, pIunk); retval = GetComError(*(HRESULT *)resbuf, iid, pIunk);
else else
retval = PyInt_FromLong(*(int *)resbuf); retval = PyLong_FromLong(*(int *)resbuf);
} else if (flags & FUNCFLAG_HRESULT) { } else if (flags & FUNCFLAG_HRESULT) {
if (*(int *)resbuf & 0x80000000) if (*(int *)resbuf & 0x80000000)
retval = PyErr_SetFromWindowsErr(*(int *)resbuf); retval = PyErr_SetFromWindowsErr(*(int *)resbuf);
else else
retval = PyInt_FromLong(*(int *)resbuf); retval = PyLong_FromLong(*(int *)resbuf);
} else } else
#endif #endif
retval = GetResult(restype, resbuf, checker); retval = GetResult(restype, resbuf, checker);
@ -1198,12 +1198,12 @@ copy_com_pointer(PyObject *self, PyObject *args)
pdst = (IUnknown **)b.value.p; pdst = (IUnknown **)b.value.p;
if (pdst == NULL) if (pdst == NULL)
r = PyInt_FromLong(E_POINTER); r = PyLong_FromLong(E_POINTER);
else { else {
if (src) if (src)
src->lpVtbl->AddRef(src); src->lpVtbl->AddRef(src);
*pdst = src; *pdst = src;
r = PyInt_FromLong(S_OK); r = PyLong_FromLong(S_OK);
} }
done: done:
Py_XDECREF(a.keep); Py_XDECREF(a.keep);
@ -1345,10 +1345,10 @@ sizeof_func(PyObject *self, PyObject *obj)
dict = PyType_stgdict(obj); dict = PyType_stgdict(obj);
if (dict) if (dict)
return PyInt_FromSsize_t(dict->size); return PyLong_FromSsize_t(dict->size);
if (CDataObject_Check(obj)) if (CDataObject_Check(obj))
return PyInt_FromSsize_t(((CDataObject *)obj)->b_size); return PyLong_FromSsize_t(((CDataObject *)obj)->b_size);
PyErr_SetString(PyExc_TypeError, PyErr_SetString(PyExc_TypeError,
"this type has no size"); "this type has no size");
return NULL; return NULL;
@ -1366,11 +1366,11 @@ align_func(PyObject *self, PyObject *obj)
dict = PyType_stgdict(obj); dict = PyType_stgdict(obj);
if (dict) if (dict)
return PyInt_FromSsize_t(dict->align); return PyLong_FromSsize_t(dict->align);
dict = PyObject_stgdict(obj); dict = PyObject_stgdict(obj);
if (dict) if (dict)
return PyInt_FromSsize_t(dict->align); return PyLong_FromSsize_t(dict->align);
PyErr_SetString(PyExc_TypeError, PyErr_SetString(PyExc_TypeError,
"no alignment info"); "no alignment info");

View File

@ -216,13 +216,13 @@ CField_get(CFieldObject *self, PyObject *inst, PyTypeObject *type)
static PyObject * static PyObject *
CField_get_offset(PyObject *self, void *data) CField_get_offset(PyObject *self, void *data)
{ {
return PyInt_FromSsize_t(((CFieldObject *)self)->offset); return PyLong_FromSsize_t(((CFieldObject *)self)->offset);
} }
static PyObject * static PyObject *
CField_get_size(PyObject *self, void *data) 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[] = { static PyGetSetDef CField_getset[] = {
@ -329,13 +329,13 @@ static int
get_long(PyObject *v, long *p) get_long(PyObject *v, long *p)
{ {
long x; long x;
if (!PyInt_Check(v)) { if (!PyLong_Check(v)) {
PyErr_Format(PyExc_TypeError, PyErr_Format(PyExc_TypeError,
"int expected instead of %s instance", "int expected instead of %s instance",
v->ob_type->tp_name); v->ob_type->tp_name);
return -1; return -1;
} }
x = PyInt_AsUnsignedLongMask(v); x = PyLong_AsUnsignedLongMask(v);
if (x == -1 && PyErr_Occurred()) if (x == -1 && PyErr_Occurred())
return -1; return -1;
*p = x; *p = x;
@ -348,13 +348,13 @@ static int
get_ulong(PyObject *v, unsigned long *p) get_ulong(PyObject *v, unsigned long *p)
{ {
unsigned long x; unsigned long x;
if (!PyInt_Check(v)) { if (!PyLong_Check(v)) {
PyErr_Format(PyExc_TypeError, PyErr_Format(PyExc_TypeError,
"int expected instead of %s instance", "int expected instead of %s instance",
v->ob_type->tp_name); v->ob_type->tp_name);
return -1; return -1;
} }
x = PyInt_AsUnsignedLongMask(v); x = PyLong_AsUnsignedLongMask(v);
if (x == -1 && PyErr_Occurred()) if (x == -1 && PyErr_Occurred())
return -1; return -1;
*p = x; *p = x;
@ -369,13 +369,13 @@ static int
get_longlong(PyObject *v, PY_LONG_LONG *p) get_longlong(PyObject *v, PY_LONG_LONG *p)
{ {
PY_LONG_LONG x; PY_LONG_LONG x;
if (!PyInt_Check(v)) { if (!PyLong_Check(v)) {
PyErr_Format(PyExc_TypeError, PyErr_Format(PyExc_TypeError,
"int expected instead of %s instance", "int expected instead of %s instance",
v->ob_type->tp_name); v->ob_type->tp_name);
return -1; return -1;
} }
x = PyInt_AsUnsignedLongLongMask(v); x = PyLong_AsUnsignedLongLongMask(v);
if (x == -1 && PyErr_Occurred()) if (x == -1 && PyErr_Occurred())
return -1; return -1;
*p = x; *p = x;
@ -388,13 +388,13 @@ static int
get_ulonglong(PyObject *v, unsigned PY_LONG_LONG *p) get_ulonglong(PyObject *v, unsigned PY_LONG_LONG *p)
{ {
unsigned PY_LONG_LONG x; unsigned PY_LONG_LONG x;
if (!PyInt_Check(v)) { if (!PyLong_Check(v)) {
PyErr_Format(PyExc_TypeError, PyErr_Format(PyExc_TypeError,
"int expected instead of %s instance", "int expected instead of %s instance",
v->ob_type->tp_name); v->ob_type->tp_name);
return -1; return -1;
} }
x = PyInt_AsUnsignedLongLongMask(v); x = PyLong_AsUnsignedLongLongMask(v);
if (x == -1 && PyErr_Occurred()) if (x == -1 && PyErr_Occurred())
return -1; return -1;
*p = x; *p = x;
@ -513,7 +513,7 @@ b_get(void *ptr, Py_ssize_t size)
{ {
signed char val = *(signed char *)ptr; signed char val = *(signed char *)ptr;
GET_BITFIELD(val, size); GET_BITFIELD(val, size);
return PyInt_FromLong(val); return PyLong_FromLong(val);
} }
static PyObject * static PyObject *
@ -533,7 +533,7 @@ B_get(void *ptr, Py_ssize_t size)
{ {
unsigned char val = *(unsigned char *)ptr; unsigned char val = *(unsigned char *)ptr;
GET_BITFIELD(val, size); GET_BITFIELD(val, size);
return PyInt_FromLong(val); return PyLong_FromLong(val);
} }
static PyObject * static PyObject *
@ -571,7 +571,7 @@ h_get(void *ptr, Py_ssize_t size)
short val; short val;
memcpy(&val, ptr, sizeof(val)); memcpy(&val, ptr, sizeof(val));
GET_BITFIELD(val, size); GET_BITFIELD(val, size);
return PyInt_FromLong((long)val); return PyLong_FromLong((long)val);
} }
static PyObject * static PyObject *
@ -581,7 +581,7 @@ h_get_sw(void *ptr, Py_ssize_t size)
memcpy(&val, ptr, sizeof(val)); memcpy(&val, ptr, sizeof(val));
val = SWAP_2(val); val = SWAP_2(val);
GET_BITFIELD(val, size); GET_BITFIELD(val, size);
return PyInt_FromLong(val); return PyLong_FromLong(val);
} }
static PyObject * static PyObject *
@ -619,7 +619,7 @@ H_get(void *ptr, Py_ssize_t size)
unsigned short val; unsigned short val;
memcpy(&val, ptr, sizeof(val)); memcpy(&val, ptr, sizeof(val));
GET_BITFIELD(val, size); GET_BITFIELD(val, size);
return PyInt_FromLong(val); return PyLong_FromLong(val);
} }
static PyObject * static PyObject *
@ -629,7 +629,7 @@ H_get_sw(void *ptr, Py_ssize_t size)
memcpy(&val, ptr, sizeof(val)); memcpy(&val, ptr, sizeof(val));
val = SWAP_2(val); val = SWAP_2(val);
GET_BITFIELD(val, size); GET_BITFIELD(val, size);
return PyInt_FromLong(val); return PyLong_FromLong(val);
} }
static PyObject * static PyObject *
@ -667,7 +667,7 @@ i_get(void *ptr, Py_ssize_t size)
int val; int val;
memcpy(&val, ptr, sizeof(val)); memcpy(&val, ptr, sizeof(val));
GET_BITFIELD(val, size); GET_BITFIELD(val, size);
return PyInt_FromLong(val); return PyLong_FromLong(val);
} }
static PyObject * static PyObject *
@ -677,7 +677,7 @@ i_get_sw(void *ptr, Py_ssize_t size)
memcpy(&val, ptr, sizeof(val)); memcpy(&val, ptr, sizeof(val));
val = SWAP_INT(val); val = SWAP_INT(val);
GET_BITFIELD(val, size); GET_BITFIELD(val, size);
return PyInt_FromLong(val); return PyLong_FromLong(val);
} }
#ifdef MS_WIN32 #ifdef MS_WIN32
@ -815,7 +815,7 @@ l_get(void *ptr, Py_ssize_t size)
long val; long val;
memcpy(&val, ptr, sizeof(val)); memcpy(&val, ptr, sizeof(val));
GET_BITFIELD(val, size); GET_BITFIELD(val, size);
return PyInt_FromLong(val); return PyLong_FromLong(val);
} }
static PyObject * static PyObject *
@ -825,7 +825,7 @@ l_get_sw(void *ptr, Py_ssize_t size)
memcpy(&val, ptr, sizeof(val)); memcpy(&val, ptr, sizeof(val));
val = SWAP_LONG(val); val = SWAP_LONG(val);
GET_BITFIELD(val, size); GET_BITFIELD(val, size);
return PyInt_FromLong(val); return PyLong_FromLong(val);
} }
static PyObject * static PyObject *
@ -1173,9 +1173,9 @@ c_set(void *ptr, PyObject *value, Py_ssize_t size)
*(char *)ptr = PyBytes_AS_STRING(value)[0]; *(char *)ptr = PyBytes_AS_STRING(value)[0];
_RET(value); _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) if (longval < 0 || longval >= 256)
goto error; goto error;
*(char *)ptr = (char)longval; *(char *)ptr = (char)longval;
@ -1384,11 +1384,11 @@ z_set(void *ptr, PyObject *value, Py_ssize_t size)
return NULL; return NULL;
*(char **)ptr = PyString_AS_STRING(str); *(char **)ptr = PyString_AS_STRING(str);
return str; return str;
} else if (PyInt_Check(value)) { } else if (PyLong_Check(value)) {
#if SIZEOF_VOID_P == SIZEOF_LONG_LONG #if SIZEOF_VOID_P == SIZEOF_LONG_LONG
*(char **)ptr = (char *)PyInt_AsUnsignedLongLongMask(value); *(char **)ptr = (char *)PyLong_AsUnsignedLongLongMask(value);
#else #else
*(char **)ptr = (char *)PyInt_AsUnsignedLongMask(value); *(char **)ptr = (char *)PyLong_AsUnsignedLongMask(value);
#endif #endif
_RET(value); _RET(value);
} }
@ -1427,11 +1427,11 @@ Z_set(void *ptr, PyObject *value, Py_ssize_t size)
Py_INCREF(value); Py_INCREF(value);
return value; return value;
} }
if (PyInt_Check(value) || PyLong_Check(value)) { if (PyLong_Check(value) || PyLong_Check(value)) {
#if SIZEOF_VOID_P == SIZEOF_LONG_LONG #if SIZEOF_VOID_P == SIZEOF_LONG_LONG
*(wchar_t **)ptr = (wchar_t *)PyInt_AsUnsignedLongLongMask(value); *(wchar_t **)ptr = (wchar_t *)PyLong_AsUnsignedLongLongMask(value);
#else #else
*(wchar_t **)ptr = (wchar_t *)PyInt_AsUnsignedLongMask(value); *(wchar_t **)ptr = (wchar_t *)PyLong_AsUnsignedLongMask(value);
#endif #endif
Py_INCREF(Py_None); Py_INCREF(Py_None);
return Py_None; return Py_None;
@ -1585,21 +1585,21 @@ P_set(void *ptr, PyObject *value, Py_ssize_t size)
_RET(value); _RET(value);
} }
if (!PyInt_Check(value) && !PyLong_Check(value)) { if (!PyLong_Check(value) && !PyLong_Check(value)) {
PyErr_SetString(PyExc_TypeError, PyErr_SetString(PyExc_TypeError,
"cannot be converted to pointer"); "cannot be converted to pointer");
return NULL; return NULL;
} }
#if SIZEOF_VOID_P <= SIZEOF_LONG #if SIZEOF_VOID_P <= SIZEOF_LONG
v = (void *)PyInt_AsUnsignedLongMask(value); v = (void *)PyLong_AsUnsignedLongMask(value);
#else #else
#ifndef HAVE_LONG_LONG #ifndef HAVE_LONG_LONG
# error "PyLong_AsVoidPtr: sizeof(void*) > sizeof(long), but no long long" # error "PyLong_AsVoidPtr: sizeof(void*) > sizeof(long), but no long long"
#elif SIZEOF_LONG_LONG < SIZEOF_VOID_P #elif SIZEOF_LONG_LONG < SIZEOF_VOID_P
# error "PyLong_AsVoidPtr: sizeof(PY_LONG_LONG) < sizeof(void*)" # error "PyLong_AsVoidPtr: sizeof(PY_LONG_LONG) < sizeof(void*)"
#endif #endif
v = (void *)PyInt_AsUnsignedLongLongMask(value); v = (void *)PyLong_AsUnsignedLongLongMask(value);
#endif #endif
if (PyErr_Occurred()) if (PyErr_Occurred())

View File

@ -311,7 +311,7 @@ StructUnionType_update_stgdict(PyObject *type, PyObject *fields, int isStruct)
isPacked = PyObject_GetAttrString(type, "_pack_"); isPacked = PyObject_GetAttrString(type, "_pack_");
if (isPacked) { if (isPacked) {
pack = PyInt_AsLong(isPacked); pack = PyLong_AsLong(isPacked);
if (pack < 0 || PyErr_Occurred()) { if (pack < 0 || PyErr_Occurred()) {
Py_XDECREF(isPacked); Py_XDECREF(isPacked);
PyErr_SetString(PyExc_ValueError, PyErr_SetString(PyExc_ValueError,

View File

@ -197,7 +197,7 @@ static int
PyCurses_ConvertToChtype(PyObject *obj, chtype *ch) PyCurses_ConvertToChtype(PyObject *obj, chtype *ch)
{ {
if (PyInt_CheckExact(obj)) { if (PyInt_CheckExact(obj)) {
*ch = (chtype) PyInt_AsLong(obj); *ch = (chtype) PyLong_AsLong(obj);
} else if(PyString_Check(obj) } else if(PyString_Check(obj)
&& (PyString_Size(obj) == 1)) { && (PyString_Size(obj) == 1)) {
*ch = (chtype) *PyString_AsString(obj); *ch = (chtype) *PyString_AsString(obj);
@ -777,14 +777,14 @@ PyCursesWindow_Enclose(PyCursesWindowObject *self, PyObject *args)
if (!PyArg_ParseTuple(args,"ii;y,x", &y, &x)) if (!PyArg_ParseTuple(args,"ii;y,x", &y, &x))
return NULL; return NULL;
return PyInt_FromLong( wenclose(self->win,y,x) ); return PyLong_FromLong( wenclose(self->win,y,x) );
} }
#endif #endif
static PyObject * static PyObject *
PyCursesWindow_GetBkgd(PyCursesWindowObject *self) PyCursesWindow_GetBkgd(PyCursesWindowObject *self)
{ {
return PyInt_FromLong((long) getbkgd(self->win)); return PyLong_FromLong((long) getbkgd(self->win));
} }
static PyObject * static PyObject *
@ -810,7 +810,7 @@ PyCursesWindow_GetCh(PyCursesWindowObject *self, PyObject *args)
PyErr_SetString(PyExc_TypeError, "getch requires 0 or 2 arguments"); PyErr_SetString(PyExc_TypeError, "getch requires 0 or 2 arguments");
return NULL; return NULL;
} }
return PyInt_FromLong((long)rtn); return PyLong_FromLong((long)rtn);
} }
static PyObject * static PyObject *
@ -1012,7 +1012,7 @@ PyCursesWindow_InCh(PyCursesWindowObject *self, PyObject *args)
PyErr_SetString(PyExc_TypeError, "inch requires 0 or 2 arguments"); PyErr_SetString(PyExc_TypeError, "inch requires 0 or 2 arguments");
return NULL; return NULL;
} }
return PyInt_FromLong((long) rtn); return PyLong_FromLong((long) rtn);
} }
static PyObject * static PyObject *
@ -1679,7 +1679,7 @@ PyCurses_color_pair(PyObject *self, PyObject *args)
PyCursesInitialisedColor PyCursesInitialisedColor
if (!PyArg_ParseTuple(args, "i:color_pair", &n)) return NULL; if (!PyArg_ParseTuple(args, "i:color_pair", &n)) return NULL;
return PyInt_FromLong((long) (n << 8)); return PyLong_FromLong((long) (n << 8));
} }
static PyObject * static PyObject *
@ -1694,7 +1694,7 @@ PyCurses_Curs_Set(PyObject *self, PyObject *args)
erg = curs_set(vis); erg = curs_set(vis);
if (erg == ERR) return PyCursesCheckERR(erg, "curs_set"); if (erg == ERR) return PyCursesCheckERR(erg, "curs_set");
return PyInt_FromLong((long) erg); return PyLong_FromLong((long) erg);
} }
static PyObject * static PyObject *
@ -1912,7 +1912,7 @@ PyCurses_InitScr(PyObject *self)
where they're not defined until you've called initscr() */ where they're not defined until you've called initscr() */
#define SetDictInt(string,ch) \ #define SetDictInt(string,ch) \
do { \ do { \
PyObject *o = PyInt_FromLong((long) (ch)); \ PyObject *o = PyLong_FromLong((long) (ch)); \
if (o && PyDict_SetItemString(ModDict, string, o) == 0) { \ if (o && PyDict_SetItemString(ModDict, string, o) == 0) { \
Py_DECREF(o); \ Py_DECREF(o); \
} \ } \
@ -2269,7 +2269,7 @@ PyCurses_pair_number(PyObject *self, PyObject *args)
return NULL; return NULL;
} }
return PyInt_FromLong((long) ((n & A_COLOR) >> 8)); return PyLong_FromLong((long) ((n & A_COLOR) >> 8));
} }
static PyObject * static PyObject *
@ -2316,7 +2316,7 @@ update_lines_cols(void)
if (!m) if (!m)
return 0; return 0;
o = PyInt_FromLong(LINES); o = PyLong_FromLong(LINES);
if (!o) { if (!o) {
Py_DECREF(m); Py_DECREF(m);
return 0; return 0;
@ -2332,7 +2332,7 @@ update_lines_cols(void)
return 0; return 0;
} }
Py_DECREF(o); Py_DECREF(o);
o = PyInt_FromLong(COLS); o = PyLong_FromLong(COLS);
if (!o) { if (!o) {
Py_DECREF(m); Py_DECREF(m);
return 0; return 0;
@ -2429,10 +2429,10 @@ PyCurses_Start_Color(PyObject *self)
code = start_color(); code = start_color();
if (code != ERR) { if (code != ERR) {
initialisedcolors = TRUE; initialisedcolors = TRUE;
c = PyInt_FromLong((long) COLORS); c = PyLong_FromLong((long) COLORS);
PyDict_SetItemString(ModDict, "COLORS", c); PyDict_SetItemString(ModDict, "COLORS", c);
Py_DECREF(c); Py_DECREF(c);
cp = PyInt_FromLong((long) COLOR_PAIRS); cp = PyLong_FromLong((long) COLOR_PAIRS);
PyDict_SetItemString(ModDict, "COLOR_PAIRS", cp); PyDict_SetItemString(ModDict, "COLOR_PAIRS", cp);
Py_DECREF(cp); Py_DECREF(cp);
Py_INCREF(Py_None); Py_INCREF(Py_None);
@ -2453,7 +2453,7 @@ PyCurses_tigetflag(PyObject *self, PyObject *args)
if (!PyArg_ParseTuple(args, "z", &capname)) if (!PyArg_ParseTuple(args, "z", &capname))
return NULL; return NULL;
return PyInt_FromLong( (long) tigetflag( capname ) ); return PyLong_FromLong( (long) tigetflag( capname ) );
} }
static PyObject * static PyObject *
@ -2466,7 +2466,7 @@ PyCurses_tigetnum(PyObject *self, PyObject *args)
if (!PyArg_ParseTuple(args, "z", &capname)) if (!PyArg_ParseTuple(args, "z", &capname))
return NULL; return NULL;
return PyInt_FromLong( (long) tigetnum( capname ) ); return PyLong_FromLong( (long) tigetnum( capname ) );
} }
static PyObject * static PyObject *

View File

@ -677,7 +677,7 @@ element_deepcopy(ElementObject* self, PyObject* args)
} }
/* add object to memo dictionary (so deepcopy won't visit it again) */ /* 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); i = PyDict_SetItem(memo, id, (PyObject*) element);

View File

@ -326,7 +326,7 @@ fileio_fileno(PyFileIOObject *self)
{ {
if (self->fd < 0) if (self->fd < 0)
return err_closed(); return err_closed();
return PyInt_FromLong((long) self->fd); return PyLong_FromLong((long) self->fd);
} }
static PyObject * static PyObject *
@ -388,7 +388,7 @@ fileio_readinto(PyFileIOObject *self, PyObject *args)
return NULL; return NULL;
} }
return PyInt_FromSsize_t(n); return PyLong_FromSsize_t(n);
} }
#define DEFAULT_BUFFER_SIZE (8*1024) #define DEFAULT_BUFFER_SIZE (8*1024)
@ -521,7 +521,7 @@ fileio_write(PyFileIOObject *self, PyObject *args)
return NULL; return NULL;
} }
return PyInt_FromSsize_t(n); return PyLong_FromSsize_t(n);
} }
/* XXX Windows support below is likely incomplete */ /* XXX Windows support below is likely incomplete */
@ -561,10 +561,10 @@ portable_lseek(int fd, PyObject *posobj, int whence)
return NULL; return NULL;
} }
#if !defined(HAVE_LARGEFILE_SUPPORT) #if !defined(HAVE_LARGEFILE_SUPPORT)
pos = PyInt_AsLong(posobj); pos = PyLong_AsLong(posobj);
#else #else
pos = PyLong_Check(posobj) ? pos = PyLong_Check(posobj) ?
PyLong_AsLongLong(posobj) : PyInt_AsLong(posobj); PyLong_AsLongLong(posobj) : PyLong_AsLong(posobj);
#endif #endif
if (PyErr_Occurred()) if (PyErr_Occurred())
return NULL; return NULL;
@ -581,7 +581,7 @@ portable_lseek(int fd, PyObject *posobj, int whence)
return PyErr_SetFromErrno(PyExc_IOError); return PyErr_SetFromErrno(PyExc_IOError);
#if !defined(HAVE_LARGEFILE_SUPPORT) #if !defined(HAVE_LARGEFILE_SUPPORT)
return PyInt_FromLong(res); return PyLong_FromLong(res);
#else #else
return PyLong_FromLongLong(res); return PyLong_FromLongLong(res);
#endif #endif
@ -639,10 +639,10 @@ fileio_truncate(PyFileIOObject *self, PyObject *args)
} }
#if !defined(HAVE_LARGEFILE_SUPPORT) #if !defined(HAVE_LARGEFILE_SUPPORT)
pos = PyInt_AsLong(posobj); pos = PyLong_AsLong(posobj);
#else #else
pos = PyLong_Check(posobj) ? pos = PyLong_Check(posobj) ?
PyLong_AsLongLong(posobj) : PyInt_AsLong(posobj); PyLong_AsLongLong(posobj) : PyLong_AsLong(posobj);
#endif #endif
if (PyErr_Occurred()) { if (PyErr_Occurred()) {
Py_DECREF(posobj); Py_DECREF(posobj);

View File

@ -203,13 +203,13 @@ static PyMethodDef EVP_methods[] = {
static PyObject * static PyObject *
EVP_get_block_size(EVPobject *self, void *closure) 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 * static PyObject *
EVP_get_digest_size(EVPobject *self, void *closure) 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[] = { static PyMemberDef EVP_members[] = {

View File

@ -71,7 +71,7 @@ copy_grouping(char* s)
i = -1; i = -1;
do { do {
i++; i++;
val = PyInt_FromLong(s[i]); val = PyLong_FromLong(s[i]);
if (!val) if (!val)
break; break;
if (PyList_SetItem(result, i, val)) { if (PyList_SetItem(result, i, val)) {
@ -149,7 +149,7 @@ PyLocale_localeconv(PyObject* self)
Py_XDECREF(x) Py_XDECREF(x)
#define RESULT_INT(i)\ #define RESULT_INT(i)\
x = PyInt_FromLong(l->i);\ x = PyLong_FromLong(l->i);\
if (!x) goto failed;\ if (!x) goto failed;\
PyDict_SetItemString(result, #i, x);\ PyDict_SetItemString(result, #i, x);\
Py_XDECREF(x) Py_XDECREF(x)
@ -202,7 +202,7 @@ PyLocale_strcoll(PyObject* self, PyObject* args)
if (!PyArg_ParseTuple(args, "ss:strcoll", &s1, &s2)) if (!PyArg_ParseTuple(args, "ss:strcoll", &s1, &s2))
return NULL; return NULL;
return PyInt_FromLong(strcoll(s1, s2)); return PyLong_FromLong(strcoll(s1, s2));
#else #else
PyObject *os1, *os2, *result = NULL; PyObject *os1, *os2, *result = NULL;
wchar_t *ws1 = NULL, *ws2 = NULL; wchar_t *ws1 = NULL, *ws2 = NULL;
@ -234,7 +234,7 @@ PyLocale_strcoll(PyObject* self, PyObject* args)
goto done; goto done;
ws2[len2 - 1] = 0; ws2[len2 - 1] = 0;
/* Collate the strings. */ /* Collate the strings. */
result = PyInt_FromLong(wcscoll(ws1, ws2)); result = PyLong_FromLong(wcscoll(ws1, ws2));
done: done:
/* Deallocate everything. */ /* Deallocate everything. */
if (ws1) PyMem_FREE(ws1); if (ws1) PyMem_FREE(ws1);
@ -628,37 +628,37 @@ init_locale(void)
d = PyModule_GetDict(m); d = PyModule_GetDict(m);
x = PyInt_FromLong(LC_CTYPE); x = PyLong_FromLong(LC_CTYPE);
PyDict_SetItemString(d, "LC_CTYPE", x); PyDict_SetItemString(d, "LC_CTYPE", x);
Py_XDECREF(x); Py_XDECREF(x);
x = PyInt_FromLong(LC_TIME); x = PyLong_FromLong(LC_TIME);
PyDict_SetItemString(d, "LC_TIME", x); PyDict_SetItemString(d, "LC_TIME", x);
Py_XDECREF(x); Py_XDECREF(x);
x = PyInt_FromLong(LC_COLLATE); x = PyLong_FromLong(LC_COLLATE);
PyDict_SetItemString(d, "LC_COLLATE", x); PyDict_SetItemString(d, "LC_COLLATE", x);
Py_XDECREF(x); Py_XDECREF(x);
x = PyInt_FromLong(LC_MONETARY); x = PyLong_FromLong(LC_MONETARY);
PyDict_SetItemString(d, "LC_MONETARY", x); PyDict_SetItemString(d, "LC_MONETARY", x);
Py_XDECREF(x); Py_XDECREF(x);
#ifdef LC_MESSAGES #ifdef LC_MESSAGES
x = PyInt_FromLong(LC_MESSAGES); x = PyLong_FromLong(LC_MESSAGES);
PyDict_SetItemString(d, "LC_MESSAGES", x); PyDict_SetItemString(d, "LC_MESSAGES", x);
Py_XDECREF(x); Py_XDECREF(x);
#endif /* LC_MESSAGES */ #endif /* LC_MESSAGES */
x = PyInt_FromLong(LC_NUMERIC); x = PyLong_FromLong(LC_NUMERIC);
PyDict_SetItemString(d, "LC_NUMERIC", x); PyDict_SetItemString(d, "LC_NUMERIC", x);
Py_XDECREF(x); Py_XDECREF(x);
x = PyInt_FromLong(LC_ALL); x = PyLong_FromLong(LC_ALL);
PyDict_SetItemString(d, "LC_ALL", x); PyDict_SetItemString(d, "LC_ALL", x);
Py_XDECREF(x); Py_XDECREF(x);
x = PyInt_FromLong(CHAR_MAX); x = PyLong_FromLong(CHAR_MAX);
PyDict_SetItemString(d, "CHAR_MAX", x); PyDict_SetItemString(d, "CHAR_MAX", x);
Py_XDECREF(x); Py_XDECREF(x);

View File

@ -259,7 +259,7 @@ random_seed(RandomObject *self, PyObject *args)
masklower = PyLong_FromUnsignedLong(0xffffffffU); masklower = PyLong_FromUnsignedLong(0xffffffffU);
if (masklower == NULL) if (masklower == NULL)
goto Done; goto Done;
thirtytwo = PyInt_FromLong(32L); thirtytwo = PyLong_FromLong(32L);
if (thirtytwo == NULL) if (thirtytwo == NULL)
goto Done; goto Done;
while ((err=PyObject_IsTrue(n))) { while ((err=PyObject_IsTrue(n))) {
@ -319,12 +319,12 @@ random_getstate(RandomObject *self)
if (state == NULL) if (state == NULL)
return NULL; return NULL;
for (i=0; i<N ; i++) { for (i=0; i<N ; i++) {
element = PyInt_FromLong((long)(self->state[i])); element = PyLong_FromLong((long)(self->state[i]));
if (element == NULL) if (element == NULL)
goto Fail; goto Fail;
PyTuple_SET_ITEM(state, i, element); PyTuple_SET_ITEM(state, i, element);
} }
element = PyInt_FromLong((long)(self->index)); element = PyLong_FromLong((long)(self->index));
if (element == NULL) if (element == NULL)
goto Fail; goto Fail;
PyTuple_SET_ITEM(state, i, element); PyTuple_SET_ITEM(state, i, element);
@ -353,13 +353,13 @@ random_setstate(RandomObject *self, PyObject *state)
} }
for (i=0; i<N ; i++) { for (i=0; i<N ; i++) {
element = PyInt_AsLong(PyTuple_GET_ITEM(state, i)); element = PyLong_AsLong(PyTuple_GET_ITEM(state, i));
if (element == -1 && PyErr_Occurred()) if (element == -1 && PyErr_Occurred())
return NULL; return NULL;
self->state[i] = (unsigned long)element; self->state[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()) if (element == -1 && PyErr_Occurred())
return NULL; return NULL;
self->index = (int)element; self->index = (int)element;
@ -410,14 +410,14 @@ random_jumpahead(RandomObject *self, PyObject *n)
mt = self->state; mt = self->state;
for (i = N-1; i > 1; i--) { for (i = N-1; i > 1; i--) {
iobj = PyInt_FromLong(i); iobj = PyLong_FromLong(i);
if (iobj == NULL) if (iobj == NULL)
return NULL; return NULL;
remobj = PyNumber_Remainder(n, iobj); remobj = PyNumber_Remainder(n, iobj);
Py_DECREF(iobj); Py_DECREF(iobj);
if (remobj == NULL) if (remobj == NULL)
return NULL; return NULL;
j = PyInt_AsLong(remobj); j = PyLong_AsLong(remobj);
Py_DECREF(remobj); Py_DECREF(remobj);
if (j == -1L && PyErr_Occurred()) if (j == -1L && PyErr_Occurred())
return NULL; return NULL;

View File

@ -420,8 +420,8 @@ void _pysqlite_set_result(sqlite3_context* context, PyObject* py_val)
sqlite3_result_null(context); sqlite3_result_null(context);
} else if (py_val == Py_None) { } else if (py_val == Py_None) {
sqlite3_result_null(context); sqlite3_result_null(context);
} else if (PyInt_Check(py_val)) { } else if (PyLong_Check(py_val)) {
longval = PyInt_AsLong(py_val); longval = PyLong_AsLong(py_val);
sqlite3_result_int64(context, (PY_LONG_LONG)longval); sqlite3_result_int64(context, (PY_LONG_LONG)longval);
} else if (PyFloat_Check(py_val)) { } else if (PyFloat_Check(py_val)) {
sqlite3_result_double(context, PyFloat_AsDouble(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])) { switch (sqlite3_value_type(argv[i])) {
case SQLITE_INTEGER: case SQLITE_INTEGER:
val_int = sqlite3_value_int64(cur_value); val_int = sqlite3_value_int64(cur_value);
cur_py_value = PyInt_FromLong((long)val_int); cur_py_value = PyLong_FromLong((long)val_int);
break; break;
case SQLITE_FLOAT: case SQLITE_FLOAT:
cur_py_value = PyFloat_FromDouble(sqlite3_value_double(cur_value)); 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; rc = SQLITE_DENY;
} else { } else {
if (PyInt_Check(ret)) { if (PyLong_Check(ret)) {
rc = (int)PyInt_AsLong(ret); rc = (int)PyLong_AsLong(ret);
} else { } else {
rc = SQLITE_DENY; rc = SQLITE_DENY;
} }
@ -1036,7 +1036,7 @@ pysqlite_collation_callback(
goto finally; goto finally;
} }
result = PyInt_AsLong(retval); result = PyLong_AsLong(retval);
if (PyErr_Occurred()) { if (PyErr_Occurred()) {
result = 0; result = 0;
} }

View File

@ -26,7 +26,7 @@
#include "util.h" #include "util.h"
#include "sqlitecompat.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 #ifndef INT32_MIN
#define INT32_MIN (-2147483647 - 1) #define INT32_MIN (-2147483647 - 1)
#endif #endif
@ -101,7 +101,7 @@ int pysqlite_cursor_init(pysqlite_Cursor* self, PyObject* args, PyObject* kwargs
self->arraysize = 1; self->arraysize = 1;
self->rowcount = PyInt_FromLong(-1L); self->rowcount = PyLong_FromLong(-1L);
if (!self->rowcount) { if (!self->rowcount) {
return -1; return -1;
} }
@ -344,7 +344,7 @@ PyObject* _pysqlite_fetch_one_row(pysqlite_Cursor* self)
if (intval < INT32_MIN || intval > INT32_MAX) { if (intval < INT32_MIN || intval > INT32_MAX) {
converted = PyLong_FromLongLong(intval); converted = PyLong_FromLongLong(intval);
} else { } else {
converted = PyInt_FromLong((long)intval); converted = PyLong_FromLong((long)intval);
} }
} else if (coltype == SQLITE_FLOAT) { } else if (coltype == SQLITE_FLOAT) {
converted = PyFloat_FromDouble(sqlite3_column_double(self->statement->st, i)); 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; self->description = Py_None;
Py_DECREF(self->rowcount); Py_DECREF(self->rowcount);
self->rowcount = PyInt_FromLong(-1L); self->rowcount = PyLong_FromLong(-1L);
if (!self->rowcount) { if (!self->rowcount) {
goto error; goto error;
} }
@ -680,7 +680,7 @@ PyObject* _pysqlite_query_execute(pysqlite_Cursor* self, int multiple, PyObject*
rowcount += (long)sqlite3_changes(self->connection->db); rowcount += (long)sqlite3_changes(self->connection->db);
Py_END_ALLOW_THREADS Py_END_ALLOW_THREADS
Py_DECREF(self->rowcount); Py_DECREF(self->rowcount);
self->rowcount = PyInt_FromLong(rowcount); self->rowcount = PyLong_FromLong(rowcount);
} }
Py_DECREF(self->lastrowid); Py_DECREF(self->lastrowid);
@ -688,7 +688,7 @@ PyObject* _pysqlite_query_execute(pysqlite_Cursor* self, int multiple, PyObject*
Py_BEGIN_ALLOW_THREADS Py_BEGIN_ALLOW_THREADS
lastrowid = sqlite3_last_insert_rowid(self->connection->db); lastrowid = sqlite3_last_insert_rowid(self->connection->db);
Py_END_ALLOW_THREADS Py_END_ALLOW_THREADS
self->lastrowid = PyInt_FromLong((long)lastrowid); self->lastrowid = PyLong_FromLong((long)lastrowid);
} else { } else {
Py_INCREF(Py_None); Py_INCREF(Py_None);
self->lastrowid = Py_None; self->lastrowid = Py_None;

View File

@ -351,7 +351,7 @@ PyMODINIT_FUNC init_sqlite3(void)
/* Set integer constants */ /* Set integer constants */
for (i = 0; _int_constants[i].constant_name != 0; i++) { 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) { if (!tmp_obj) {
goto error; goto error;
} }

View File

@ -2756,8 +2756,8 @@ match_getindex(MatchObject* self, PyObject* index)
/* Default value */ /* Default value */
return 0; return 0;
if (PyInt_Check(index)) if (PyLong_Check(index))
return PyInt_AsSsize_t(index); return PyLong_AsSsize_t(index);
i = -1; i = -1;
@ -2765,7 +2765,7 @@ match_getindex(MatchObject* self, PyObject* index)
index = PyObject_GetItem(self->pattern->groupindex, index); index = PyObject_GetItem(self->pattern->groupindex, index);
if (index) { if (index) {
if (PyLong_Check(index)) if (PyLong_Check(index))
i = PyInt_AsSsize_t(index); i = PyLong_AsSsize_t(index);
Py_DECREF(index); Py_DECREF(index);
} else } else
PyErr_Clear(); PyErr_Clear();
@ -2957,12 +2957,12 @@ _pair(Py_ssize_t i1, Py_ssize_t i2)
if (!pair) if (!pair)
return NULL; return NULL;
item = PyInt_FromSsize_t(i1); item = PyLong_FromSsize_t(i1);
if (!item) if (!item)
goto error; goto error;
PyTuple_SET_ITEM(pair, 0, item); PyTuple_SET_ITEM(pair, 0, item);
item = PyInt_FromSsize_t(i2); item = PyLong_FromSsize_t(i2);
if (!item) if (!item)
goto error; goto error;
PyTuple_SET_ITEM(pair, 1, item); PyTuple_SET_ITEM(pair, 1, item);
@ -3397,13 +3397,13 @@ PyMODINIT_FUNC init_sre(void)
return; return;
d = PyModule_GetDict(m); d = PyModule_GetDict(m);
x = PyInt_FromLong(SRE_MAGIC); x = PyLong_FromLong(SRE_MAGIC);
if (x) { if (x) {
PyDict_SetItemString(d, "MAGIC", x); PyDict_SetItemString(d, "MAGIC", x);
Py_DECREF(x); Py_DECREF(x);
} }
x = PyInt_FromLong(sizeof(SRE_CODE)); x = PyLong_FromLong(sizeof(SRE_CODE));
if (x) { if (x) {
PyDict_SetItemString(d, "CODESIZE", x); PyDict_SetItemString(d, "CODESIZE", x);
Py_DECREF(x); Py_DECREF(x);

View File

@ -818,7 +818,7 @@ _decode_certificate (X509 *certificate, int verbose) {
} }
Py_DECREF(issuer); 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) { if (PyDict_SetItemString(retval, "version", version) < 0) {
Py_DECREF(version); Py_DECREF(version);
goto fail0; goto fail0;
@ -1039,7 +1039,7 @@ static PyObject *PySSL_cipher (PySSLObject *self) {
goto fail0; goto fail0;
PyTuple_SET_ITEM(retval, 1, v); 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) if (v == NULL)
goto fail0; goto fail0;
PyTuple_SET_ITEM(retval, 2, v); 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); } while (err == SSL_ERROR_WANT_READ || err == SSL_ERROR_WANT_WRITE);
if (len > 0) if (len > 0)
return PyInt_FromLong(len); return PyLong_FromLong(len);
else else
return PySSL_SetError(self, len, __FILE__, __LINE__); return PySSL_SetError(self, len, __FILE__, __LINE__);
} }
@ -1215,7 +1215,7 @@ static PyObject *PySSL_SSLpending(PySSLObject *self)
if (count < 0) if (count < 0)
return PySSL_SetError(self, count, __FILE__, __LINE__); return PySSL_SetError(self, count, __FILE__, __LINE__);
else else
return PyInt_FromLong(count); return PyLong_FromLong(count);
} }
PyDoc_STRVAR(PySSL_SSLpending_doc, 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 == NULL) || (buf == Py_None)) {
if (!(buf = PyBytes_FromStringAndSize((char *) 0, len))) if (!(buf = PyBytes_FromStringAndSize((char *) 0, len)))
return NULL; return NULL;
} else if (PyInt_Check(buf)) { } else if (PyLong_Check(buf)) {
len = PyInt_AS_LONG(buf); len = PyLong_AS_LONG(buf);
if (!(buf = PyBytes_FromStringAndSize((char *) 0, len))) if (!(buf = PyBytes_FromStringAndSize((char *) 0, len)))
return NULL; return NULL;
} else { } else {
@ -1336,7 +1336,7 @@ static PyObject *PySSL_SSLread(PySSLObject *self, PyObject *args)
Py_DECREF(buf); Py_DECREF(buf);
return res; return res;
} else { } 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 * static PyObject *
PySSL_RAND_status(PyObject *self) PySSL_RAND_status(PyObject *self)
{ {
return PyInt_FromLong(RAND_status()); return PyLong_FromLong(RAND_status());
} }
PyDoc_STRVAR(PySSL_RAND_status_doc, PyDoc_STRVAR(PySSL_RAND_status_doc,
@ -1434,7 +1434,7 @@ PySSL_RAND_egd(PyObject *self, PyObject *arg)
"enough data to seed the PRNG"); "enough data to seed the PRNG");
return NULL; return NULL;
} }
return PyInt_FromLong(bytes); return PyLong_FromLong(bytes);
} }
PyDoc_STRVAR(PySSL_RAND_egd_doc, PyDoc_STRVAR(PySSL_RAND_egd_doc,

View File

@ -146,7 +146,7 @@ get_pylong(PyObject *v)
static int static int
get_long(PyObject *v, long *p) get_long(PyObject *v, long *p)
{ {
long x = PyInt_AsLong(v); long x = PyLong_AsLong(v);
if (x == -1 && PyErr_Occurred()) { if (x == -1 && PyErr_Occurred()) {
#ifdef PY_STRUCT_FLOAT_COERCE #ifdef PY_STRUCT_FLOAT_COERCE
if (PyFloat_Check(v)) { if (PyFloat_Check(v)) {
@ -445,13 +445,13 @@ nu_char(const char *p, const formatdef *f)
static PyObject * static PyObject *
nu_byte(const char *p, const formatdef *f) nu_byte(const char *p, const formatdef *f)
{ {
return PyInt_FromLong((long) *(signed char *)p); return PyLong_FromLong((long) *(signed char *)p);
} }
static PyObject * static PyObject *
nu_ubyte(const char *p, const formatdef *f) nu_ubyte(const char *p, const formatdef *f)
{ {
return PyInt_FromLong((long) *(unsigned char *)p); return PyLong_FromLong((long) *(unsigned char *)p);
} }
static PyObject * static PyObject *
@ -459,7 +459,7 @@ nu_short(const char *p, const formatdef *f)
{ {
short x; short x;
memcpy((char *)&x, p, sizeof x); memcpy((char *)&x, p, sizeof x);
return PyInt_FromLong((long)x); return PyLong_FromLong((long)x);
} }
static PyObject * static PyObject *
@ -467,7 +467,7 @@ nu_ushort(const char *p, const formatdef *f)
{ {
unsigned short x; unsigned short x;
memcpy((char *)&x, p, sizeof x); memcpy((char *)&x, p, sizeof x);
return PyInt_FromLong((long)x); return PyLong_FromLong((long)x);
} }
static PyObject * static PyObject *
@ -475,7 +475,7 @@ nu_int(const char *p, const formatdef *f)
{ {
int x; int x;
memcpy((char *)&x, p, sizeof x); memcpy((char *)&x, p, sizeof x);
return PyInt_FromLong((long)x); return PyLong_FromLong((long)x);
} }
static PyObject * static PyObject *
@ -484,10 +484,10 @@ nu_uint(const char *p, const formatdef *f)
unsigned int x; unsigned int x;
memcpy((char *)&x, p, sizeof x); memcpy((char *)&x, p, sizeof x);
#if (SIZEOF_LONG > SIZEOF_INT) #if (SIZEOF_LONG > SIZEOF_INT)
return PyInt_FromLong((long)x); return PyLong_FromLong((long)x);
#else #else
if (x <= ((unsigned int)LONG_MAX)) if (x <= ((unsigned int)LONG_MAX))
return PyInt_FromLong((long)x); return PyLong_FromLong((long)x);
return PyLong_FromUnsignedLong((unsigned long)x); return PyLong_FromUnsignedLong((unsigned long)x);
#endif #endif
} }
@ -497,7 +497,7 @@ nu_long(const char *p, const formatdef *f)
{ {
long x; long x;
memcpy((char *)&x, p, sizeof x); memcpy((char *)&x, p, sizeof x);
return PyInt_FromLong(x); return PyLong_FromLong(x);
} }
static PyObject * static PyObject *
@ -506,7 +506,7 @@ nu_ulong(const char *p, const formatdef *f)
unsigned long x; unsigned long x;
memcpy((char *)&x, p, sizeof x); memcpy((char *)&x, p, sizeof x);
if (x <= LONG_MAX) if (x <= LONG_MAX)
return PyInt_FromLong((long)x); return PyLong_FromLong((long)x);
return PyLong_FromUnsignedLong(x); return PyLong_FromUnsignedLong(x);
} }
@ -521,7 +521,7 @@ nu_longlong(const char *p, const formatdef *f)
PY_LONG_LONG x; PY_LONG_LONG x;
memcpy((char *)&x, p, sizeof x); memcpy((char *)&x, p, sizeof x);
if (x >= LONG_MIN && x <= LONG_MAX) 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); return PyLong_FromLongLong(x);
} }
@ -531,7 +531,7 @@ nu_ulonglong(const char *p, const formatdef *f)
unsigned PY_LONG_LONG x; unsigned PY_LONG_LONG x;
memcpy((char *)&x, p, sizeof x); memcpy((char *)&x, p, sizeof x);
if (x <= LONG_MAX) 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); return PyLong_FromUnsignedLongLong(x);
} }
@ -818,7 +818,7 @@ bu_int(const char *p, const formatdef *f)
/* Extend the sign bit. */ /* Extend the sign bit. */
if (SIZEOF_LONG > f->size) if (SIZEOF_LONG > f->size)
x |= -(x & (1L << ((8 * f->size) - 1))); x |= -(x & (1L << ((8 * f->size) - 1)));
return PyInt_FromLong(x); return PyLong_FromLong(x);
} }
static PyObject * static PyObject *
@ -831,7 +831,7 @@ bu_uint(const char *p, const formatdef *f)
x = (x<<8) | *bytes++; x = (x<<8) | *bytes++;
} while (--i > 0); } while (--i > 0);
if (x <= LONG_MAX) if (x <= LONG_MAX)
return PyInt_FromLong((long)x); return PyLong_FromLong((long)x);
return PyLong_FromUnsignedLong(x); return PyLong_FromUnsignedLong(x);
} }
@ -849,7 +849,7 @@ bu_longlong(const char *p, const formatdef *f)
if (SIZEOF_LONG_LONG > f->size) if (SIZEOF_LONG_LONG > f->size)
x |= -(x & ((PY_LONG_LONG)1 << ((8 * f->size) - 1))); x |= -(x & ((PY_LONG_LONG)1 << ((8 * f->size) - 1)));
if (x >= LONG_MIN && x <= LONG_MAX) 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); return PyLong_FromLongLong(x);
#else #else
return _PyLong_FromByteArray((const unsigned char *)p, return _PyLong_FromByteArray((const unsigned char *)p,
@ -870,7 +870,7 @@ bu_ulonglong(const char *p, const formatdef *f)
x = (x<<8) | *bytes++; x = (x<<8) | *bytes++;
} while (--i > 0); } while (--i > 0);
if (x <= LONG_MAX) 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); return PyLong_FromUnsignedLongLong(x);
#else #else
return _PyLong_FromByteArray((const unsigned char *)p, return _PyLong_FromByteArray((const unsigned char *)p,
@ -1054,7 +1054,7 @@ lu_int(const char *p, const formatdef *f)
/* Extend the sign bit. */ /* Extend the sign bit. */
if (SIZEOF_LONG > f->size) if (SIZEOF_LONG > f->size)
x |= -(x & (1L << ((8 * f->size) - 1))); x |= -(x & (1L << ((8 * f->size) - 1)));
return PyInt_FromLong(x); return PyLong_FromLong(x);
} }
static PyObject * static PyObject *
@ -1067,7 +1067,7 @@ lu_uint(const char *p, const formatdef *f)
x = (x<<8) | bytes[--i]; x = (x<<8) | bytes[--i];
} while (i > 0); } while (i > 0);
if (x <= LONG_MAX) if (x <= LONG_MAX)
return PyInt_FromLong((long)x); return PyLong_FromLong((long)x);
return PyLong_FromUnsignedLong((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) if (SIZEOF_LONG_LONG > f->size)
x |= -(x & ((PY_LONG_LONG)1 << ((8 * f->size) - 1))); x |= -(x & ((PY_LONG_LONG)1 << ((8 * f->size) - 1)));
if (x >= LONG_MIN && x <= LONG_MAX) 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); return PyLong_FromLongLong(x);
#else #else
return _PyLong_FromByteArray((const unsigned char *)p, return _PyLong_FromByteArray((const unsigned char *)p,
@ -1106,7 +1106,7 @@ lu_ulonglong(const char *p, const formatdef *f)
x = (x<<8) | bytes[--i]; x = (x<<8) | bytes[--i];
} while (i > 0); } while (i > 0);
if (x <= LONG_MAX) 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); return PyLong_FromUnsignedLongLong(x);
#else #else
return _PyLong_FromByteArray((const unsigned char *)p, return _PyLong_FromByteArray((const unsigned char *)p,
@ -1762,7 +1762,7 @@ s_pack_into(PyObject *self, PyObject *args)
assert( buffer_len >= 0 ); assert( buffer_len >= 0 );
/* Extract the offset from the first argument */ /* 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. */ /* Support negative offsets. */
if (offset < 0) if (offset < 0)
@ -1794,7 +1794,7 @@ s_get_format(PyStructObject *self, void *unused)
static PyObject * static PyObject *
s_get_size(PyStructObject *self, void *unused) s_get_size(PyStructObject *self, void *unused)
{ {
return PyInt_FromSsize_t(self->s_size); return PyLong_FromSsize_t(self->s_size);
} }
/* List of functions */ /* List of functions */
@ -1876,7 +1876,7 @@ init_struct(void)
#ifdef PY_STRUCT_OVERFLOW_MASKING #ifdef PY_STRUCT_OVERFLOW_MASKING
if (pyint_zero == NULL) { if (pyint_zero == NULL) {
pyint_zero = PyInt_FromLong(0); pyint_zero = PyLong_FromLong(0);
if (pyint_zero == NULL) if (pyint_zero == NULL)
return; return;
} }

View File

@ -85,7 +85,7 @@ test_list_api(PyObject *self)
return (PyObject*)NULL; return (PyObject*)NULL;
/* list = range(NLIST) */ /* list = range(NLIST) */
for (i = 0; i < NLIST; ++i) { for (i = 0; i < NLIST; ++i) {
PyObject* anint = PyInt_FromLong(i); PyObject* anint = PyLong_FromLong(i);
if (anint == (PyObject*)NULL) { if (anint == (PyObject*)NULL) {
Py_DECREF(list); Py_DECREF(list);
return (PyObject*)NULL; return (PyObject*)NULL;
@ -101,7 +101,7 @@ test_list_api(PyObject *self)
/* Check that list == range(29, -1, -1) now */ /* Check that list == range(29, -1, -1) now */
for (i = 0; i < NLIST; ++i) { for (i = 0; i < NLIST; ++i) {
PyObject* anint = PyList_GET_ITEM(list, 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, PyErr_SetString(TestError,
"test_list_api: reverse screwed up"); "test_list_api: reverse screwed up");
Py_DECREF(list); Py_DECREF(list);
@ -127,7 +127,7 @@ test_dict_inner(int count)
return -1; return -1;
for (i = 0; i < count; i++) { for (i = 0; i < count; i++) {
v = PyInt_FromLong(i); v = PyLong_FromLong(i);
PyDict_SetItem(dict, v, v); PyDict_SetItem(dict, v, v);
Py_DECREF(v); Py_DECREF(v);
} }
@ -136,8 +136,8 @@ test_dict_inner(int count)
PyObject *o; PyObject *o;
iterations++; iterations++;
i = PyInt_AS_LONG(v) + 1; i = PyLong_AS_LONG(v) + 1;
o = PyInt_FromLong(i); o = PyLong_FromLong(i);
if (o == NULL) if (o == NULL)
return -1; return -1;
if (PyDict_SetItem(dict, k, o) < 0) { if (PyDict_SetItem(dict, k, o) < 0) {
@ -278,7 +278,7 @@ test_L_code(PyObject *self)
"L code returned wrong value for long 42"); "L code returned wrong value for long 42");
Py_DECREF(num); Py_DECREF(num);
num = PyInt_FromLong(42); num = PyLong_FromLong(42);
if (num == NULL) if (num == NULL)
return NULL; return NULL;
@ -404,7 +404,7 @@ getargs_K(PyObject *self, PyObject *args)
#endif #endif
/* This function not only tests the 'k' getargs code, but also the /* 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 * static PyObject *
test_k_code(PyObject *self) test_k_code(PyObject *self)
{ {
@ -420,10 +420,10 @@ test_k_code(PyObject *self)
if (num == NULL) if (num == NULL)
return NULL; return NULL;
value = PyInt_AsUnsignedLongMask(num); value = PyLong_AsUnsignedLongMask(num);
if (value != ULONG_MAX) if (value != ULONG_MAX)
return raiseTestError("test_k_code", 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); PyTuple_SET_ITEM(tuple, 0, num);
@ -439,10 +439,10 @@ test_k_code(PyObject *self)
if (num == NULL) if (num == NULL)
return NULL; return NULL;
value = PyInt_AsUnsignedLongMask(num); value = PyLong_AsUnsignedLongMask(num);
if (value != (unsigned long)-0x42) if (value != (unsigned long)-0x42)
return raiseTestError("test_k_code", 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); PyTuple_SET_ITEM(tuple, 0, num);
@ -642,7 +642,7 @@ raise_exception(PyObject *self, PyObject *args)
if (exc_args == NULL) if (exc_args == NULL)
return NULL; return NULL;
for (i = 0; i < num_args; ++i) { for (i = 0; i < num_args; ++i) {
v = PyInt_FromLong(i); v = PyLong_FromLong(i);
if (v == NULL) { if (v == NULL) {
Py_DECREF(exc_args); Py_DECREF(exc_args);
return NULL; return NULL;
@ -796,7 +796,7 @@ profile_int(PyObject *self, PyObject* args)
gettimeofday(&start, NULL); gettimeofday(&start, NULL);
for(k=0; k < 20000; k++) for(k=0; k < 20000; k++)
for(i=0; i < 1000; i++) { for(i=0; i < 1000; i++) {
single = PyInt_FromLong(i); single = PyLong_FromLong(i);
Py_DECREF(single); Py_DECREF(single);
} }
gettimeofday(&stop, NULL); gettimeofday(&stop, NULL);
@ -807,7 +807,7 @@ profile_int(PyObject *self, PyObject* args)
gettimeofday(&start, NULL); gettimeofday(&start, NULL);
for(k=0; k < 20000; k++) for(k=0; k < 20000; k++)
for(i=0; i < 1000; i++) { for(i=0; i < 1000; i++) {
single = PyInt_FromLong(i+1000000); single = PyLong_FromLong(i+1000000);
Py_DECREF(single); Py_DECREF(single);
} }
gettimeofday(&stop, NULL); gettimeofday(&stop, NULL);
@ -819,7 +819,7 @@ profile_int(PyObject *self, PyObject* args)
gettimeofday(&start, NULL); gettimeofday(&start, NULL);
for(k=0; k < 20000; k++) { for(k=0; k < 20000; k++) {
for(i=0; i < 1000; i++) { for(i=0; i < 1000; i++) {
multiple[i] = PyInt_FromLong(i+1000000); multiple[i] = PyLong_FromLong(i+1000000);
} }
for(i=0; i < 1000; i++) { for(i=0; i < 1000; i++) {
Py_DECREF(multiple[i]); Py_DECREF(multiple[i]);
@ -834,7 +834,7 @@ profile_int(PyObject *self, PyObject* args)
gettimeofday(&start, NULL); gettimeofday(&start, NULL);
for(k=0; k < 20; k++) { for(k=0; k < 20; k++) {
for(i=0; i < 1000000; i++) { for(i=0; i < 1000000; i++) {
multiple[i] = PyInt_FromLong(i+1000000); multiple[i] = PyLong_FromLong(i+1000000);
} }
for(i=0; i < 1000000; i++) { for(i=0; i < 1000000; i++) {
Py_DECREF(multiple[i]); Py_DECREF(multiple[i]);
@ -848,7 +848,7 @@ profile_int(PyObject *self, PyObject* args)
gettimeofday(&start, NULL); gettimeofday(&start, NULL);
for(k=0; k < 10; k++) { for(k=0; k < 10; k++) {
for(i=0; i < 1000000; i++) { for(i=0; i < 1000000; i++) {
multiple[i] = PyInt_FromLong(i+1000); multiple[i] = PyLong_FromLong(i+1000);
} }
for(i=0; i < 1000000; i++) { for(i=0; i < 1000000; i++) {
Py_DECREF(multiple[i]); Py_DECREF(multiple[i]);
@ -858,7 +858,7 @@ profile_int(PyObject *self, PyObject* args)
print_delta(5, &start, &stop); print_delta(5, &start, &stop);
/* Test 6: Perform small int addition */ /* Test 6: Perform small int addition */
op1 = PyInt_FromLong(1); op1 = PyLong_FromLong(1);
gettimeofday(&start, NULL); gettimeofday(&start, NULL);
for(i=0; i < 10000000; i++) { for(i=0; i < 10000000; i++) {
result = PyNumber_Add(op1, op1); result = PyNumber_Add(op1, op1);
@ -869,7 +869,7 @@ profile_int(PyObject *self, PyObject* args)
print_delta(6, &start, &stop); print_delta(6, &start, &stop);
/* Test 7: Perform medium int addition */ /* Test 7: Perform medium int addition */
op1 = PyInt_FromLong(1000); op1 = PyLong_FromLong(1000);
gettimeofday(&start, NULL); gettimeofday(&start, NULL);
for(i=0; i < 10000000; i++) { for(i=0; i < 10000000; i++) {
result = PyNumber_Add(op1, op1); result = PyNumber_Add(op1, op1);
@ -1061,17 +1061,17 @@ init_testcapi(void)
Py_INCREF(&test_structmembersType); Py_INCREF(&test_structmembersType);
PyModule_AddObject(m, "test_structmembersType", (PyObject *)&test_structmembersType); PyModule_AddObject(m, "test_structmembersType", (PyObject *)&test_structmembersType);
PyModule_AddObject(m, "CHAR_MAX", PyInt_FromLong(CHAR_MAX)); PyModule_AddObject(m, "CHAR_MAX", PyLong_FromLong(CHAR_MAX));
PyModule_AddObject(m, "CHAR_MIN", PyInt_FromLong(CHAR_MIN)); PyModule_AddObject(m, "CHAR_MIN", PyLong_FromLong(CHAR_MIN));
PyModule_AddObject(m, "UCHAR_MAX", PyInt_FromLong(UCHAR_MAX)); PyModule_AddObject(m, "UCHAR_MAX", PyLong_FromLong(UCHAR_MAX));
PyModule_AddObject(m, "SHRT_MAX", PyInt_FromLong(SHRT_MAX)); PyModule_AddObject(m, "SHRT_MAX", PyLong_FromLong(SHRT_MAX));
PyModule_AddObject(m, "SHRT_MIN", PyInt_FromLong(SHRT_MIN)); PyModule_AddObject(m, "SHRT_MIN", PyLong_FromLong(SHRT_MIN));
PyModule_AddObject(m, "USHRT_MAX", PyInt_FromLong(USHRT_MAX)); PyModule_AddObject(m, "USHRT_MAX", PyLong_FromLong(USHRT_MAX));
PyModule_AddObject(m, "INT_MAX", PyLong_FromLong(INT_MAX)); PyModule_AddObject(m, "INT_MAX", PyLong_FromLong(INT_MAX));
PyModule_AddObject(m, "INT_MIN", PyLong_FromLong(INT_MIN)); PyModule_AddObject(m, "INT_MIN", PyLong_FromLong(INT_MIN));
PyModule_AddObject(m, "UINT_MAX", PyLong_FromUnsignedLong(UINT_MAX)); PyModule_AddObject(m, "UINT_MAX", PyLong_FromUnsignedLong(UINT_MAX));
PyModule_AddObject(m, "LONG_MAX", PyInt_FromLong(LONG_MAX)); PyModule_AddObject(m, "LONG_MAX", PyLong_FromLong(LONG_MAX));
PyModule_AddObject(m, "LONG_MIN", PyInt_FromLong(LONG_MIN)); PyModule_AddObject(m, "LONG_MIN", PyLong_FromLong(LONG_MIN));
PyModule_AddObject(m, "ULONG_MAX", PyLong_FromUnsignedLong(ULONG_MAX)); PyModule_AddObject(m, "ULONG_MAX", PyLong_FromUnsignedLong(ULONG_MAX));
PyModule_AddObject(m, "FLT_MAX", PyFloat_FromDouble(FLT_MAX)); PyModule_AddObject(m, "FLT_MAX", PyFloat_FromDouble(FLT_MAX));
PyModule_AddObject(m, "FLT_MIN", PyFloat_FromDouble(FLT_MIN)); 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_MAX", PyLong_FromLongLong(PY_LLONG_MAX));
PyModule_AddObject(m, "LLONG_MIN", PyLong_FromLongLong(PY_LLONG_MIN)); PyModule_AddObject(m, "LLONG_MIN", PyLong_FromLongLong(PY_LLONG_MIN));
PyModule_AddObject(m, "ULLONG_MAX", PyLong_FromUnsignedLongLong(PY_ULLONG_MAX)); 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_MAX", PyLong_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_MIN", PyLong_FromSsize_t(PY_SSIZE_T_MIN));
TestError = PyErr_NewException("_testcapi.error", NULL, NULL); TestError = PyErr_NewException("_testcapi.error", NULL, NULL);
Py_INCREF(TestError); Py_INCREF(TestError);

View File

@ -44,7 +44,7 @@ Copyright (C) 1994 Steen Lumholt.
#ifndef PyBool_Check #ifndef PyBool_Check
#define PyBool_Check(o) 0 #define PyBool_Check(o) 0
#define PyBool_FromLong PyInt_FromLong #define PyBool_FromLong PyLong_FromLong
#endif #endif
/* Starting with Tcl 8.4, many APIs offer const-correctness. Unfortunately, /* Starting with Tcl 8.4, many APIs offer const-correctness. Unfortunately,
@ -870,7 +870,7 @@ AsObj(PyObject *value)
else if (PyBool_Check(value)) else if (PyBool_Check(value))
return Tcl_NewBooleanObj(PyObject_IsTrue(value)); return Tcl_NewBooleanObj(PyObject_IsTrue(value));
else if (PyInt_CheckExact(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)) else if (PyFloat_Check(value))
return Tcl_NewDoubleObj(PyFloat_AS_DOUBLE(value)); return Tcl_NewDoubleObj(PyFloat_AS_DOUBLE(value));
else if (PyTuple_Check(value)) { else if (PyTuple_Check(value)) {
@ -960,7 +960,7 @@ FromObj(PyObject* tkapp, Tcl_Obj *value)
} }
if (value->typePtr == app->IntType) { if (value->typePtr == app->IntType) {
return PyInt_FromLong(value->internalRep.longValue); return PyLong_FromLong(value->internalRep.longValue);
} }
if (value->typePtr == app->ListType) { if (value->typePtr == app->ListType) {
@ -1647,7 +1647,7 @@ Tkapp_GetInt(PyObject *self, PyObject *args)
if (PyTuple_Size(args) == 1) { if (PyTuple_Size(args) == 1) {
PyObject* o = PyTuple_GetItem(args, 0); PyObject* o = PyTuple_GetItem(args, 0);
if (PyInt_Check(o)) { if (PyLong_Check(o)) {
Py_INCREF(o); Py_INCREF(o);
return o; return o;
} }
@ -1687,7 +1687,7 @@ Tkapp_GetBoolean(PyObject *self, PyObject *args)
if (PyTuple_Size(args) == 1) { if (PyTuple_Size(args) == 1) {
PyObject *o = PyTuple_GetItem(args, 0); PyObject *o = PyTuple_GetItem(args, 0);
if (PyInt_Check(o)) { if (PyLong_Check(o)) {
Py_INCREF(o); Py_INCREF(o);
return o; return o;
} }
@ -2527,7 +2527,7 @@ Tkapp_InterpAddr(PyObject *self, PyObject *args)
if (!PyArg_ParseTuple(args, ":interpaddr")) if (!PyArg_ParseTuple(args, ":interpaddr"))
return NULL; return NULL;
return PyInt_FromLong((long)Tkapp_Interp(self)); return PyLong_FromLong((long)Tkapp_Interp(self));
} }
static PyObject * static PyObject *
@ -2856,7 +2856,7 @@ frames in an animation.";
static PyObject * static PyObject *
Tkinter_getbusywaitinterval(PyObject *self, PyObject *args) Tkinter_getbusywaitinterval(PyObject *self, PyObject *args)
{ {
return PyInt_FromLong(Tkinter_busywaitinterval); return PyLong_FromLong(Tkinter_busywaitinterval);
} }
static char getbusywaitinterval_doc[] = static char getbusywaitinterval_doc[] =
@ -2987,7 +2987,7 @@ DisableEventHook(void)
static void static void
ins_long(PyObject *d, char *name, long val) ins_long(PyObject *d, char *name, long val)
{ {
PyObject *v = PyInt_FromLong(val); PyObject *v = PyLong_FromLong(val);
if (v) { if (v) {
PyDict_SetItemString(d, name, v); PyDict_SetItemString(d, name, v);
Py_DECREF(v); Py_DECREF(v);

View File

@ -17,10 +17,10 @@ weakref_getweakrefcount(PyObject *self, PyObject *object)
if (PyType_SUPPORTS_WEAKREFS(Py_Type(object))) { if (PyType_SUPPORTS_WEAKREFS(Py_Type(object))) {
PyWeakReference **list = GET_WEAKREFS_LISTPTR(object); PyWeakReference **list = GET_WEAKREFS_LISTPTR(object);
result = PyInt_FromSsize_t(_PyWeakref_GetWeakrefCount(*list)); result = PyLong_FromSsize_t(_PyWeakref_GetWeakrefCount(*list));
} }
else else
result = PyInt_FromLong(0); result = PyLong_FromLong(0);
return result; return result;
} }

View File

@ -115,7 +115,7 @@ b_getitem(arrayobject *ap, Py_ssize_t i)
long x = ((char *)ap->ob_item)[i]; long x = ((char *)ap->ob_item)[i];
if (x >= 128) if (x >= 128)
x -= 256; x -= 256;
return PyInt_FromLong(x); return PyLong_FromLong(x);
} }
static int static int
@ -146,7 +146,7 @@ static PyObject *
BB_getitem(arrayobject *ap, Py_ssize_t i) BB_getitem(arrayobject *ap, Py_ssize_t i)
{ {
long x = ((unsigned char *)ap->ob_item)[i]; long x = ((unsigned char *)ap->ob_item)[i];
return PyInt_FromLong(x); return PyLong_FromLong(x);
} }
static int static int
@ -189,7 +189,7 @@ u_setitem(arrayobject *ap, Py_ssize_t i, PyObject *v)
static PyObject * static PyObject *
h_getitem(arrayobject *ap, Py_ssize_t i) 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 * static PyObject *
HH_getitem(arrayobject *ap, Py_ssize_t i) 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 static int
@ -237,7 +237,7 @@ HH_setitem(arrayobject *ap, Py_ssize_t i, PyObject *v)
static PyObject * static PyObject *
i_getitem(arrayobject *ap, Py_ssize_t i) 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 static int
@ -294,7 +294,7 @@ II_setitem(arrayobject *ap, Py_ssize_t i, PyObject *v)
static PyObject * static PyObject *
l_getitem(arrayobject *ap, Py_ssize_t i) 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 static int
@ -899,7 +899,7 @@ array_count(arrayobject *self, PyObject *v)
else if (cmp < 0) else if (cmp < 0)
return NULL; return NULL;
} }
return PyInt_FromSsize_t(count); return PyLong_FromSsize_t(count);
} }
PyDoc_STRVAR(count_doc, PyDoc_STRVAR(count_doc,
@ -917,7 +917,7 @@ array_index(arrayobject *self, PyObject *v)
int cmp = PyObject_RichCompareBool(selfi, v, Py_EQ); int cmp = PyObject_RichCompareBool(selfi, v, Py_EQ);
Py_DECREF(selfi); Py_DECREF(selfi);
if (cmp > 0) { if (cmp > 0) {
return PyInt_FromLong((long)i); return PyLong_FromLong((long)i);
} }
else if (cmp < 0) else if (cmp < 0)
return NULL; return NULL;
@ -1043,7 +1043,7 @@ array_buffer_info(arrayobject *self, PyObject *unused)
return NULL; return NULL;
PyTuple_SET_ITEM(retval, 0, PyLong_FromVoidPtr(self->ob_item)); 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; return retval;
} }
@ -1483,7 +1483,7 @@ array_get_typecode(arrayobject *a, void *closure)
static PyObject * static PyObject *
array_get_itemsize(arrayobject *a, void *closure) 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 [] = { static PyGetSetDef array_getsets [] = {

View File

@ -315,7 +315,7 @@ audioop_getsample(PyObject *self, PyObject *args)
if ( size == 1 ) val = (int)*CHARP(cp, i); if ( size == 1 ) val = (int)*CHARP(cp, i);
else if ( size == 2 ) val = (int)*SHORTP(cp, i*2); else if ( size == 2 ) val = (int)*SHORTP(cp, i*2);
else if ( size == 4 ) val = (int)*LONGP(cp, i*4); else if ( size == 4 ) val = (int)*LONGP(cp, i*4);
return PyInt_FromLong(val); return PyLong_FromLong(val);
} }
static PyObject * static PyObject *
@ -339,7 +339,7 @@ audioop_max(PyObject *self, PyObject *args)
if ( val < 0 ) val = (-val); if ( val < 0 ) val = (-val);
if ( val > max ) max = val; if ( val > max ) max = val;
} }
return PyInt_FromLong(max); return PyLong_FromLong(max);
} }
static PyObject * static PyObject *
@ -390,7 +390,7 @@ audioop_avg(PyObject *self, PyObject *args)
val = 0; val = 0;
else else
val = (int)(avg / (double)(len/size)); val = (int)(avg / (double)(len/size));
return PyInt_FromLong(val); return PyLong_FromLong(val);
} }
static PyObject * static PyObject *
@ -417,7 +417,7 @@ audioop_rms(PyObject *self, PyObject *args)
val = 0; val = 0;
else else
val = (int)sqrt(sum_squares / (double)(len/size)); 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) 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 * static PyObject *
@ -656,7 +656,7 @@ audioop_avgpp(PyObject *self, PyObject *args)
val = 0; val = 0;
else else
val = (int)(avg / (double)nextreme); val = (int)(avg / (double)nextreme);
return PyInt_FromLong(val); return PyLong_FromLong(val);
} }
static PyObject * static PyObject *
@ -709,7 +709,7 @@ audioop_maxpp(PyObject *self, PyObject *args)
if ( diff != 0 ) if ( diff != 0 )
prevdiff = diff; prevdiff = diff;
} }
return PyInt_FromLong(max); return PyLong_FromLong(max);
} }
static PyObject * static PyObject *
@ -736,7 +736,7 @@ audioop_cross(PyObject *self, PyObject *args)
if ( val != prevval ) ncross++; if ( val != prevval ) ncross++;
prevval = val; prevval = val;
} }
return PyInt_FromLong(ncross); return PyLong_FromLong(ncross);
} }
static PyObject * static PyObject *

View File

@ -924,7 +924,7 @@ binascii_crc32(PyObject *self, PyObject *args)
*/ */
result |= -(result & (1L << 31)); result |= -(result & (1L << 31));
#endif #endif
return PyInt_FromLong(result); return PyLong_FromLong(result);
} }

View File

@ -894,10 +894,10 @@ BZ2File_seek(BZ2FileObject *self, PyObject *args)
if (!PyArg_ParseTuple(args, "O|i:seek", &offobj, &where)) if (!PyArg_ParseTuple(args, "O|i:seek", &offobj, &where))
return NULL; return NULL;
#if !defined(HAVE_LARGEFILE_SUPPORT) #if !defined(HAVE_LARGEFILE_SUPPORT)
offset = PyInt_AsLong(offobj); offset = PyLong_AsLong(offobj);
#else #else
offset = PyLong_Check(offobj) ? offset = PyLong_Check(offobj) ?
PyLong_AsLongLong(offobj) : PyInt_AsLong(offobj); PyLong_AsLongLong(offobj) : PyLong_AsLong(offobj);
#endif #endif
if (PyErr_Occurred()) if (PyErr_Occurred())
return NULL; return NULL;
@ -1028,7 +1028,7 @@ BZ2File_tell(BZ2FileObject *self, PyObject *args)
} }
#if !defined(HAVE_LARGEFILE_SUPPORT) #if !defined(HAVE_LARGEFILE_SUPPORT)
ret = PyInt_FromLong(self->pos); ret = PyLong_FromLong(self->pos);
#else #else
ret = PyLong_FromLongLong(self->pos); ret = PyLong_FromLongLong(self->pos);
#endif #endif
@ -1102,7 +1102,7 @@ static PyMethodDef BZ2File_methods[] = {
static PyObject * static PyObject *
BZ2File_get_closed(BZ2FileObject *self, void *closure) 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[] = { static PyGetSetDef BZ2File_getset[] = {

View File

@ -276,7 +276,7 @@ IO_tell(IOobject *self, PyObject *unused) {
if (!IO__opencheck(self)) return NULL; if (!IO__opencheck(self)) return NULL;
return PyInt_FromSsize_t(self->pos); return PyLong_FromSsize_t(self->pos);
} }
PyDoc_STRVAR(IO_truncate__doc__, PyDoc_STRVAR(IO_truncate__doc__,

View File

@ -65,7 +65,7 @@ make_tuple(PyObject *object, Py_ssize_t len)
} }
PyTuple_SET_ITEM(v, 0, object); PyTuple_SET_ITEM(v, 0, object);
w = PyInt_FromSsize_t(len); w = PyLong_FromSsize_t(len);
if (w == NULL) { if (w == NULL) {
Py_DECREF(v); Py_DECREF(v);
return NULL; return NULL;
@ -313,7 +313,7 @@ multibytecodec_encerror(MultibyteCodec *codec,
if (!PyTuple_Check(retobj) || PyTuple_GET_SIZE(retobj) != 2 || if (!PyTuple_Check(retobj) || PyTuple_GET_SIZE(retobj) != 2 ||
!PyUnicode_Check((tobj = PyTuple_GET_ITEM(retobj, 0))) || !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, PyErr_SetString(PyExc_TypeError,
"encoding error handler must return " "encoding error handler must return "
"(unicode, int) tuple"); "(unicode, int) tuple");
@ -337,7 +337,7 @@ multibytecodec_encerror(MultibyteCodec *codec,
memcpy(buf->outbuf, PyString_AS_STRING(retstr), retstrsize); memcpy(buf->outbuf, PyString_AS_STRING(retstr), retstrsize);
buf->outbuf += 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()) if (newpos < 0 && !PyErr_Occurred())
newpos += (Py_ssize_t)(buf->inbuf_end - buf->inbuf_top); newpos += (Py_ssize_t)(buf->inbuf_end - buf->inbuf_top);
if (newpos < 0 || buf->inbuf_top + newpos > buf->inbuf_end) { 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 || if (!PyTuple_Check(retobj) || PyTuple_GET_SIZE(retobj) != 2 ||
!PyUnicode_Check((retuni = PyTuple_GET_ITEM(retobj, 0))) || !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, PyErr_SetString(PyExc_TypeError,
"decoding error handler must return " "decoding error handler must return "
"(unicode, int) tuple"); "(unicode, int) tuple");
@ -447,7 +447,7 @@ multibytecodec_decerror(MultibyteCodec *codec,
buf->outbuf += retunisize; 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()) if (newpos < 0 && !PyErr_Occurred())
newpos += (Py_ssize_t)(buf->inbuf_end - buf->inbuf_top); newpos += (Py_ssize_t)(buf->inbuf_end - buf->inbuf_top);
if (newpos < 0 || buf->inbuf_top + newpos > buf->inbuf_end) { 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) if (sizeobj == Py_None || sizeobj == NULL)
size = -1; size = -1;
else if (PyInt_Check(sizeobj)) else if (PyLong_Check(sizeobj))
size = PyInt_AsSsize_t(sizeobj); size = PyLong_AsSsize_t(sizeobj);
else { else {
PyErr_SetString(PyExc_TypeError, "arg 1 must be an integer"); PyErr_SetString(PyExc_TypeError, "arg 1 must be an integer");
return NULL; return NULL;
@ -1341,8 +1341,8 @@ mbstreamreader_readline(MultibyteStreamReaderObject *self, PyObject *args)
if (sizeobj == Py_None || sizeobj == NULL) if (sizeobj == Py_None || sizeobj == NULL)
size = -1; size = -1;
else if (PyInt_Check(sizeobj)) else if (PyLong_Check(sizeobj))
size = PyInt_AsSsize_t(sizeobj); size = PyLong_AsSsize_t(sizeobj);
else { else {
PyErr_SetString(PyExc_TypeError, "arg 1 must be an integer"); PyErr_SetString(PyExc_TypeError, "arg 1 must be an integer");
return NULL; return NULL;
@ -1365,8 +1365,8 @@ mbstreamreader_readlines(MultibyteStreamReaderObject *self, PyObject *args)
if (sizehintobj == Py_None || sizehintobj == NULL) if (sizehintobj == Py_None || sizehintobj == NULL)
sizehint = -1; sizehint = -1;
else if (PyInt_Check(sizehintobj)) else if (PyLong_Check(sizehintobj))
sizehint = PyInt_AsSsize_t(sizehintobj); sizehint = PyLong_AsSsize_t(sizehintobj);
else { else {
PyErr_SetString(PyExc_TypeError, "arg 1 must be an integer"); PyErr_SetString(PyExc_TypeError, "arg 1 must be an integer");
return NULL; return NULL;

View File

@ -1220,8 +1220,8 @@ wrap_strftime(PyObject *object, PyObject *format, PyObject *timetuple,
long year; long year;
PyObject *pyyear = PySequence_GetItem(timetuple, 0); PyObject *pyyear = PySequence_GetItem(timetuple, 0);
if (pyyear == NULL) return NULL; if (pyyear == NULL) return NULL;
assert(PyInt_Check(pyyear)); assert(PyLong_Check(pyyear));
year = PyInt_AsLong(pyyear); year = PyLong_AsLong(pyyear);
Py_DECREF(pyyear); Py_DECREF(pyyear);
if (year < 1900) { if (year < 1900) {
PyErr_Format(PyExc_ValueError, "year=%ld is before " PyErr_Format(PyExc_ValueError, "year=%ld is before "
@ -1465,7 +1465,7 @@ delta_to_microseconds(PyDateTime_Delta *self)
PyObject *x3 = NULL; PyObject *x3 = NULL;
PyObject *result = NULL; PyObject *result = NULL;
x1 = PyInt_FromLong(GET_TD_DAYS(self)); x1 = PyLong_FromLong(GET_TD_DAYS(self));
if (x1 == NULL) if (x1 == NULL)
goto Done; goto Done;
x2 = PyNumber_Multiply(x1, seconds_per_day); /* days in seconds */ x2 = PyNumber_Multiply(x1, seconds_per_day); /* days in seconds */
@ -1475,7 +1475,7 @@ delta_to_microseconds(PyDateTime_Delta *self)
x1 = NULL; x1 = NULL;
/* x2 has days in seconds */ /* x2 has days in seconds */
x1 = PyInt_FromLong(GET_TD_SECONDS(self)); /* seconds */ x1 = PyLong_FromLong(GET_TD_SECONDS(self)); /* seconds */
if (x1 == NULL) if (x1 == NULL)
goto Done; goto Done;
x3 = PyNumber_Add(x1, x2); /* days and seconds in seconds */ x3 = PyNumber_Add(x1, x2); /* days and seconds in seconds */
@ -1493,7 +1493,7 @@ delta_to_microseconds(PyDateTime_Delta *self)
x3 = NULL; x3 = NULL;
/* x1 has days+seconds in us */ /* x1 has days+seconds in us */
x2 = PyInt_FromLong(GET_TD_MICROSECONDS(self)); x2 = PyLong_FromLong(GET_TD_MICROSECONDS(self));
if (x2 == NULL) if (x2 == NULL)
goto Done; goto Done;
result = PyNumber_Add(x1, x2); result = PyNumber_Add(x1, x2);
@ -1902,7 +1902,7 @@ delta_new(PyTypeObject *type, PyObject *args, PyObject *kw)
&ms, &minute, &hour, &week) == 0) &ms, &minute, &hour, &week) == 0)
goto Done; goto Done;
x = PyInt_FromLong(0); x = PyLong_FromLong(0);
if (x == NULL) if (x == NULL)
goto Done; goto Done;
@ -2149,19 +2149,19 @@ static PyTypeObject PyDateTime_DeltaType = {
static PyObject * static PyObject *
date_year(PyDateTime_Date *self, void *unused) date_year(PyDateTime_Date *self, void *unused)
{ {
return PyInt_FromLong(GET_YEAR(self)); return PyLong_FromLong(GET_YEAR(self));
} }
static PyObject * static PyObject *
date_month(PyDateTime_Date *self, void *unused) date_month(PyDateTime_Date *self, void *unused)
{ {
return PyInt_FromLong(GET_MONTH(self)); return PyLong_FromLong(GET_MONTH(self));
} }
static PyObject * static PyObject *
date_day(PyDateTime_Date *self, void *unused) date_day(PyDateTime_Date *self, void *unused)
{ {
return PyInt_FromLong(GET_DAY(self)); return PyLong_FromLong(GET_DAY(self));
} }
static PyGetSetDef date_getset[] = { 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)); int dow = weekday(GET_YEAR(self), GET_MONTH(self), GET_DAY(self));
return PyInt_FromLong(dow + 1); return PyLong_FromLong(dow + 1);
} }
static PyObject * static PyObject *
@ -2563,7 +2563,7 @@ date_hash(PyDateTime_Date *self)
static PyObject * static PyObject *
date_toordinal(PyDateTime_Date *self) 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))); GET_DAY(self)));
} }
@ -2572,7 +2572,7 @@ date_weekday(PyDateTime_Date *self)
{ {
int dow = weekday(GET_YEAR(self), GET_MONTH(self), GET_DAY(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__. */ /* Pickle support, a simple use of __reduce__. */
@ -2975,26 +2975,26 @@ static PyTypeObject PyDateTime_TZInfoType = {
static PyObject * static PyObject *
time_hour(PyDateTime_Time *self, void *unused) time_hour(PyDateTime_Time *self, void *unused)
{ {
return PyInt_FromLong(TIME_GET_HOUR(self)); return PyLong_FromLong(TIME_GET_HOUR(self));
} }
static PyObject * static PyObject *
time_minute(PyDateTime_Time *self, void *unused) 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. */ /* The name time_second conflicted with some platform header file. */
static PyObject * static PyObject *
py_time_second(PyDateTime_Time *self, void *unused) py_time_second(PyDateTime_Time *self, void *unused)
{ {
return PyInt_FromLong(TIME_GET_SECOND(self)); return PyLong_FromLong(TIME_GET_SECOND(self));
} }
static PyObject * static PyObject *
time_microsecond(PyDateTime_Time *self, void *unused) time_microsecond(PyDateTime_Time *self, void *unused)
{ {
return PyInt_FromLong(TIME_GET_MICROSECOND(self)); return PyLong_FromLong(TIME_GET_MICROSECOND(self));
} }
static PyObject * static PyObject *
@ -3505,25 +3505,25 @@ static PyTypeObject PyDateTime_TimeType = {
static PyObject * static PyObject *
datetime_hour(PyDateTime_DateTime *self, void *unused) datetime_hour(PyDateTime_DateTime *self, void *unused)
{ {
return PyInt_FromLong(DATE_GET_HOUR(self)); return PyLong_FromLong(DATE_GET_HOUR(self));
} }
static PyObject * static PyObject *
datetime_minute(PyDateTime_DateTime *self, void *unused) datetime_minute(PyDateTime_DateTime *self, void *unused)
{ {
return PyInt_FromLong(DATE_GET_MINUTE(self)); return PyLong_FromLong(DATE_GET_MINUTE(self));
} }
static PyObject * static PyObject *
datetime_second(PyDateTime_DateTime *self, void *unused) datetime_second(PyDateTime_DateTime *self, void *unused)
{ {
return PyInt_FromLong(DATE_GET_SECOND(self)); return PyLong_FromLong(DATE_GET_SECOND(self));
} }
static PyObject * static PyObject *
datetime_microsecond(PyDateTime_DateTime *self, void *unused) datetime_microsecond(PyDateTime_DateTime *self, void *unused)
{ {
return PyInt_FromLong(DATE_GET_MICROSECOND(self)); return PyLong_FromLong(DATE_GET_MICROSECOND(self));
} }
static PyObject * static PyObject *
@ -3837,7 +3837,7 @@ datetime_strptime(PyObject *cls, PyObject *args)
return NULL; return NULL;
} }
if (PyInt_CheckExact(p)) if (PyInt_CheckExact(p))
ia[i] = PyInt_AsLong(p); ia[i] = PyLong_AsLong(p);
else else
good_timetuple = 0; good_timetuple = 0;
Py_DECREF(p); Py_DECREF(p);
@ -4753,11 +4753,11 @@ initdatetime(void)
assert(DI100Y == 25 * DI4Y - 1); assert(DI100Y == 25 * DI4Y - 1);
assert(DI100Y == days_before_year(100+1)); assert(DI100Y == days_before_year(100+1));
us_per_us = PyInt_FromLong(1); us_per_us = PyLong_FromLong(1);
us_per_ms = PyInt_FromLong(1000); us_per_ms = PyLong_FromLong(1000);
us_per_second = PyInt_FromLong(1000000); us_per_second = PyLong_FromLong(1000000);
us_per_minute = PyInt_FromLong(60000000); us_per_minute = PyLong_FromLong(60000000);
seconds_per_day = PyInt_FromLong(24 * 3600); seconds_per_day = PyLong_FromLong(24 * 3600);
if (us_per_us == NULL || us_per_ms == NULL || us_per_second == NULL || if (us_per_us == NULL || us_per_ms == NULL || us_per_second == NULL ||
us_per_minute == NULL || seconds_per_day == NULL) us_per_minute == NULL || seconds_per_day == NULL)
return; return;

View File

@ -70,7 +70,7 @@ dl_sym(dlobject *xp, PyObject *args)
Py_INCREF(Py_None); Py_INCREF(Py_None);
return Py_None; return Py_None;
} }
return PyInt_FromLong((long)func); return PyLong_FromLong((long)func);
} }
static PyObject * static PyObject *
@ -107,8 +107,8 @@ dl_call(dlobject *xp, PyObject *args)
} }
for (i = 1; i < n; i++) { for (i = 1; i < n; i++) {
PyObject *v = PyTuple_GetItem(args, i); PyObject *v = PyTuple_GetItem(args, i);
if (PyInt_Check(v)) { if (PyLong_Check(v)) {
alist[i-1] = PyInt_AsLong(v); alist[i-1] = PyLong_AsLong(v);
if (alist[i-1] == -1 && PyErr_Occurred()) if (alist[i-1] == -1 && PyErr_Occurred())
return NULL; return NULL;
} else if (PyUnicode_Check(v)) } else if (PyUnicode_Check(v))
@ -125,7 +125,7 @@ dl_call(dlobject *xp, PyObject *args)
alist[i-1] = 0; alist[i-1] = 0;
res = (*func)(alist[0], alist[1], alist[2], alist[3], alist[4], res = (*func)(alist[0], alist[1], alist[2], alist[3], alist[4],
alist[5], alist[6], alist[7], alist[8], alist[9]); alist[5], alist[6], alist[7], alist[8], alist[9]);
return PyInt_FromLong(res); return PyLong_FromLong(res);
} }
static PyMethodDef dlobject_methods[] = { static PyMethodDef dlobject_methods[] = {
@ -225,7 +225,7 @@ static PyMethodDef dl_methods[] = {
static void static void
insint(PyObject *d, char *name, int value) 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)) if (!v || PyDict_SetItemString(d, name, v))
PyErr_Clear(); PyErr_Clear();
@ -249,7 +249,7 @@ initdl(void)
d = PyModule_GetDict(m); d = PyModule_GetDict(m);
Dlerror = x = PyErr_NewException("dl.error", NULL, NULL); Dlerror = x = PyErr_NewException("dl.error", NULL, NULL);
PyDict_SetItemString(d, "error", x); PyDict_SetItemString(d, "error", x);
x = PyInt_FromLong((long)RTLD_LAZY); x = PyLong_FromLong((long)RTLD_LAZY);
PyDict_SetItemString(d, "RTLD_LAZY", x); PyDict_SetItemString(d, "RTLD_LAZY", x);
#define INSINT(X) insint(d,#X,X) #define INSINT(X) insint(d,#X,X)
#ifdef RTLD_NOW #ifdef RTLD_NOW

View File

@ -22,7 +22,7 @@ static void
_inscode(PyObject *d, PyObject *de, const char *name, int code) _inscode(PyObject *d, PyObject *de, const char *name, int code)
{ {
PyObject *u = PyUnicode_FromString(name); 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 /* Don't bother checking for errors; they'll be caught at the end
* of the module initialization function by the caller of * of the module initialization function by the caller of

View File

@ -73,7 +73,7 @@ fcntl_fcntl(PyObject *self, PyObject *args)
PyErr_SetFromErrno(PyExc_IOError); PyErr_SetFromErrno(PyExc_IOError);
return NULL; return NULL;
} }
return PyInt_FromLong((long)ret); return PyLong_FromLong((long)ret);
} }
PyDoc_STRVAR(fcntl_doc, PyDoc_STRVAR(fcntl_doc,
@ -152,7 +152,7 @@ fcntl_ioctl(PyObject *self, PyObject *args)
return NULL; return NULL;
} }
if (mutate_arg) { if (mutate_arg) {
return PyInt_FromLong(ret); return PyLong_FromLong(ret);
} }
else { else {
return PyString_FromStringAndSize(buf, len); return PyString_FromStringAndSize(buf, len);
@ -198,7 +198,7 @@ fcntl_ioctl(PyObject *self, PyObject *args)
PyErr_SetFromErrno(PyExc_IOError); PyErr_SetFromErrno(PyExc_IOError);
return NULL; return NULL;
} }
return PyInt_FromLong((long)ret); return PyLong_FromLong((long)ret);
#undef IOCTL_BUFSZ #undef IOCTL_BUFSZ
} }
@ -333,22 +333,22 @@ fcntl_lockf(PyObject *self, PyObject *args)
l.l_start = l.l_len = 0; l.l_start = l.l_len = 0;
if (startobj != NULL) { if (startobj != NULL) {
#if !defined(HAVE_LARGEFILE_SUPPORT) #if !defined(HAVE_LARGEFILE_SUPPORT)
l.l_start = PyInt_AsLong(startobj); l.l_start = PyLong_AsLong(startobj);
#else #else
l.l_start = PyLong_Check(startobj) ? l.l_start = PyLong_Check(startobj) ?
PyLong_AsLongLong(startobj) : PyLong_AsLongLong(startobj) :
PyInt_AsLong(startobj); PyLong_AsLong(startobj);
#endif #endif
if (PyErr_Occurred()) if (PyErr_Occurred())
return NULL; return NULL;
} }
if (lenobj != NULL) { if (lenobj != NULL) {
#if !defined(HAVE_LARGEFILE_SUPPORT) #if !defined(HAVE_LARGEFILE_SUPPORT)
l.l_len = PyInt_AsLong(lenobj); l.l_len = PyLong_AsLong(lenobj);
#else #else
l.l_len = PyLong_Check(lenobj) ? l.l_len = PyLong_Check(lenobj) ?
PyLong_AsLongLong(lenobj) : PyLong_AsLongLong(lenobj) :
PyInt_AsLong(lenobj); PyLong_AsLong(lenobj);
#endif #endif
if (PyErr_Occurred()) if (PyErr_Occurred())
return NULL; return NULL;
@ -414,7 +414,7 @@ a file or socket object.");
static int static int
ins(PyObject* d, char* symbol, long value) 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) if (!v || PyDict_SetItemString(d, symbol, v) < 0)
return -1; return -1;

View File

@ -944,7 +944,7 @@ gc_collect(PyObject *self, PyObject *args, PyObject *kws)
collecting = 0; collecting = 0;
} }
return PyInt_FromSsize_t(n); return PyLong_FromSsize_t(n);
} }
PyDoc_STRVAR(gc_set_debug__doc__, PyDoc_STRVAR(gc_set_debug__doc__,

View File

@ -70,7 +70,7 @@ mkgrent(struct group *p)
Py_INCREF(Py_None); Py_INCREF(Py_None);
} }
#endif #endif
SET(setIndex++, PyInt_FromLong((long) p->gr_gid)); SET(setIndex++, PyLong_FromLong((long) p->gr_gid));
SET(setIndex++, w); SET(setIndex++, w);
#undef SET #undef SET
@ -93,7 +93,7 @@ grp_getgrgid(PyObject *self, PyObject *pyo_id)
py_int_id = PyNumber_Int(pyo_id); py_int_id = PyNumber_Int(pyo_id);
if (!py_int_id) if (!py_int_id)
return NULL; return NULL;
gid = PyInt_AS_LONG(py_int_id); gid = PyLong_AS_LONG(py_int_id);
Py_DECREF(py_int_id); Py_DECREF(py_int_id);
if ((p = getgrgid(gid)) == NULL) { if ((p = getgrgid(gid)) == NULL) {

View File

@ -1122,7 +1122,7 @@ islice_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
numargs = PyTuple_Size(args); numargs = PyTuple_Size(args);
if (numargs == 2) { if (numargs == 2) {
if (a1 != Py_None) { if (a1 != Py_None) {
stop = PyInt_AsSsize_t(a1); stop = PyLong_AsSsize_t(a1);
if (stop == -1) { if (stop == -1) {
if (PyErr_Occurred()) if (PyErr_Occurred())
PyErr_Clear(); PyErr_Clear();
@ -1133,11 +1133,11 @@ islice_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
} }
} else { } else {
if (a1 != Py_None) if (a1 != Py_None)
start = PyInt_AsSsize_t(a1); start = PyLong_AsSsize_t(a1);
if (start == -1 && PyErr_Occurred()) if (start == -1 && PyErr_Occurred())
PyErr_Clear(); PyErr_Clear();
if (a2 != Py_None) { if (a2 != Py_None) {
stop = PyInt_AsSsize_t(a2); stop = PyLong_AsSsize_t(a2);
if (stop == -1) { if (stop == -1) {
if (PyErr_Occurred()) if (PyErr_Occurred())
PyErr_Clear(); PyErr_Clear();
@ -1155,7 +1155,7 @@ islice_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
if (a3 != NULL) { if (a3 != NULL) {
if (a3 != Py_None) if (a3 != Py_None)
step = PyInt_AsSsize_t(a3); step = PyLong_AsSsize_t(a3);
if (step == -1 && PyErr_Occurred()) if (step == -1 && PyErr_Occurred())
PyErr_Clear(); PyErr_Clear();
} }
@ -2052,7 +2052,7 @@ count_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
return NULL; return NULL;
if (cnt_arg != NULL) { if (cnt_arg != NULL) {
cnt = PyInt_AsSsize_t(cnt_arg); cnt = PyLong_AsSsize_t(cnt_arg);
if (cnt == -1 && PyErr_Occurred()) { if (cnt == -1 && PyErr_Occurred()) {
PyErr_Clear(); PyErr_Clear();
if (!PyLong_Check(cnt_arg)) { if (!PyLong_Check(cnt_arg)) {
@ -2092,12 +2092,12 @@ count_nextlong(countobject *lz)
PyObject *stepped_up; PyObject *stepped_up;
if (lz->long_cnt == NULL) { 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) if (lz->long_cnt == NULL)
return NULL; return NULL;
} }
if (one == NULL) { if (one == NULL) {
one = PyInt_FromLong(1); one = PyLong_FromLong(1);
if (one == NULL) if (one == NULL)
return NULL; return NULL;
} }
@ -2115,7 +2115,7 @@ count_next(countobject *lz)
{ {
if (lz->cnt == PY_SSIZE_T_MAX) if (lz->cnt == PY_SSIZE_T_MAX)
return count_nextlong(lz); return count_nextlong(lz);
return PyInt_FromSsize_t(lz->cnt++); return PyLong_FromSsize_t(lz->cnt++);
} }
static PyObject * static PyObject *
@ -2440,7 +2440,7 @@ repeat_len(repeatobject *ro)
PyErr_SetString(PyExc_TypeError, "len() of unsized object"); PyErr_SetString(PyExc_TypeError, "len() of unsized object");
return NULL; 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))."); PyDoc_STRVAR(length_hint_doc, "Private method returning an estimate of len(list(it)).");

View File

@ -434,7 +434,7 @@ static PyMethodDef MD5_methods[] = {
static PyObject * static PyObject *
MD5_get_block_size(PyObject *self, void *closure) MD5_get_block_size(PyObject *self, void *closure)
{ {
return PyInt_FromLong(MD5_BLOCKSIZE); return PyLong_FromLong(MD5_BLOCKSIZE);
} }
static PyObject * static PyObject *
@ -446,7 +446,7 @@ MD5_get_name(PyObject *self, void *closure)
static PyObject * static PyObject *
md5_get_digest_size(PyObject *self, void *closure) md5_get_digest_size(PyObject *self, void *closure)
{ {
return PyInt_FromLong(MD5_DIGESTSIZE); return PyLong_FromLong(MD5_DIGESTSIZE);
} }

View File

@ -280,10 +280,10 @@ mmap_find_method(mmap_object *self,
for (i = 0; i < len && needle[i] == p[i]; ++i) for (i = 0; i < len && needle[i] == p[i]; ++i)
/* nothing */; /* nothing */;
if (i == len) { 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); return PyErr_SetFromWindowsErr(error);
} }
if (!high && low < LONG_MAX) if (!high && low < LONG_MAX)
return PyInt_FromLong((long)low); return PyLong_FromLong((long)low);
size = (((PY_LONG_LONG)high)<<32) + low; size = (((PY_LONG_LONG)high)<<32) + low;
return PyLong_FromLongLong(size); return PyLong_FromLongLong(size);
} else { } else {
return PyInt_FromSsize_t(self->size); return PyLong_FromSsize_t(self->size);
} }
#endif /* MS_WINDOWS */ #endif /* MS_WINDOWS */
@ -388,7 +388,7 @@ mmap_size_method(mmap_object *self,
PyErr_SetFromErrno(mmap_module_error); PyErr_SetFromErrno(mmap_module_error);
return NULL; return NULL;
} }
return PyInt_FromSsize_t(buf.st_size); return PyLong_FromSsize_t(buf.st_size);
} }
#endif /* UNIX */ #endif /* UNIX */
} }
@ -501,7 +501,7 @@ static PyObject *
mmap_tell_method(mmap_object *self, PyObject *unused) mmap_tell_method(mmap_object *self, PyObject *unused)
{ {
CHECK_VALID(NULL); CHECK_VALID(NULL);
return PyInt_FromSize_t(self->pos); return PyLong_FromSize_t(self->pos);
} }
static PyObject * static PyObject *
@ -517,7 +517,7 @@ mmap_flush_method(mmap_object *self, PyObject *args)
return NULL; return NULL;
} else { } else {
#ifdef MS_WINDOWS #ifdef MS_WINDOWS
return PyInt_FromLong((long) return PyLong_FromLong((long)
FlushViewOfFile(self->data+offset, size)); FlushViewOfFile(self->data+offset, size));
#endif /* MS_WINDOWS */ #endif /* MS_WINDOWS */
#ifdef UNIX #ifdef UNIX
@ -529,7 +529,7 @@ mmap_flush_method(mmap_object *self, PyObject *args)
PyErr_SetFromErrno(mmap_module_error); PyErr_SetFromErrno(mmap_module_error);
return NULL; return NULL;
} }
return PyInt_FromLong(0); return PyLong_FromLong(0);
#endif /* UNIX */ #endif /* UNIX */
} }
} }
@ -676,7 +676,7 @@ mmap_subscript(mmap_object *self, PyObject *item)
"mmap index out of range"); "mmap index out of range");
return NULL; return NULL;
} }
return PyInt_FromLong(Py_CHARMASK(self->data[i])); return PyLong_FromLong(Py_CHARMASK(self->data[i]));
} }
else if (PySlice_Check(item)) { else if (PySlice_Check(item)) {
Py_ssize_t start, stop, step, slicelen; Py_ssize_t start, stop, step, slicelen;
@ -1241,7 +1241,7 @@ static struct PyMethodDef mmap_functions[] = {
static void static void
setint(PyObject *d, const char *name, long value) 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) { if (o && PyDict_SetItemString(d, name, o) == 0) {
Py_DECREF(o); Py_DECREF(o);
} }

View File

@ -46,13 +46,13 @@ used for special class methods; variants without leading and trailing\n\
PyObject *a1, *a2; long r; \ PyObject *a1, *a2; long r; \
if(! PyArg_UnpackTuple(a,#OP,2,2,&a1,&a2)) return NULL; \ if(! PyArg_UnpackTuple(a,#OP,2,2,&a1,&a2)) return NULL; \
if(-1 == (r=AOP(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) { \ #define spamn2(OP,AOP) static PyObject *OP(PyObject *s, PyObject *a) { \
PyObject *a1, *a2; Py_ssize_t r; \ PyObject *a1, *a2; Py_ssize_t r; \
if(! PyArg_UnpackTuple(a,#OP,2,2,&a1,&a2)) return NULL; \ if(! PyArg_UnpackTuple(a,#OP,2,2,&a1,&a2)) return NULL; \
if(-1 == (r=AOP(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) { \ #define spami2b(OP,AOP) static PyObject *OP(PyObject *s, PyObject *a) { \
PyObject *a1, *a2; long r; \ PyObject *a1, *a2; long r; \

View File

@ -235,7 +235,7 @@ _do_ioctl_1(int fd, PyObject *args, char *fname, int cmd)
if (ioctl(fd, cmd, &arg) == -1) if (ioctl(fd, cmd, &arg) == -1)
return PyErr_SetFromErrno(PyExc_IOError); 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) if (ioctl(fd, cmd, &arg) == -1)
return PyErr_SetFromErrno(PyExc_IOError); 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; int mask;
if (ioctl(self->fd, SNDCTL_DSP_GETFMTS, &mask) == -1) if (ioctl(self->fd, SNDCTL_DSP_GETFMTS, &mask) == -1)
return PyErr_SetFromErrno(PyExc_IOError); return PyErr_SetFromErrno(PyExc_IOError);
return PyInt_FromLong(mask); return PyLong_FromLong(mask);
} }
static PyObject * static PyObject *
@ -404,7 +404,7 @@ oss_write(oss_audio_t *self, PyObject *args)
} else { } else {
self->ocount += rv; self->ocount += rv;
} }
return PyInt_FromLong(rv); return PyLong_FromLong(rv);
} }
static PyObject * static PyObject *
@ -472,7 +472,7 @@ oss_close(oss_audio_t *self, PyObject *unused)
static PyObject * static PyObject *
oss_fileno(oss_audio_t *self, PyObject *unused) 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); rv = PyTuple_New(3);
if (rv == NULL) if (rv == NULL)
return NULL; return NULL;
PyTuple_SET_ITEM(rv, 0, PyInt_FromLong(fmt)); PyTuple_SET_ITEM(rv, 0, PyLong_FromLong(fmt));
PyTuple_SET_ITEM(rv, 1, PyInt_FromLong(channels)); PyTuple_SET_ITEM(rv, 1, PyLong_FromLong(channels));
PyTuple_SET_ITEM(rv, 2, PyInt_FromLong(rate)); PyTuple_SET_ITEM(rv, 2, PyLong_FromLong(rate));
return rv; return rv;
} }
@ -584,7 +584,7 @@ oss_bufsize(oss_audio_t *self, PyObject *unused)
PyErr_SetFromErrno(PyExc_IOError); PyErr_SetFromErrno(PyExc_IOError);
return NULL; 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 /* 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); PyErr_SetFromErrno(PyExc_IOError);
return NULL; return NULL;
} }
return PyInt_FromLong((ai.fragstotal * ai.fragsize - ai.bytes) / return PyLong_FromLong((ai.fragstotal * ai.fragsize - ai.bytes) /
(ssize * nchannels)); (ssize * nchannels));
} }
@ -623,7 +623,7 @@ oss_obuffree(oss_audio_t *self, PyObject *unused)
PyErr_SetFromErrno(PyExc_IOError); PyErr_SetFromErrno(PyExc_IOError);
return NULL; return NULL;
} }
return PyInt_FromLong(ai.bytes / (ssize * nchannels)); return PyLong_FromLong(ai.bytes / (ssize * nchannels));
} }
static PyObject * static PyObject *
@ -662,7 +662,7 @@ oss_mixer_close(oss_mixer_t *self, PyObject *unused)
static PyObject * static PyObject *
oss_mixer_fileno(oss_mixer_t *self, PyObject *unused) oss_mixer_fileno(oss_mixer_t *self, PyObject *unused)
{ {
return PyInt_FromLong(self->fd); return PyLong_FromLong(self->fd);
} }
/* Simple mixer interface methods */ /* Simple mixer interface methods */

View File

@ -89,7 +89,7 @@ node2tuple(node *n, /* node to convert */
v = mkseq(1 + NCH(n) + (TYPE(n) == encoding_decl)); v = mkseq(1 + NCH(n) + (TYPE(n) == encoding_decl));
if (v == NULL) if (v == NULL)
return (v); return (v);
w = PyInt_FromLong(TYPE(n)); w = PyLong_FromLong(TYPE(n));
if (w == NULL) { if (w == NULL) {
Py_DECREF(v); Py_DECREF(v);
return ((PyObject*) NULL); return ((PyObject*) NULL);
@ -111,12 +111,12 @@ node2tuple(node *n, /* node to convert */
else if (ISTERMINAL(TYPE(n))) { else if (ISTERMINAL(TYPE(n))) {
PyObject *result = mkseq(2 + lineno + col_offset); PyObject *result = mkseq(2 + lineno + col_offset);
if (result != NULL) { 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))); (void) addelem(result, 1, PyUnicode_FromString(STR(n)));
if (lineno == 1) 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) 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); return (result);
} }
@ -664,9 +664,9 @@ build_node_children(PyObject *tuple, node *root, int *line_num)
if (temp == NULL) if (temp == NULL)
ok = 0; ok = 0;
else { else {
ok = PyInt_Check(temp); ok = PyLong_Check(temp);
if (ok) if (ok)
type = PyInt_AS_LONG(temp); type = PyLong_AS_LONG(temp);
Py_DECREF(temp); Py_DECREF(temp);
} }
} }
@ -702,8 +702,8 @@ build_node_children(PyObject *tuple, node *root, int *line_num)
if (len == 3) { if (len == 3) {
PyObject *o = PySequence_GetItem(elem, 2); PyObject *o = PySequence_GetItem(elem, 2);
if (o != NULL) { if (o != NULL) {
if (PyInt_Check(o)) if (PyLong_Check(o))
*line_num = PyInt_AS_LONG(o); *line_num = PyLong_AS_LONG(o);
else { else {
PyErr_Format(parser_error, PyErr_Format(parser_error,
"third item in terminal node must be an" "third item in terminal node must be an"
@ -774,7 +774,7 @@ build_node_tree(PyObject *tuple)
long num = -1; long num = -1;
if (temp != NULL) if (temp != NULL)
num = PyInt_AsLong(temp); num = PyLong_AsLong(temp);
Py_XDECREF(temp); Py_XDECREF(temp);
if (ISTERMINAL(num)) { if (ISTERMINAL(num)) {
/* /*

View File

@ -1281,7 +1281,7 @@ fill_time(PyObject *v, int index, time_t sec, unsigned long nsec)
#if SIZEOF_TIME_T > SIZEOF_LONG #if SIZEOF_TIME_T > SIZEOF_LONG
ival = PyLong_FromLongLong((PY_LONG_LONG)sec); ival = PyLong_FromLongLong((PY_LONG_LONG)sec);
#else #else
ival = PyInt_FromLong((long)sec); ival = PyLong_FromLong((long)sec);
#endif #endif
if (!ival) if (!ival)
return; return;
@ -1305,27 +1305,27 @@ _pystat_fromstructstat(STRUCT_STAT *st)
if (v == NULL) if (v == NULL)
return 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 #ifdef HAVE_LARGEFILE_SUPPORT
PyStructSequence_SET_ITEM(v, 1, PyStructSequence_SET_ITEM(v, 1,
PyLong_FromLongLong((PY_LONG_LONG)st->st_ino)); PyLong_FromLongLong((PY_LONG_LONG)st->st_ino));
#else #else
PyStructSequence_SET_ITEM(v, 1, PyInt_FromLong((long)st->st_ino)); PyStructSequence_SET_ITEM(v, 1, PyLong_FromLong((long)st->st_ino));
#endif #endif
#if defined(HAVE_LONG_LONG) && !defined(MS_WINDOWS) #if defined(HAVE_LONG_LONG) && !defined(MS_WINDOWS)
PyStructSequence_SET_ITEM(v, 2, PyStructSequence_SET_ITEM(v, 2,
PyLong_FromLongLong((PY_LONG_LONG)st->st_dev)); PyLong_FromLongLong((PY_LONG_LONG)st->st_dev));
#else #else
PyStructSequence_SET_ITEM(v, 2, PyInt_FromLong((long)st->st_dev)); PyStructSequence_SET_ITEM(v, 2, PyLong_FromLong((long)st->st_dev));
#endif #endif
PyStructSequence_SET_ITEM(v, 3, PyInt_FromLong((long)st->st_nlink)); PyStructSequence_SET_ITEM(v, 3, PyLong_FromLong((long)st->st_nlink));
PyStructSequence_SET_ITEM(v, 4, PyInt_FromLong((long)st->st_uid)); PyStructSequence_SET_ITEM(v, 4, PyLong_FromLong((long)st->st_uid));
PyStructSequence_SET_ITEM(v, 5, PyInt_FromLong((long)st->st_gid)); PyStructSequence_SET_ITEM(v, 5, PyLong_FromLong((long)st->st_gid));
#ifdef HAVE_LARGEFILE_SUPPORT #ifdef HAVE_LARGEFILE_SUPPORT
PyStructSequence_SET_ITEM(v, 6, PyStructSequence_SET_ITEM(v, 6,
PyLong_FromLongLong((PY_LONG_LONG)st->st_size)); PyLong_FromLongLong((PY_LONG_LONG)st->st_size));
#else #else
PyStructSequence_SET_ITEM(v, 6, PyInt_FromLong(st->st_size)); PyStructSequence_SET_ITEM(v, 6, PyLong_FromLong(st->st_size));
#endif #endif
#if defined(HAVE_STAT_TV_NSEC) #if defined(HAVE_STAT_TV_NSEC)
@ -1349,19 +1349,19 @@ _pystat_fromstructstat(STRUCT_STAT *st)
#ifdef HAVE_STRUCT_STAT_ST_BLKSIZE #ifdef HAVE_STRUCT_STAT_ST_BLKSIZE
PyStructSequence_SET_ITEM(v, ST_BLKSIZE_IDX, PyStructSequence_SET_ITEM(v, ST_BLKSIZE_IDX,
PyInt_FromLong((long)st->st_blksize)); PyLong_FromLong((long)st->st_blksize));
#endif #endif
#ifdef HAVE_STRUCT_STAT_ST_BLOCKS #ifdef HAVE_STRUCT_STAT_ST_BLOCKS
PyStructSequence_SET_ITEM(v, ST_BLOCKS_IDX, PyStructSequence_SET_ITEM(v, ST_BLOCKS_IDX,
PyInt_FromLong((long)st->st_blocks)); PyLong_FromLong((long)st->st_blocks));
#endif #endif
#ifdef HAVE_STRUCT_STAT_ST_RDEV #ifdef HAVE_STRUCT_STAT_ST_RDEV
PyStructSequence_SET_ITEM(v, ST_RDEV_IDX, PyStructSequence_SET_ITEM(v, ST_RDEV_IDX,
PyInt_FromLong((long)st->st_rdev)); PyLong_FromLong((long)st->st_rdev));
#endif #endif
#ifdef HAVE_STRUCT_STAT_ST_GEN #ifdef HAVE_STRUCT_STAT_ST_GEN
PyStructSequence_SET_ITEM(v, ST_GEN_IDX, PyStructSequence_SET_ITEM(v, ST_GEN_IDX,
PyInt_FromLong((long)st->st_gen)); PyLong_FromLong((long)st->st_gen));
#endif #endif
#ifdef HAVE_STRUCT_STAT_ST_BIRTHTIME #ifdef HAVE_STRUCT_STAT_ST_BIRTHTIME
{ {
@ -1376,7 +1376,7 @@ _pystat_fromstructstat(STRUCT_STAT *st)
if (_stat_float_times) { if (_stat_float_times) {
val = PyFloat_FromDouble(bsec + 1e-9*bnsec); val = PyFloat_FromDouble(bsec + 1e-9*bnsec);
} else { } else {
val = PyInt_FromLong((long)bsec); val = PyLong_FromLong((long)bsec);
} }
PyStructSequence_SET_ITEM(v, ST_BIRTHTIME_IDX, PyStructSequence_SET_ITEM(v, ST_BIRTHTIME_IDX,
val); val);
@ -1384,7 +1384,7 @@ _pystat_fromstructstat(STRUCT_STAT *st)
#endif #endif
#ifdef HAVE_STRUCT_STAT_ST_FLAGS #ifdef HAVE_STRUCT_STAT_ST_FLAGS
PyStructSequence_SET_ITEM(v, ST_FLAGS_IDX, PyStructSequence_SET_ITEM(v, ST_FLAGS_IDX,
PyInt_FromLong((long)st->st_flags)); PyLong_FromLong((long)st->st_flags));
#endif #endif
if (PyErr_Occurred()) { if (PyErr_Occurred()) {
@ -2528,7 +2528,7 @@ posix_nice(PyObject *self, PyObject *args)
if (value == -1 && errno != 0) if (value == -1 && errno != 0)
/* either nice() or getpriority() returned an error */ /* either nice() or getpriority() returned an error */
return posix_error(); return posix_error();
return PyInt_FromLong((long) value); return PyLong_FromLong((long) value);
} }
#endif /* HAVE_NICE */ #endif /* HAVE_NICE */
@ -2631,7 +2631,7 @@ posix_system(PyObject *self, PyObject *args)
sts = system(command); sts = system(command);
#endif #endif
Py_END_ALLOW_THREADS Py_END_ALLOW_THREADS
return PyInt_FromLong(sts); return PyLong_FromLong(sts);
} }
#endif #endif
@ -2649,7 +2649,7 @@ posix_umask(PyObject *self, PyObject *args)
i = (int)umask(i); i = (int)umask(i);
if (i < 0) if (i < 0)
return posix_error(); 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); PyObject *intobj = Py_Type(t)->tp_as_number->nb_int(t);
if (!intobj) if (!intobj)
return -1; return -1;
intval = PyInt_AsLong(intobj); intval = PyLong_AsLong(intobj);
Py_DECREF(intobj); Py_DECREF(intobj);
if (intval == -1 && PyErr_Occurred()) if (intval == -1 && PyErr_Occurred())
return -1; return -1;
@ -2718,7 +2718,7 @@ extract_time(PyObject *t, long* sec, long* usec)
*usec = 0; *usec = 0;
return 0; return 0;
} }
intval = PyInt_AsLong(t); intval = PyLong_AsLong(t);
if (intval == -1 && PyErr_Occurred()) if (intval == -1 && PyErr_Occurred())
return -1; return -1;
*sec = intval; *sec = intval;
@ -3617,7 +3617,7 @@ posix_fork1(PyObject *self, PyObject *noargs)
if (pid == -1) if (pid == -1)
return posix_error(); return posix_error();
PyOS_AfterFork(); PyOS_AfterFork();
return PyInt_FromLong((long)pid); return PyLong_FromLong((long)pid);
} }
#endif #endif
@ -3636,7 +3636,7 @@ posix_fork(PyObject *self, PyObject *noargs)
return posix_error(); return posix_error();
if (pid == 0) if (pid == 0)
PyOS_AfterFork(); PyOS_AfterFork();
return PyInt_FromLong((long)pid); return PyLong_FromLong((long)pid);
} }
#endif #endif
@ -3757,7 +3757,7 @@ Return the current process's effective group id.");
static PyObject * static PyObject *
posix_getegid(PyObject *self, PyObject *noargs) posix_getegid(PyObject *self, PyObject *noargs)
{ {
return PyInt_FromLong((long)getegid()); return PyLong_FromLong((long)getegid());
} }
#endif #endif
@ -3770,7 +3770,7 @@ Return the current process's effective user id.");
static PyObject * static PyObject *
posix_geteuid(PyObject *self, PyObject *noargs) posix_geteuid(PyObject *self, PyObject *noargs)
{ {
return PyInt_FromLong((long)geteuid()); return PyLong_FromLong((long)geteuid());
} }
#endif #endif
@ -3783,7 +3783,7 @@ Return the current process's group id.");
static PyObject * static PyObject *
posix_getgid(PyObject *self, PyObject *noargs) posix_getgid(PyObject *self, PyObject *noargs)
{ {
return PyInt_FromLong((long)getgid()); return PyLong_FromLong((long)getgid());
} }
#endif #endif
@ -3795,7 +3795,7 @@ Return the current process id");
static PyObject * static PyObject *
posix_getpid(PyObject *self, PyObject *noargs) 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) { if (result != NULL) {
int i; int i;
for (i = 0; i < n; ++i) { for (i = 0; i < n; ++i) {
PyObject *o = PyInt_FromLong((long)grouplist[i]); PyObject *o = PyLong_FromLong((long)grouplist[i]);
if (o == NULL) { if (o == NULL) {
Py_DECREF(result); Py_DECREF(result);
result = NULL; result = NULL;
@ -3855,7 +3855,7 @@ posix_getpgid(PyObject *self, PyObject *args)
pgid = getpgid(pid); pgid = getpgid(pid);
if (pgid < 0) if (pgid < 0)
return posix_error(); return posix_error();
return PyInt_FromLong((long)pgid); return PyLong_FromLong((long)pgid);
} }
#endif /* HAVE_GETPGID */ #endif /* HAVE_GETPGID */
@ -3869,9 +3869,9 @@ static PyObject *
posix_getpgrp(PyObject *self, PyObject *noargs) posix_getpgrp(PyObject *self, PyObject *noargs)
{ {
#ifdef GETPGRP_HAVE_ARG #ifdef GETPGRP_HAVE_ARG
return PyInt_FromLong((long)getpgrp(0)); return PyLong_FromLong((long)getpgrp(0));
#else /* GETPGRP_HAVE_ARG */ #else /* GETPGRP_HAVE_ARG */
return PyInt_FromLong((long)getpgrp()); return PyLong_FromLong((long)getpgrp());
#endif /* GETPGRP_HAVE_ARG */ #endif /* GETPGRP_HAVE_ARG */
} }
#endif /* HAVE_GETPGRP */ #endif /* HAVE_GETPGRP */
@ -3905,7 +3905,7 @@ Return the parent's process id.");
static PyObject * static PyObject *
posix_getppid(PyObject *self, PyObject *noargs) posix_getppid(PyObject *self, PyObject *noargs)
{ {
return PyInt_FromLong((long)getppid()); return PyLong_FromLong((long)getppid());
} }
#endif #endif
@ -3947,7 +3947,7 @@ Return the current process's user id.");
static PyObject * static PyObject *
posix_getuid(PyObject *self, PyObject *noargs) posix_getuid(PyObject *self, PyObject *noargs)
{ {
return PyInt_FromLong((long)getuid()); return PyLong_FromLong((long)getuid());
} }
#endif #endif
@ -4237,7 +4237,7 @@ wait_helper(int pid, int status, struct rusage *ru)
PyStructSequence_SET_ITEM(result, 1, PyStructSequence_SET_ITEM(result, 1,
PyFloat_FromDouble(doubletime(ru->ru_stime))); PyFloat_FromDouble(doubletime(ru->ru_stime)));
#define SET_INT(result, index, value)\ #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, 2, ru->ru_maxrss);
SET_INT(result, 3, ru->ru_ixrss); SET_INT(result, 3, ru->ru_ixrss);
SET_INT(result, 4, ru->ru_idrss); SET_INT(result, 4, ru->ru_idrss);
@ -4569,7 +4569,7 @@ posix_getsid(PyObject *self, PyObject *args)
sid = getsid(pid); sid = getsid(pid);
if (sid < 0) if (sid < 0)
return posix_error(); return posix_error();
return PyInt_FromLong((long)sid); return PyLong_FromLong((long)sid);
} }
#endif /* HAVE_GETSID */ #endif /* HAVE_GETSID */
@ -4622,7 +4622,7 @@ posix_tcgetpgrp(PyObject *self, PyObject *args)
pgid = tcgetpgrp(fd); pgid = tcgetpgrp(fd);
if (pgid < 0) if (pgid < 0)
return posix_error(); return posix_error();
return PyInt_FromLong((long)pgid); return PyLong_FromLong((long)pgid);
} }
#endif /* HAVE_TCGETPGRP */ #endif /* HAVE_TCGETPGRP */
@ -4670,7 +4670,7 @@ posix_open(PyObject *self, PyObject *args)
Py_END_ALLOW_THREADS Py_END_ALLOW_THREADS
if (fd < 0) if (fd < 0)
return posix_error(); return posix_error();
return PyInt_FromLong((long)fd); return PyLong_FromLong((long)fd);
} }
/* Drop the argument parsing error as narrow strings /* Drop the argument parsing error as narrow strings
are also valid. */ are also valid. */
@ -4689,7 +4689,7 @@ posix_open(PyObject *self, PyObject *args)
if (fd < 0) if (fd < 0)
return posix_error_with_allocated_filename(file); return posix_error_with_allocated_filename(file);
PyMem_Free(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 Py_END_ALLOW_THREADS
if (fd < 0) if (fd < 0)
return posix_error(); 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 */ #endif /* SEEK_END */
#if !defined(HAVE_LARGEFILE_SUPPORT) #if !defined(HAVE_LARGEFILE_SUPPORT)
pos = PyInt_AsLong(posobj); pos = PyLong_AsLong(posobj);
#else #else
pos = PyLong_Check(posobj) ? pos = PyLong_Check(posobj) ?
PyLong_AsLongLong(posobj) : PyInt_AsLong(posobj); PyLong_AsLongLong(posobj) : PyLong_AsLong(posobj);
#endif #endif
if (PyErr_Occurred()) if (PyErr_Occurred())
return NULL; return NULL;
@ -4797,7 +4797,7 @@ posix_lseek(PyObject *self, PyObject *args)
return posix_error(); return posix_error();
#if !defined(HAVE_LARGEFILE_SUPPORT) #if !defined(HAVE_LARGEFILE_SUPPORT)
return PyInt_FromLong(res); return PyLong_FromLong(res);
#else #else
return PyLong_FromLongLong(res); return PyLong_FromLongLong(res);
#endif #endif
@ -4854,7 +4854,7 @@ posix_write(PyObject *self, PyObject *args)
Py_END_ALLOW_THREADS Py_END_ALLOW_THREADS
if (size < 0) if (size < 0)
return posix_error(); 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; int device;
if (!PyArg_ParseTuple(args, "i:major", &device)) if (!PyArg_ParseTuple(args, "i:major", &device))
return NULL; return NULL;
return PyInt_FromLong((long)major(device)); return PyLong_FromLong((long)major(device));
} }
PyDoc_STRVAR(posix_minor__doc__, PyDoc_STRVAR(posix_minor__doc__,
@ -5027,7 +5027,7 @@ posix_minor(PyObject *self, PyObject *args)
int device; int device;
if (!PyArg_ParseTuple(args, "i:minor", &device)) if (!PyArg_ParseTuple(args, "i:minor", &device))
return NULL; return NULL;
return PyInt_FromLong((long)minor(device)); return PyLong_FromLong((long)minor(device));
} }
PyDoc_STRVAR(posix_makedev__doc__, PyDoc_STRVAR(posix_makedev__doc__,
@ -5040,7 +5040,7 @@ posix_makedev(PyObject *self, PyObject *args)
int major, minor; int major, minor;
if (!PyArg_ParseTuple(args, "ii:makedev", &major, &minor)) if (!PyArg_ParseTuple(args, "ii:makedev", &major, &minor))
return NULL; return NULL;
return PyInt_FromLong((long)makedev(major, minor)); return PyLong_FromLong((long)makedev(major, minor));
} }
#endif /* device macros */ #endif /* device macros */
@ -5062,10 +5062,10 @@ posix_ftruncate(PyObject *self, PyObject *args)
return NULL; return NULL;
#if !defined(HAVE_LARGEFILE_SUPPORT) #if !defined(HAVE_LARGEFILE_SUPPORT)
length = PyInt_AsLong(lenobj); length = PyLong_AsLong(lenobj);
#else #else
length = PyLong_Check(lenobj) ? length = PyLong_Check(lenobj) ?
PyLong_AsLongLong(lenobj) : PyInt_AsLong(lenobj); PyLong_AsLongLong(lenobj) : PyLong_AsLong(lenobj);
#endif #endif
if (PyErr_Occurred()) if (PyErr_Occurred())
return NULL; return NULL;
@ -5401,19 +5401,19 @@ _pystatvfs_fromstructstatvfs(struct statvfs st) {
return NULL; return NULL;
#if !defined(HAVE_LARGEFILE_SUPPORT) #if !defined(HAVE_LARGEFILE_SUPPORT)
PyStructSequence_SET_ITEM(v, 0, PyInt_FromLong((long) st.f_bsize)); PyStructSequence_SET_ITEM(v, 0, PyLong_FromLong((long) st.f_bsize));
PyStructSequence_SET_ITEM(v, 1, PyInt_FromLong((long) st.f_frsize)); PyStructSequence_SET_ITEM(v, 1, PyLong_FromLong((long) st.f_frsize));
PyStructSequence_SET_ITEM(v, 2, PyInt_FromLong((long) st.f_blocks)); PyStructSequence_SET_ITEM(v, 2, PyLong_FromLong((long) st.f_blocks));
PyStructSequence_SET_ITEM(v, 3, PyInt_FromLong((long) st.f_bfree)); PyStructSequence_SET_ITEM(v, 3, PyLong_FromLong((long) st.f_bfree));
PyStructSequence_SET_ITEM(v, 4, PyInt_FromLong((long) st.f_bavail)); PyStructSequence_SET_ITEM(v, 4, PyLong_FromLong((long) st.f_bavail));
PyStructSequence_SET_ITEM(v, 5, PyInt_FromLong((long) st.f_files)); PyStructSequence_SET_ITEM(v, 5, PyLong_FromLong((long) st.f_files));
PyStructSequence_SET_ITEM(v, 6, PyInt_FromLong((long) st.f_ffree)); PyStructSequence_SET_ITEM(v, 6, PyLong_FromLong((long) st.f_ffree));
PyStructSequence_SET_ITEM(v, 7, PyInt_FromLong((long) st.f_favail)); PyStructSequence_SET_ITEM(v, 7, PyLong_FromLong((long) st.f_favail));
PyStructSequence_SET_ITEM(v, 8, PyInt_FromLong((long) st.f_flag)); PyStructSequence_SET_ITEM(v, 8, PyLong_FromLong((long) st.f_flag));
PyStructSequence_SET_ITEM(v, 9, PyInt_FromLong((long) st.f_namemax)); PyStructSequence_SET_ITEM(v, 9, PyLong_FromLong((long) st.f_namemax));
#else #else
PyStructSequence_SET_ITEM(v, 0, PyInt_FromLong((long) st.f_bsize)); PyStructSequence_SET_ITEM(v, 0, PyLong_FromLong((long) st.f_bsize));
PyStructSequence_SET_ITEM(v, 1, PyInt_FromLong((long) st.f_frsize)); PyStructSequence_SET_ITEM(v, 1, PyLong_FromLong((long) st.f_frsize));
PyStructSequence_SET_ITEM(v, 2, PyStructSequence_SET_ITEM(v, 2,
PyLong_FromLongLong((PY_LONG_LONG) st.f_blocks)); PyLong_FromLongLong((PY_LONG_LONG) st.f_blocks));
PyStructSequence_SET_ITEM(v, 3, PyStructSequence_SET_ITEM(v, 3,
@ -5426,8 +5426,8 @@ _pystatvfs_fromstructstatvfs(struct statvfs st) {
PyLong_FromLongLong((PY_LONG_LONG) st.f_ffree)); PyLong_FromLongLong((PY_LONG_LONG) st.f_ffree));
PyStructSequence_SET_ITEM(v, 7, PyStructSequence_SET_ITEM(v, 7,
PyLong_FromLongLong((PY_LONG_LONG) st.f_favail)); PyLong_FromLongLong((PY_LONG_LONG) st.f_favail));
PyStructSequence_SET_ITEM(v, 8, PyInt_FromLong((long) st.f_flag)); PyStructSequence_SET_ITEM(v, 8, PyLong_FromLong((long) st.f_flag));
PyStructSequence_SET_ITEM(v, 9, PyInt_FromLong((long) st.f_namemax)); PyStructSequence_SET_ITEM(v, 9, PyLong_FromLong((long) st.f_namemax));
#endif #endif
return v; return v;
@ -5501,8 +5501,8 @@ static int
conv_confname(PyObject *arg, int *valuep, struct constdef *table, conv_confname(PyObject *arg, int *valuep, struct constdef *table,
size_t tablesize) size_t tablesize)
{ {
if (PyInt_Check(arg)) { if (PyLong_Check(arg)) {
*valuep = PyInt_AS_LONG(arg); *valuep = PyLong_AS_LONG(arg);
return 1; return 1;
} }
else { else {
@ -5625,7 +5625,7 @@ posix_fpathconf(PyObject *self, PyObject *args)
if (limit == -1 && errno != 0) if (limit == -1 && errno != 0)
posix_error(); posix_error();
else else
result = PyInt_FromLong(limit); result = PyLong_FromLong(limit);
} }
return result; return result;
} }
@ -5659,7 +5659,7 @@ posix_pathconf(PyObject *self, PyObject *args)
posix_error_with_filename(path); posix_error_with_filename(path);
} }
else else
result = PyInt_FromLong(limit); result = PyLong_FromLong(limit);
} }
return result; return result;
} }
@ -6383,7 +6383,7 @@ posix_sysconf(PyObject *self, PyObject *args)
if (value == -1 && errno != 0) if (value == -1 && errno != 0)
posix_error(); posix_error();
else else
result = PyInt_FromLong(value); result = PyLong_FromLong(value);
} }
return result; return result;
} }
@ -6424,7 +6424,7 @@ setup_confname_table(struct constdef *table, size_t tablesize,
return -1; return -1;
for (i=0; i < tablesize; ++i) { 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) { if (o == NULL || PyDict_SetItemString(d, table[i].name, o) == -1) {
Py_XDECREF(o); Py_XDECREF(o);
Py_DECREF(d); Py_DECREF(d);

View File

@ -67,7 +67,7 @@ mkpwent(struct passwd *p)
if (v == NULL) if (v == NULL)
return 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) #define SETS(i,val) sets(v, i, val)
SETS(setIndex++, p->pw_name); SETS(setIndex++, p->pw_name);

View File

@ -83,7 +83,7 @@ static struct HandlerInfo handler_info[64];
static int static int
set_error_attr(PyObject *err, char *name, int value) 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) { if (v == NULL || PyObject_SetAttrString(err, name, v) == -1) {
Py_XDECREF(v); Py_XDECREF(v);
@ -583,7 +583,7 @@ my_##NAME##Handler PARAMS {\
#define INT_HANDLER(NAME, PARAMS, PARAM_FORMAT)\ #define INT_HANDLER(NAME, PARAMS, PARAM_FORMAT)\
RC_HANDLER(int, NAME, PARAMS, int rc=0;, PARAM_FORMAT, \ RC_HANDLER(int, NAME, PARAMS, int rc=0;, PARAM_FORMAT, \
rc = PyInt_AsLong(rv);, rc, \ rc = PyLong_AsLong(rv);, rc, \
(xmlparseobject *)userData) (xmlparseobject *)userData)
VOID_HANDLER(EndElement, VOID_HANDLER(EndElement,
@ -784,7 +784,7 @@ RC_HANDLER(int, ExternalEntityRef,
("(O&NNN)", ("(O&NNN)",
conv_string_to_unicode ,context, string_intern(self, base), conv_string_to_unicode ,context, string_intern(self, base),
string_intern(self, systemId), string_intern(self, publicId)), string_intern(self, systemId), string_intern(self, publicId)),
rc = PyInt_AsLong(rv);, rc, rc = PyLong_AsLong(rv);, rc,
XML_GetUserData(parser)) XML_GetUserData(parser))
/* XXX UnknownEncodingHandler */ /* XXX UnknownEncodingHandler */
@ -813,7 +813,7 @@ get_parse_result(xmlparseobject *self, int rv)
if (flush_character_buffer(self) < 0) { if (flush_character_buffer(self) < 0) {
return NULL; return NULL;
} }
return PyInt_FromLong(rv); return PyLong_FromLong(rv);
} }
PyDoc_STRVAR(xmlparse_Parse__doc__, PyDoc_STRVAR(xmlparse_Parse__doc__,
@ -846,7 +846,7 @@ readinst(char *buf, int buf_size, PyObject *meth)
int len = -1; int len = -1;
char *ptr; char *ptr;
if ((bytes = PyInt_FromLong(buf_size)) == NULL) if ((bytes = PyLong_FromLong(buf_size)) == NULL)
goto finally; goto finally;
if ((arg = PyTuple_New(1)) == NULL) { if ((arg = PyTuple_New(1)) == NULL) {
@ -1103,7 +1103,7 @@ xmlparse_SetParamEntityParsing(xmlparseobject *p, PyObject* args)
if (!PyArg_ParseTuple(args, "i", &flag)) if (!PyArg_ParseTuple(args, "i", &flag))
return NULL; return NULL;
flag = XML_SetParamEntityParsing(p->itself, flag); 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 (name[0] == 'E') {
if (strcmp(name, "ErrorCode") == 0) if (strcmp(name, "ErrorCode") == 0)
return PyInt_FromLong((long) return PyLong_FromLong((long)
XML_GetErrorCode(self->itself)); XML_GetErrorCode(self->itself));
if (strcmp(name, "ErrorLineNumber") == 0) if (strcmp(name, "ErrorLineNumber") == 0)
return PyInt_FromLong((long) return PyLong_FromLong((long)
XML_GetErrorLineNumber(self->itself)); XML_GetErrorLineNumber(self->itself));
if (strcmp(name, "ErrorColumnNumber") == 0) if (strcmp(name, "ErrorColumnNumber") == 0)
return PyInt_FromLong((long) return PyLong_FromLong((long)
XML_GetErrorColumnNumber(self->itself)); XML_GetErrorColumnNumber(self->itself));
if (strcmp(name, "ErrorByteIndex") == 0) if (strcmp(name, "ErrorByteIndex") == 0)
return PyInt_FromLong((long) return PyLong_FromLong((long)
XML_GetErrorByteIndex(self->itself)); XML_GetErrorByteIndex(self->itself));
} }
if (name[0] == 'C') { if (name[0] == 'C') {
if (strcmp(name, "CurrentLineNumber") == 0) if (strcmp(name, "CurrentLineNumber") == 0)
return PyInt_FromLong((long) return PyLong_FromLong((long)
XML_GetCurrentLineNumber(self->itself)); XML_GetCurrentLineNumber(self->itself));
if (strcmp(name, "CurrentColumnNumber") == 0) if (strcmp(name, "CurrentColumnNumber") == 0)
return PyInt_FromLong((long) return PyLong_FromLong((long)
XML_GetCurrentColumnNumber(self->itself)); XML_GetCurrentColumnNumber(self->itself));
if (strcmp(name, "CurrentByteIndex") == 0) if (strcmp(name, "CurrentByteIndex") == 0)
return PyInt_FromLong((long) return PyLong_FromLong((long)
XML_GetCurrentByteIndex(self->itself)); XML_GetCurrentByteIndex(self->itself));
} }
if (name[0] == 'b') { if (name[0] == 'b') {
if (strcmp(name, "buffer_size") == 0) 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) if (strcmp(name, "buffer_text") == 0)
return get_pybool(self->buffer != NULL); return get_pybool(self->buffer != NULL);
if (strcmp(name, "buffer_used") == 0) 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) if (strcmp(name, "namespace_prefixes") == 0)
return get_pybool(self->ns_prefixes); return get_pybool(self->ns_prefixes);

View File

@ -154,7 +154,7 @@ history truncation.");
static PyObject* static PyObject*
get_history_length(PyObject *self, PyObject *noarg) get_history_length(PyObject *self, PyObject *noarg)
{ {
return PyInt_FromLong(_history_length); return PyLong_FromLong(_history_length);
} }
PyDoc_STRVAR(get_history_length_doc, PyDoc_STRVAR(get_history_length_doc,
@ -271,7 +271,7 @@ static PyObject *endidx = NULL;
static PyObject * static PyObject *
get_completion_type(PyObject *self, PyObject *noarg) 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, PyDoc_STRVAR(doc_get_completion_type,
@ -490,7 +490,7 @@ get_current_history_length(PyObject *self, PyObject *noarg)
HISTORY_STATE *hist_st; HISTORY_STATE *hist_st;
hist_st = history_get_history_state(); 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, PyDoc_STRVAR(doc_get_current_history_length,
@ -628,7 +628,7 @@ on_hook(PyObject *func)
if (r == Py_None) if (r == Py_None)
result = 0; result = 0;
else { else {
result = PyInt_AsLong(r); result = PyLong_AsLong(r);
if (result == -1 && PyErr_Occurred()) if (result == -1 && PyErr_Occurred())
goto error; goto error;
} }
@ -688,7 +688,7 @@ on_completion_display_matches_hook(char **matches,
Py_DECREF(m), m=NULL; Py_DECREF(m), m=NULL;
if (r == NULL || if (r == NULL ||
(r != Py_None && PyInt_AsLong(r) == -1 && PyErr_Occurred())) { (r != Py_None && PyLong_AsLong(r) == -1 && PyErr_Occurred())) {
goto error; goto error;
} }
Py_XDECREF(r), r=NULL; Py_XDECREF(r), r=NULL;
@ -752,8 +752,8 @@ flex_complete(char *text, int start, int end)
{ {
Py_XDECREF(begidx); Py_XDECREF(begidx);
Py_XDECREF(endidx); Py_XDECREF(endidx);
begidx = PyInt_FromLong((long) start); begidx = PyLong_FromLong((long) start);
endidx = PyInt_FromLong((long) end); endidx = PyLong_FromLong((long) end);
return completion_matches(text, *on_completion); return completion_matches(text, *on_completion);
} }
@ -796,8 +796,8 @@ setup_readline(void)
rl_completion_append_character ='\0'; rl_completion_append_character ='\0';
#endif #endif
begidx = PyInt_FromLong(0L); begidx = PyLong_FromLong(0L);
endidx = PyInt_FromLong(0L); endidx = PyLong_FromLong(0L);
/* Initialize (allows .inputrc to override) /* Initialize (allows .inputrc to override)
* *
* XXX: A bug in the readline-2.2 library causes a memory leak * XXX: A bug in the readline-2.2 library causes a memory leak

View File

@ -86,20 +86,20 @@ resource_getrusage(PyObject *self, PyObject *args)
PyFloat_FromDouble(doubletime(ru.ru_utime))); PyFloat_FromDouble(doubletime(ru.ru_utime)));
PyStructSequence_SET_ITEM(result, 1, PyStructSequence_SET_ITEM(result, 1,
PyFloat_FromDouble(doubletime(ru.ru_stime))); PyFloat_FromDouble(doubletime(ru.ru_stime)));
PyStructSequence_SET_ITEM(result, 2, PyInt_FromLong(ru.ru_maxrss)); PyStructSequence_SET_ITEM(result, 2, PyLong_FromLong(ru.ru_maxrss));
PyStructSequence_SET_ITEM(result, 3, PyInt_FromLong(ru.ru_ixrss)); PyStructSequence_SET_ITEM(result, 3, PyLong_FromLong(ru.ru_ixrss));
PyStructSequence_SET_ITEM(result, 4, PyInt_FromLong(ru.ru_idrss)); PyStructSequence_SET_ITEM(result, 4, PyLong_FromLong(ru.ru_idrss));
PyStructSequence_SET_ITEM(result, 5, PyInt_FromLong(ru.ru_isrss)); PyStructSequence_SET_ITEM(result, 5, PyLong_FromLong(ru.ru_isrss));
PyStructSequence_SET_ITEM(result, 6, PyInt_FromLong(ru.ru_minflt)); PyStructSequence_SET_ITEM(result, 6, PyLong_FromLong(ru.ru_minflt));
PyStructSequence_SET_ITEM(result, 7, PyInt_FromLong(ru.ru_majflt)); PyStructSequence_SET_ITEM(result, 7, PyLong_FromLong(ru.ru_majflt));
PyStructSequence_SET_ITEM(result, 8, PyInt_FromLong(ru.ru_nswap)); PyStructSequence_SET_ITEM(result, 8, PyLong_FromLong(ru.ru_nswap));
PyStructSequence_SET_ITEM(result, 9, PyInt_FromLong(ru.ru_inblock)); PyStructSequence_SET_ITEM(result, 9, PyLong_FromLong(ru.ru_inblock));
PyStructSequence_SET_ITEM(result, 10, PyInt_FromLong(ru.ru_oublock)); PyStructSequence_SET_ITEM(result, 10, PyLong_FromLong(ru.ru_oublock));
PyStructSequence_SET_ITEM(result, 11, PyInt_FromLong(ru.ru_msgsnd)); PyStructSequence_SET_ITEM(result, 11, PyLong_FromLong(ru.ru_msgsnd));
PyStructSequence_SET_ITEM(result, 12, PyInt_FromLong(ru.ru_msgrcv)); PyStructSequence_SET_ITEM(result, 12, PyLong_FromLong(ru.ru_msgrcv));
PyStructSequence_SET_ITEM(result, 13, PyInt_FromLong(ru.ru_nsignals)); PyStructSequence_SET_ITEM(result, 13, PyLong_FromLong(ru.ru_nsignals));
PyStructSequence_SET_ITEM(result, 14, PyInt_FromLong(ru.ru_nvcsw)); PyStructSequence_SET_ITEM(result, 14, PyLong_FromLong(ru.ru_nvcsw));
PyStructSequence_SET_ITEM(result, 15, PyInt_FromLong(ru.ru_nivcsw)); PyStructSequence_SET_ITEM(result, 15, PyLong_FromLong(ru.ru_nivcsw));
if (PyErr_Occurred()) { if (PyErr_Occurred()) {
Py_DECREF(result); Py_DECREF(result);
@ -158,20 +158,20 @@ resource_setrlimit(PyObject *self, PyObject *args)
} }
#if !defined(HAVE_LARGEFILE_SUPPORT) #if !defined(HAVE_LARGEFILE_SUPPORT)
rl.rlim_cur = PyInt_AsLong(curobj); rl.rlim_cur = PyLong_AsLong(curobj);
if (rl.rlim_cur == -1 && PyErr_Occurred()) if (rl.rlim_cur == -1 && PyErr_Occurred())
return NULL; return NULL;
rl.rlim_max = PyInt_AsLong(maxobj); rl.rlim_max = PyLong_AsLong(maxobj);
if (rl.rlim_max == -1 && PyErr_Occurred()) if (rl.rlim_max == -1 && PyErr_Occurred())
return NULL; return NULL;
#else #else
/* The limits are probably bigger than a long */ /* The limits are probably bigger than a long */
rl.rlim_cur = PyLong_Check(curobj) ? 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()) if (rl.rlim_cur == -1 && PyErr_Occurred())
return NULL; return NULL;
rl.rlim_max = PyLong_Check(maxobj) ? 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()) if (rl.rlim_max == -1 && PyErr_Occurred())
return NULL; return NULL;
#endif #endif
@ -320,7 +320,7 @@ initresource(void)
} else } else
#endif #endif
{ {
v = PyInt_FromLong((long) RLIM_INFINITY); v = PyLong_FromLong((long) RLIM_INFINITY);
} }
if (v) { if (v) {
PyModule_AddObject(m, "RLIM_INFINITY", v); PyModule_AddObject(m, "RLIM_INFINITY", v);

View File

@ -355,8 +355,8 @@ update_ufd_array(pollObject *self)
i = pos = 0; i = pos = 0;
while (PyDict_Next(self->dict, &pos, &key, &value)) { while (PyDict_Next(self->dict, &pos, &key, &value)) {
self->ufds[i].fd = PyInt_AsLong(key); self->ufds[i].fd = PyLong_AsLong(key);
self->ufds[i].events = (short)PyInt_AsLong(value); self->ufds[i].events = (short)PyLong_AsLong(value);
i++; i++;
} }
self->ufd_uptodate = 1; self->ufd_uptodate = 1;
@ -386,10 +386,10 @@ poll_register(pollObject *self, PyObject *args)
/* Add entry to the internal dictionary: the key is the /* Add entry to the internal dictionary: the key is the
file descriptor, and the value is the event mask. */ file descriptor, and the value is the event mask. */
key = PyInt_FromLong(fd); key = PyLong_FromLong(fd);
if (key == NULL) if (key == NULL)
return NULL; return NULL;
value = PyInt_FromLong(events); value = PyLong_FromLong(events);
if (value == NULL) { if (value == NULL) {
Py_DECREF(key); Py_DECREF(key);
return NULL; return NULL;
@ -421,7 +421,7 @@ poll_unregister(pollObject *self, PyObject *o)
return NULL; return NULL;
/* Check whether the fd is already in the array */ /* Check whether the fd is already in the array */
key = PyInt_FromLong(fd); key = PyLong_FromLong(fd);
if (key == NULL) if (key == NULL)
return NULL; return NULL;
@ -467,7 +467,7 @@ poll_poll(pollObject *self, PyObject *args)
tout = PyNumber_Int(tout); tout = PyNumber_Int(tout);
if (!tout) if (!tout)
return NULL; return NULL;
timeout = PyInt_AsLong(tout); timeout = PyLong_AsLong(tout);
Py_DECREF(tout); Py_DECREF(tout);
if (timeout == -1 && PyErr_Occurred()) if (timeout == -1 && PyErr_Occurred())
return NULL; return NULL;
@ -505,7 +505,7 @@ poll_poll(pollObject *self, PyObject *args)
value = PyTuple_New(2); value = PyTuple_New(2);
if (value == NULL) if (value == NULL)
goto error; goto error;
num = PyInt_FromLong(self->ufds[i].fd); num = PyLong_FromLong(self->ufds[i].fd);
if (num == NULL) { if (num == NULL) {
Py_DECREF(value); Py_DECREF(value);
goto error; goto error;
@ -516,7 +516,7 @@ poll_poll(pollObject *self, PyObject *args)
is a 16-bit short, and IBM assigned POLLNVAL is a 16-bit short, and IBM assigned POLLNVAL
to be 0x8000, so the conversion to int results to be 0x8000, so the conversion to int results
in a negative number. See SF bug #923315. */ 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) { if (num == NULL) {
Py_DECREF(value); Py_DECREF(value);
goto error; goto error;

View File

@ -410,7 +410,7 @@ static PyMethodDef SHA1_methods[] = {
static PyObject * static PyObject *
SHA1_get_block_size(PyObject *self, void *closure) SHA1_get_block_size(PyObject *self, void *closure)
{ {
return PyInt_FromLong(SHA1_BLOCKSIZE); return PyLong_FromLong(SHA1_BLOCKSIZE);
} }
static PyObject * static PyObject *
@ -422,7 +422,7 @@ SHA1_get_name(PyObject *self, void *closure)
static PyObject * static PyObject *
sha1_get_digest_size(PyObject *self, void *closure) sha1_get_digest_size(PyObject *self, void *closure)
{ {
return PyInt_FromLong(SHA1_DIGESTSIZE); return PyLong_FromLong(SHA1_DIGESTSIZE);
} }

View File

@ -503,7 +503,7 @@ static PyMethodDef SHA_methods[] = {
static PyObject * static PyObject *
SHA256_get_block_size(PyObject *self, void *closure) SHA256_get_block_size(PyObject *self, void *closure)
{ {
return PyInt_FromLong(SHA_BLOCKSIZE); return PyLong_FromLong(SHA_BLOCKSIZE);
} }
static PyObject * static PyObject *

View File

@ -569,7 +569,7 @@ static PyMethodDef SHA_methods[] = {
static PyObject * static PyObject *
SHA512_get_block_size(PyObject *self, void *closure) SHA512_get_block_size(PyObject *self, void *closure)
{ {
return PyInt_FromLong(SHA_BLOCKSIZE); return PyLong_FromLong(SHA_BLOCKSIZE);
} }
static PyObject * static PyObject *

View File

@ -149,7 +149,7 @@ signal_alarm(PyObject *self, PyObject *args)
if (!PyArg_ParseTuple(args, "i:alarm", &t)) if (!PyArg_ParseTuple(args, "i:alarm", &t))
return NULL; return NULL;
/* alarm() returns the number of seconds remaining */ /* alarm() returns the number of seconds remaining */
return PyInt_FromLong((long)alarm(t)); return PyLong_FromLong((long)alarm(t));
} }
PyDoc_STRVAR(alarm_doc, PyDoc_STRVAR(alarm_doc,
@ -331,7 +331,7 @@ initsignal(void)
if (!x || PyDict_SetItemString(d, "SIG_IGN", x) < 0) if (!x || PyDict_SetItemString(d, "SIG_IGN", x) < 0)
goto finally; goto finally;
x = PyInt_FromLong((long)NSIG); x = PyLong_FromLong((long)NSIG);
if (!x || PyDict_SetItemString(d, "NSIG", x) < 0) if (!x || PyDict_SetItemString(d, "NSIG", x) < 0)
goto finally; goto finally;
Py_DECREF(x); Py_DECREF(x);
@ -363,192 +363,192 @@ initsignal(void)
} }
#ifdef SIGHUP #ifdef SIGHUP
x = PyInt_FromLong(SIGHUP); x = PyLong_FromLong(SIGHUP);
PyDict_SetItemString(d, "SIGHUP", x); PyDict_SetItemString(d, "SIGHUP", x);
Py_XDECREF(x); Py_XDECREF(x);
#endif #endif
#ifdef SIGINT #ifdef SIGINT
x = PyInt_FromLong(SIGINT); x = PyLong_FromLong(SIGINT);
PyDict_SetItemString(d, "SIGINT", x); PyDict_SetItemString(d, "SIGINT", x);
Py_XDECREF(x); Py_XDECREF(x);
#endif #endif
#ifdef SIGBREAK #ifdef SIGBREAK
x = PyInt_FromLong(SIGBREAK); x = PyLong_FromLong(SIGBREAK);
PyDict_SetItemString(d, "SIGBREAK", x); PyDict_SetItemString(d, "SIGBREAK", x);
Py_XDECREF(x); Py_XDECREF(x);
#endif #endif
#ifdef SIGQUIT #ifdef SIGQUIT
x = PyInt_FromLong(SIGQUIT); x = PyLong_FromLong(SIGQUIT);
PyDict_SetItemString(d, "SIGQUIT", x); PyDict_SetItemString(d, "SIGQUIT", x);
Py_XDECREF(x); Py_XDECREF(x);
#endif #endif
#ifdef SIGILL #ifdef SIGILL
x = PyInt_FromLong(SIGILL); x = PyLong_FromLong(SIGILL);
PyDict_SetItemString(d, "SIGILL", x); PyDict_SetItemString(d, "SIGILL", x);
Py_XDECREF(x); Py_XDECREF(x);
#endif #endif
#ifdef SIGTRAP #ifdef SIGTRAP
x = PyInt_FromLong(SIGTRAP); x = PyLong_FromLong(SIGTRAP);
PyDict_SetItemString(d, "SIGTRAP", x); PyDict_SetItemString(d, "SIGTRAP", x);
Py_XDECREF(x); Py_XDECREF(x);
#endif #endif
#ifdef SIGIOT #ifdef SIGIOT
x = PyInt_FromLong(SIGIOT); x = PyLong_FromLong(SIGIOT);
PyDict_SetItemString(d, "SIGIOT", x); PyDict_SetItemString(d, "SIGIOT", x);
Py_XDECREF(x); Py_XDECREF(x);
#endif #endif
#ifdef SIGABRT #ifdef SIGABRT
x = PyInt_FromLong(SIGABRT); x = PyLong_FromLong(SIGABRT);
PyDict_SetItemString(d, "SIGABRT", x); PyDict_SetItemString(d, "SIGABRT", x);
Py_XDECREF(x); Py_XDECREF(x);
#endif #endif
#ifdef SIGEMT #ifdef SIGEMT
x = PyInt_FromLong(SIGEMT); x = PyLong_FromLong(SIGEMT);
PyDict_SetItemString(d, "SIGEMT", x); PyDict_SetItemString(d, "SIGEMT", x);
Py_XDECREF(x); Py_XDECREF(x);
#endif #endif
#ifdef SIGFPE #ifdef SIGFPE
x = PyInt_FromLong(SIGFPE); x = PyLong_FromLong(SIGFPE);
PyDict_SetItemString(d, "SIGFPE", x); PyDict_SetItemString(d, "SIGFPE", x);
Py_XDECREF(x); Py_XDECREF(x);
#endif #endif
#ifdef SIGKILL #ifdef SIGKILL
x = PyInt_FromLong(SIGKILL); x = PyLong_FromLong(SIGKILL);
PyDict_SetItemString(d, "SIGKILL", x); PyDict_SetItemString(d, "SIGKILL", x);
Py_XDECREF(x); Py_XDECREF(x);
#endif #endif
#ifdef SIGBUS #ifdef SIGBUS
x = PyInt_FromLong(SIGBUS); x = PyLong_FromLong(SIGBUS);
PyDict_SetItemString(d, "SIGBUS", x); PyDict_SetItemString(d, "SIGBUS", x);
Py_XDECREF(x); Py_XDECREF(x);
#endif #endif
#ifdef SIGSEGV #ifdef SIGSEGV
x = PyInt_FromLong(SIGSEGV); x = PyLong_FromLong(SIGSEGV);
PyDict_SetItemString(d, "SIGSEGV", x); PyDict_SetItemString(d, "SIGSEGV", x);
Py_XDECREF(x); Py_XDECREF(x);
#endif #endif
#ifdef SIGSYS #ifdef SIGSYS
x = PyInt_FromLong(SIGSYS); x = PyLong_FromLong(SIGSYS);
PyDict_SetItemString(d, "SIGSYS", x); PyDict_SetItemString(d, "SIGSYS", x);
Py_XDECREF(x); Py_XDECREF(x);
#endif #endif
#ifdef SIGPIPE #ifdef SIGPIPE
x = PyInt_FromLong(SIGPIPE); x = PyLong_FromLong(SIGPIPE);
PyDict_SetItemString(d, "SIGPIPE", x); PyDict_SetItemString(d, "SIGPIPE", x);
Py_XDECREF(x); Py_XDECREF(x);
#endif #endif
#ifdef SIGALRM #ifdef SIGALRM
x = PyInt_FromLong(SIGALRM); x = PyLong_FromLong(SIGALRM);
PyDict_SetItemString(d, "SIGALRM", x); PyDict_SetItemString(d, "SIGALRM", x);
Py_XDECREF(x); Py_XDECREF(x);
#endif #endif
#ifdef SIGTERM #ifdef SIGTERM
x = PyInt_FromLong(SIGTERM); x = PyLong_FromLong(SIGTERM);
PyDict_SetItemString(d, "SIGTERM", x); PyDict_SetItemString(d, "SIGTERM", x);
Py_XDECREF(x); Py_XDECREF(x);
#endif #endif
#ifdef SIGUSR1 #ifdef SIGUSR1
x = PyInt_FromLong(SIGUSR1); x = PyLong_FromLong(SIGUSR1);
PyDict_SetItemString(d, "SIGUSR1", x); PyDict_SetItemString(d, "SIGUSR1", x);
Py_XDECREF(x); Py_XDECREF(x);
#endif #endif
#ifdef SIGUSR2 #ifdef SIGUSR2
x = PyInt_FromLong(SIGUSR2); x = PyLong_FromLong(SIGUSR2);
PyDict_SetItemString(d, "SIGUSR2", x); PyDict_SetItemString(d, "SIGUSR2", x);
Py_XDECREF(x); Py_XDECREF(x);
#endif #endif
#ifdef SIGCLD #ifdef SIGCLD
x = PyInt_FromLong(SIGCLD); x = PyLong_FromLong(SIGCLD);
PyDict_SetItemString(d, "SIGCLD", x); PyDict_SetItemString(d, "SIGCLD", x);
Py_XDECREF(x); Py_XDECREF(x);
#endif #endif
#ifdef SIGCHLD #ifdef SIGCHLD
x = PyInt_FromLong(SIGCHLD); x = PyLong_FromLong(SIGCHLD);
PyDict_SetItemString(d, "SIGCHLD", x); PyDict_SetItemString(d, "SIGCHLD", x);
Py_XDECREF(x); Py_XDECREF(x);
#endif #endif
#ifdef SIGPWR #ifdef SIGPWR
x = PyInt_FromLong(SIGPWR); x = PyLong_FromLong(SIGPWR);
PyDict_SetItemString(d, "SIGPWR", x); PyDict_SetItemString(d, "SIGPWR", x);
Py_XDECREF(x); Py_XDECREF(x);
#endif #endif
#ifdef SIGIO #ifdef SIGIO
x = PyInt_FromLong(SIGIO); x = PyLong_FromLong(SIGIO);
PyDict_SetItemString(d, "SIGIO", x); PyDict_SetItemString(d, "SIGIO", x);
Py_XDECREF(x); Py_XDECREF(x);
#endif #endif
#ifdef SIGURG #ifdef SIGURG
x = PyInt_FromLong(SIGURG); x = PyLong_FromLong(SIGURG);
PyDict_SetItemString(d, "SIGURG", x); PyDict_SetItemString(d, "SIGURG", x);
Py_XDECREF(x); Py_XDECREF(x);
#endif #endif
#ifdef SIGWINCH #ifdef SIGWINCH
x = PyInt_FromLong(SIGWINCH); x = PyLong_FromLong(SIGWINCH);
PyDict_SetItemString(d, "SIGWINCH", x); PyDict_SetItemString(d, "SIGWINCH", x);
Py_XDECREF(x); Py_XDECREF(x);
#endif #endif
#ifdef SIGPOLL #ifdef SIGPOLL
x = PyInt_FromLong(SIGPOLL); x = PyLong_FromLong(SIGPOLL);
PyDict_SetItemString(d, "SIGPOLL", x); PyDict_SetItemString(d, "SIGPOLL", x);
Py_XDECREF(x); Py_XDECREF(x);
#endif #endif
#ifdef SIGSTOP #ifdef SIGSTOP
x = PyInt_FromLong(SIGSTOP); x = PyLong_FromLong(SIGSTOP);
PyDict_SetItemString(d, "SIGSTOP", x); PyDict_SetItemString(d, "SIGSTOP", x);
Py_XDECREF(x); Py_XDECREF(x);
#endif #endif
#ifdef SIGTSTP #ifdef SIGTSTP
x = PyInt_FromLong(SIGTSTP); x = PyLong_FromLong(SIGTSTP);
PyDict_SetItemString(d, "SIGTSTP", x); PyDict_SetItemString(d, "SIGTSTP", x);
Py_XDECREF(x); Py_XDECREF(x);
#endif #endif
#ifdef SIGCONT #ifdef SIGCONT
x = PyInt_FromLong(SIGCONT); x = PyLong_FromLong(SIGCONT);
PyDict_SetItemString(d, "SIGCONT", x); PyDict_SetItemString(d, "SIGCONT", x);
Py_XDECREF(x); Py_XDECREF(x);
#endif #endif
#ifdef SIGTTIN #ifdef SIGTTIN
x = PyInt_FromLong(SIGTTIN); x = PyLong_FromLong(SIGTTIN);
PyDict_SetItemString(d, "SIGTTIN", x); PyDict_SetItemString(d, "SIGTTIN", x);
Py_XDECREF(x); Py_XDECREF(x);
#endif #endif
#ifdef SIGTTOU #ifdef SIGTTOU
x = PyInt_FromLong(SIGTTOU); x = PyLong_FromLong(SIGTTOU);
PyDict_SetItemString(d, "SIGTTOU", x); PyDict_SetItemString(d, "SIGTTOU", x);
Py_XDECREF(x); Py_XDECREF(x);
#endif #endif
#ifdef SIGVTALRM #ifdef SIGVTALRM
x = PyInt_FromLong(SIGVTALRM); x = PyLong_FromLong(SIGVTALRM);
PyDict_SetItemString(d, "SIGVTALRM", x); PyDict_SetItemString(d, "SIGVTALRM", x);
Py_XDECREF(x); Py_XDECREF(x);
#endif #endif
#ifdef SIGPROF #ifdef SIGPROF
x = PyInt_FromLong(SIGPROF); x = PyLong_FromLong(SIGPROF);
PyDict_SetItemString(d, "SIGPROF", x); PyDict_SetItemString(d, "SIGPROF", x);
Py_XDECREF(x); Py_XDECREF(x);
#endif #endif
#ifdef SIGXCPU #ifdef SIGXCPU
x = PyInt_FromLong(SIGXCPU); x = PyLong_FromLong(SIGXCPU);
PyDict_SetItemString(d, "SIGXCPU", x); PyDict_SetItemString(d, "SIGXCPU", x);
Py_XDECREF(x); Py_XDECREF(x);
#endif #endif
#ifdef SIGXFSZ #ifdef SIGXFSZ
x = PyInt_FromLong(SIGXFSZ); x = PyLong_FromLong(SIGXFSZ);
PyDict_SetItemString(d, "SIGXFSZ", x); PyDict_SetItemString(d, "SIGXFSZ", x);
Py_XDECREF(x); Py_XDECREF(x);
#endif #endif
#ifdef SIGRTMIN #ifdef SIGRTMIN
x = PyInt_FromLong(SIGRTMIN); x = PyLong_FromLong(SIGRTMIN);
PyDict_SetItemString(d, "SIGRTMIN", x); PyDict_SetItemString(d, "SIGRTMIN", x);
Py_XDECREF(x); Py_XDECREF(x);
#endif #endif
#ifdef SIGRTMAX #ifdef SIGRTMAX
x = PyInt_FromLong(SIGRTMAX); x = PyLong_FromLong(SIGRTMAX);
PyDict_SetItemString(d, "SIGRTMAX", x); PyDict_SetItemString(d, "SIGRTMAX", x);
Py_XDECREF(x); Py_XDECREF(x);
#endif #endif
#ifdef SIGINFO #ifdef SIGINFO
x = PyInt_FromLong(SIGINFO); x = PyLong_FromLong(SIGINFO);
PyDict_SetItemString(d, "SIGINFO", x); PyDict_SetItemString(d, "SIGINFO", x);
Py_XDECREF(x); Py_XDECREF(x);
#endif #endif

View File

@ -1508,7 +1508,7 @@ sock_setblocking(PySocketSockObject *s, PyObject *arg)
{ {
int block; int block;
block = PyInt_AsLong(arg); block = PyLong_AsLong(arg);
if (block == -1 && PyErr_Occurred()) if (block == -1 && PyErr_Occurred())
return NULL; return NULL;
@ -1649,7 +1649,7 @@ sock_getsockopt(PySocketSockObject *s, PyObject *args)
(void *)&flag, &flagsize); (void *)&flag, &flagsize);
if (res < 0) if (res < 0)
return s->errorhandler(); return s->errorhandler();
return PyInt_FromLong(flag); return PyLong_FromLong(flag);
} }
#ifdef __VMS #ifdef __VMS
/* socklen_t is unsigned so no negative test is needed, /* socklen_t is unsigned so no negative test is needed,
@ -1874,7 +1874,7 @@ sock_connect_ex(PySocketSockObject *s, PyObject *addro)
return NULL; return NULL;
#endif #endif
return PyInt_FromLong((long) res); return PyLong_FromLong((long) res);
} }
PyDoc_STRVAR(connect_ex_doc, PyDoc_STRVAR(connect_ex_doc,
@ -1965,7 +1965,7 @@ sock_listen(PySocketSockObject *s, PyObject *arg)
int backlog; int backlog;
int res; int res;
backlog = PyInt_AsLong(arg); backlog = PyLong_AsLong(arg);
if (backlog == -1 && PyErr_Occurred()) if (backlog == -1 && PyErr_Occurred())
return NULL; return NULL;
Py_BEGIN_ALLOW_THREADS 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 /* Return the number of bytes read. Note that we do not do anything
special here in the case that readlen < recvlen. */ special here in the case that readlen < recvlen. */
return PyInt_FromSsize_t(readlen); return PyLong_FromSsize_t(readlen);
} }
PyDoc_STRVAR(recv_into_doc, PyDoc_STRVAR(recv_into_doc,
@ -2375,7 +2375,7 @@ sock_send(PySocketSockObject *s, PyObject *args)
} }
if (n < 0) if (n < 0)
return s->errorhandler(); return s->errorhandler();
return PyInt_FromLong((long)n); return PyLong_FromLong((long)n);
} }
PyDoc_STRVAR(send_doc, PyDoc_STRVAR(send_doc,
@ -2474,7 +2474,7 @@ sock_sendto(PySocketSockObject *s, PyObject *args)
} }
if (n < 0) if (n < 0)
return s->errorhandler(); return s->errorhandler();
return PyInt_FromLong((long)n); return PyLong_FromLong((long)n);
} }
PyDoc_STRVAR(sendto_doc, PyDoc_STRVAR(sendto_doc,
@ -2492,7 +2492,7 @@ sock_shutdown(PySocketSockObject *s, PyObject *arg)
int how; int how;
int res; int res;
how = PyInt_AsLong(arg); how = PyLong_AsLong(arg);
if (how == -1 && PyErr_Occurred()) if (how == -1 && PyErr_Occurred())
return NULL; return NULL;
Py_BEGIN_ALLOW_THREADS Py_BEGIN_ALLOW_THREADS
@ -3071,7 +3071,7 @@ socket_getservbyname(PyObject *self, PyObject *args)
PyErr_SetString(socket_error, "service/proto not found"); PyErr_SetString(socket_error, "service/proto not found");
return NULL; return NULL;
} }
return PyInt_FromLong((long) ntohs(sp->s_port)); return PyLong_FromLong((long) ntohs(sp->s_port));
} }
PyDoc_STRVAR(getservbyname_doc, PyDoc_STRVAR(getservbyname_doc,
@ -3131,7 +3131,7 @@ socket_getprotobyname(PyObject *self, PyObject *args)
PyErr_SetString(socket_error, "protocol not found"); PyErr_SetString(socket_error, "protocol not found");
return NULL; return NULL;
} }
return PyInt_FromLong((long) sp->p_proto); return PyLong_FromLong((long) sp->p_proto);
} }
PyDoc_STRVAR(getprotobyname_doc, PyDoc_STRVAR(getprotobyname_doc,
@ -3242,7 +3242,7 @@ socket_ntohs(PyObject *self, PyObject *args)
return NULL; return NULL;
} }
x2 = (unsigned int)ntohs((unsigned short)x1); x2 = (unsigned int)ntohs((unsigned short)x1);
return PyInt_FromLong(x2); return PyLong_FromLong(x2);
} }
PyDoc_STRVAR(ntohs_doc, PyDoc_STRVAR(ntohs_doc,
@ -3301,7 +3301,7 @@ socket_htons(PyObject *self, PyObject *args)
return NULL; return NULL;
} }
x2 = (unsigned int)htons((unsigned short)x1); x2 = (unsigned int)htons((unsigned short)x1);
return PyInt_FromLong(x2); return PyLong_FromLong(x2);
} }
PyDoc_STRVAR(htons_doc, PyDoc_STRVAR(htons_doc,
@ -3596,7 +3596,7 @@ socket_getaddrinfo(PyObject *self, PyObject *args)
return NULL; return NULL;
} }
if (PyInt_CheckExact(pobj)) { if (PyInt_CheckExact(pobj)) {
PyOS_snprintf(pbuf, sizeof(pbuf), "%ld", PyInt_AsLong(pobj)); PyOS_snprintf(pbuf, sizeof(pbuf), "%ld", PyLong_AsLong(pobj));
pptr = pbuf; pptr = pbuf;
} else if (PyUnicode_Check(pobj)) { } else if (PyUnicode_Check(pobj)) {
pptr = PyUnicode_AsString(pobj); pptr = PyUnicode_AsString(pobj);

View File

@ -74,7 +74,7 @@ static PyObject *mkspent(struct spwd *p)
if (v == NULL) if (v == NULL)
return 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) #define SETS(i,val) sets(v, i, val)
SETS(setIndex++, p->sp_namp); SETS(setIndex++, p->sp_namp);

View File

@ -123,7 +123,7 @@ syslog_setlogmask(PyObject *self, PyObject *args)
if (!PyArg_ParseTuple(args, "l;mask for priority", &maskpri)) if (!PyArg_ParseTuple(args, "l;mask for priority", &maskpri))
return NULL; return NULL;
omaskpri = setlogmask(maskpri); omaskpri = setlogmask(maskpri);
return PyInt_FromLong(omaskpri); return PyLong_FromLong(omaskpri);
} }
static PyObject * static PyObject *
@ -134,7 +134,7 @@ syslog_log_mask(PyObject *self, PyObject *args)
if (!PyArg_ParseTuple(args, "l:LOG_MASK", &pri)) if (!PyArg_ParseTuple(args, "l:LOG_MASK", &pri))
return NULL; return NULL;
mask = LOG_MASK(pri); mask = LOG_MASK(pri);
return PyInt_FromLong(mask); return PyLong_FromLong(mask);
} }
static PyObject * static PyObject *
@ -145,7 +145,7 @@ syslog_log_upto(PyObject *self, PyObject *args)
if (!PyArg_ParseTuple(args, "l:LOG_UPTO", &pri)) if (!PyArg_ParseTuple(args, "l:LOG_UPTO", &pri))
return NULL; return NULL;
mask = LOG_UPTO(pri); mask = LOG_UPTO(pri);
return PyInt_FromLong(mask); return PyLong_FromLong(mask);
} }
/* List of functions defined in the module */ /* List of functions defined in the module */

View File

@ -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 MIN and TIME slots are the same as the EOF and EOL slots. So we
only do this in noncanonical input mode. */ only do this in noncanonical input mode. */
if ((mode.c_lflag & ICANON) == 0) { 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) if (v == NULL)
goto err; goto err;
PyList_SetItem(cc, VMIN, v); PyList_SetItem(cc, VMIN, v);
v = PyInt_FromLong((long)mode.c_cc[VTIME]); v = PyLong_FromLong((long)mode.c_cc[VTIME]);
if (v == NULL) if (v == NULL)
goto err; goto err;
PyList_SetItem(cc, VTIME, v); PyList_SetItem(cc, VTIME, v);
@ -114,12 +114,12 @@ termios_tcgetattr(PyObject *self, PyObject *args)
if (!(v = PyList_New(7))) if (!(v = PyList_New(7)))
goto err; goto err;
PyList_SetItem(v, 0, PyInt_FromLong((long)mode.c_iflag)); PyList_SetItem(v, 0, PyLong_FromLong((long)mode.c_iflag));
PyList_SetItem(v, 1, PyInt_FromLong((long)mode.c_oflag)); PyList_SetItem(v, 1, PyLong_FromLong((long)mode.c_oflag));
PyList_SetItem(v, 2, PyInt_FromLong((long)mode.c_cflag)); PyList_SetItem(v, 2, PyLong_FromLong((long)mode.c_cflag));
PyList_SetItem(v, 3, PyInt_FromLong((long)mode.c_lflag)); PyList_SetItem(v, 3, PyLong_FromLong((long)mode.c_lflag));
PyList_SetItem(v, 4, PyInt_FromLong((long)ispeed)); PyList_SetItem(v, 4, PyLong_FromLong((long)ispeed));
PyList_SetItem(v, 5, PyInt_FromLong((long)ospeed)); PyList_SetItem(v, 5, PyLong_FromLong((long)ospeed));
PyList_SetItem(v, 6, cc); PyList_SetItem(v, 6, cc);
if (PyErr_Occurred()){ if (PyErr_Occurred()){
Py_DECREF(v); Py_DECREF(v);
@ -163,12 +163,12 @@ termios_tcsetattr(PyObject *self, PyObject *args)
/* Get the old mode, in case there are any hidden fields... */ /* Get the old mode, in case there are any hidden fields... */
if (tcgetattr(fd, &mode) == -1) if (tcgetattr(fd, &mode) == -1)
return PyErr_SetFromErrno(TermiosError); return PyErr_SetFromErrno(TermiosError);
mode.c_iflag = (tcflag_t) PyInt_AsLong(PyList_GetItem(term, 0)); mode.c_iflag = (tcflag_t) PyLong_AsLong(PyList_GetItem(term, 0));
mode.c_oflag = (tcflag_t) PyInt_AsLong(PyList_GetItem(term, 1)); mode.c_oflag = (tcflag_t) PyLong_AsLong(PyList_GetItem(term, 1));
mode.c_cflag = (tcflag_t) PyInt_AsLong(PyList_GetItem(term, 2)); mode.c_cflag = (tcflag_t) PyLong_AsLong(PyList_GetItem(term, 2));
mode.c_lflag = (tcflag_t) PyInt_AsLong(PyList_GetItem(term, 3)); mode.c_lflag = (tcflag_t) PyLong_AsLong(PyList_GetItem(term, 3));
ispeed = (speed_t) PyInt_AsLong(PyList_GetItem(term, 4)); ispeed = (speed_t) PyLong_AsLong(PyList_GetItem(term, 4));
ospeed = (speed_t) PyInt_AsLong(PyList_GetItem(term, 5)); ospeed = (speed_t) PyLong_AsLong(PyList_GetItem(term, 5));
cc = PyList_GetItem(term, 6); cc = PyList_GetItem(term, 6);
if (PyErr_Occurred()) if (PyErr_Occurred())
return NULL; return NULL;
@ -185,8 +185,8 @@ termios_tcsetattr(PyObject *self, PyObject *args)
if (PyString_Check(v) && PyString_Size(v) == 1) if (PyString_Check(v) && PyString_Size(v) == 1)
mode.c_cc[i] = (cc_t) * PyString_AsString(v); mode.c_cc[i] = (cc_t) * PyString_AsString(v);
else if (PyInt_Check(v)) else if (PyLong_Check(v))
mode.c_cc[i] = (cc_t) PyInt_AsLong(v); mode.c_cc[i] = (cc_t) PyLong_AsLong(v);
else { else {
PyErr_SetString(PyExc_TypeError, PyErr_SetString(PyExc_TypeError,
"tcsetattr: elements of attributes must be characters or integers"); "tcsetattr: elements of attributes must be characters or integers");

View File

@ -493,7 +493,7 @@ thread_PyThread_start_new_thread(PyObject *self, PyObject *fargs)
PyMem_DEL(boot); PyMem_DEL(boot);
return NULL; return NULL;
} }
return PyInt_FromLong(ident); return PyLong_FromLong(ident);
} }
PyDoc_STRVAR(start_new_doc, PyDoc_STRVAR(start_new_doc,
@ -571,7 +571,7 @@ thread_get_ident(PyObject *self)
PyErr_SetString(ThreadError, "no current thread ident"); PyErr_SetString(ThreadError, "no current thread ident");
return NULL; return NULL;
} }
return PyInt_FromLong(ident); return PyLong_FromLong(ident);
} }
PyDoc_STRVAR(get_ident_doc, PyDoc_STRVAR(get_ident_doc,
@ -616,7 +616,7 @@ thread_stack_size(PyObject *self, PyObject *args)
return NULL; 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, PyDoc_STRVAR(stack_size_doc,

View File

@ -237,7 +237,7 @@ tmtotuple(struct tm *p)
if (v == NULL) if (v == NULL)
return 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(0, p->tm_year + 1900);
SET(1, p->tm_mon + 1); /* Want January == 1 */ SET(1, p->tm_mon + 1); /* Want January == 1 */
@ -393,7 +393,7 @@ gettmarg(PyObject *args, struct tm *p)
PyObject *accept = PyDict_GetItemString(moddict, PyObject *accept = PyDict_GetItemString(moddict,
"accept2dyear"); "accept2dyear");
if (accept == NULL || !PyInt_CheckExact(accept) || if (accept == NULL || !PyInt_CheckExact(accept) ||
PyInt_AsLong(accept) == 0) { PyLong_AsLong(accept) == 0) {
PyErr_SetString(PyExc_ValueError, PyErr_SetString(PyExc_ValueError,
"year >= 1900 required"); "year >= 1900 required");
return 0; return 0;

View File

@ -143,7 +143,7 @@ unicodedata_decimal(PyObject *self, PyObject *args)
return defobj; return defobj;
} }
} }
return PyInt_FromLong(rc); return PyLong_FromLong(rc);
} }
PyDoc_STRVAR(unicodedata_digit__doc__, PyDoc_STRVAR(unicodedata_digit__doc__,
@ -178,7 +178,7 @@ unicodedata_digit(PyObject *self, PyObject *args)
return defobj; return defobj;
} }
} }
return PyInt_FromLong(rc); return PyLong_FromLong(rc);
} }
PyDoc_STRVAR(unicodedata_numeric__doc__, PyDoc_STRVAR(unicodedata_numeric__doc__,
@ -320,7 +320,7 @@ unicodedata_combining(PyObject *self, PyObject *args)
if (old->category_changed == 0) if (old->category_changed == 0)
index = 0; /* unassigned */ index = 0; /* unassigned */
} }
return PyInt_FromLong(index); return PyLong_FromLong(index);
} }
PyDoc_STRVAR(unicodedata_mirrored__doc__, PyDoc_STRVAR(unicodedata_mirrored__doc__,
@ -350,7 +350,7 @@ unicodedata_mirrored(PyObject *self, PyObject *args)
if (old->category_changed == 0) if (old->category_changed == 0)
index = 0; /* unassigned */ index = 0; /* unassigned */
} }
return PyInt_FromLong(index); return PyLong_FromLong(index);
} }
PyDoc_STRVAR(unicodedata_east_asian_width__doc__, PyDoc_STRVAR(unicodedata_east_asian_width__doc__,

View File

@ -156,7 +156,7 @@ xx_foo(PyObject *self, PyObject *args)
if (!PyArg_ParseTuple(args, "ll:foo", &i, &j)) if (!PyArg_ParseTuple(args, "ll:foo", &i, &j))
return NULL; return NULL;
res = i+j; /* XXX Do something here */ 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); item = PyList_GetItem(list, 0);
/* Py_INCREF(item); */ /* Py_INCREF(item); */
PyList_SetItem(list, 1, PyInt_FromLong(0L)); PyList_SetItem(list, 1, PyLong_FromLong(0L));
PyObject_Print(item, stdout, 0); PyObject_Print(item, stdout, 0);
printf("\n"); printf("\n");
/* Py_DECREF(item); */ /* Py_DECREF(item); */

View File

@ -28,7 +28,7 @@ spamlist_getstate(spamlistobject *self, PyObject *args)
{ {
if (!PyArg_ParseTuple(args, ":getstate")) if (!PyArg_ParseTuple(args, ":getstate"))
return NULL; return NULL;
return PyInt_FromLong(self->state); return PyLong_FromLong(self->state);
} }
static PyObject * static PyObject *
@ -91,7 +91,7 @@ spamlist_init(spamlistobject *self, PyObject *args, PyObject *kwds)
static PyObject * static PyObject *
spamlist_state_get(spamlistobject *self) spamlist_state_get(spamlistobject *self)
{ {
return PyInt_FromLong(self->state); return PyLong_FromLong(self->state);
} }
static PyGetSetDef spamlist_getsets[] = { static PyGetSetDef spamlist_getsets[] = {
@ -153,7 +153,7 @@ spamdict_getstate(spamdictobject *self, PyObject *args)
{ {
if (!PyArg_ParseTuple(args, ":getstate")) if (!PyArg_ParseTuple(args, ":getstate"))
return NULL; return NULL;
return PyInt_FromLong(self->state); return PyLong_FromLong(self->state);
} }
static PyObject * static PyObject *

View File

@ -1028,8 +1028,8 @@ get_mtime_of_source(ZipImporter *self, char *path)
/* fetch the time stamp of the .py file for comparison /* fetch the time stamp of the .py file for comparison
with an embedded pyc time stamp */ with an embedded pyc time stamp */
int time, date; int time, date;
time = PyInt_AsLong(PyTuple_GetItem(toc_entry, 5)); time = PyLong_AsLong(PyTuple_GetItem(toc_entry, 5));
date = PyInt_AsLong(PyTuple_GetItem(toc_entry, 6)); date = PyLong_AsLong(PyTuple_GetItem(toc_entry, 6));
mtime = parse_dostime(time, date); mtime = parse_dostime(time, date);
} }
path[lastchar] = savechar; path[lastchar] = savechar;

View File

@ -922,7 +922,7 @@ PyZlib_adler32(PyObject *self, PyObject *args)
if (!PyArg_ParseTuple(args, "s#|k:adler32", &buf, &len, &adler32val)) if (!PyArg_ParseTuple(args, "s#|k:adler32", &buf, &len, &adler32val))
return NULL; return NULL;
adler32val = adler32(adler32val, buf, len); adler32val = adler32(adler32val, buf, len);
return PyInt_FromLong(adler32val); return PyLong_FromLong(adler32val);
} }
PyDoc_STRVAR(crc32__doc__, PyDoc_STRVAR(crc32__doc__,
@ -940,7 +940,7 @@ PyZlib_crc32(PyObject *self, PyObject *args)
if (!PyArg_ParseTuple(args, "s#|k:crc32", &buf, &len, &crc32val)) if (!PyArg_ParseTuple(args, "s#|k:crc32", &buf, &len, &crc32val))
return NULL; return NULL;
crc32val = crc32(crc32val, buf, len); crc32val = crc32(crc32val, buf, len);
return PyInt_FromLong(crc32val); return PyLong_FromLong(crc32val);
} }

View File

@ -93,7 +93,7 @@ _PyObject_LengthHint(PyObject *o)
PyErr_Fetch(&err_type, &err_value, &err_tb); PyErr_Fetch(&err_type, &err_value, &err_tb);
ro = PyObject_CallMethod(o, "__length_hint__", NULL); ro = PyObject_CallMethod(o, "__length_hint__", NULL);
if (ro != NULL) { if (ro != NULL) {
rv = PyInt_AsLong(ro); rv = PyLong_AsLong(ro);
Py_DECREF(ro); Py_DECREF(ro);
Py_XDECREF(err_type); Py_XDECREF(err_type);
Py_XDECREF(err_value); Py_XDECREF(err_value);
@ -1188,8 +1188,8 @@ PyNumber_AsSsize_t(PyObject *item, PyObject *err)
if (value == NULL) if (value == NULL)
return -1; return -1;
/* We're done if PyInt_AsSsize_t() returns without error. */ /* We're done if PyLong_AsSsize_t() returns without error. */
result = PyInt_AsSsize_t(value); result = PyLong_AsSsize_t(value);
if (result != -1 || !(runerr = PyErr_Occurred())) if (result != -1 || !(runerr = PyErr_Occurred()))
goto finish; goto finish;
@ -1413,7 +1413,7 @@ PySequence_Repeat(PyObject *o, Py_ssize_t count)
to nb_multiply if o appears to be a sequence. */ to nb_multiply if o appears to be a sequence. */
if (PySequence_Check(o)) { if (PySequence_Check(o)) {
PyObject *n, *result; PyObject *n, *result;
n = PyInt_FromSsize_t(count); n = PyLong_FromSsize_t(count);
if (n == NULL) if (n == NULL)
return NULL; return NULL;
result = binary_op1(o, n, NB_SLOT(nb_multiply)); 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)) { if (PySequence_Check(o)) {
PyObject *n, *result; PyObject *n, *result;
n = PyInt_FromSsize_t(count); n = PyLong_FromSsize_t(count);
if (n == NULL) if (n == NULL)
return NULL; return NULL;
result = binary_iop1(o, n, NB_SLOT(nb_inplace_multiply), result = binary_iop1(o, n, NB_SLOT(nb_inplace_multiply),

View File

@ -34,8 +34,8 @@ _getbytevalue(PyObject* arg, int *value)
{ {
long face_value; long face_value;
if (PyInt_Check(arg)) { if (PyLong_Check(arg)) {
face_value = PyInt_AsLong(arg); face_value = PyLong_AsLong(arg);
if (face_value < 0 || face_value >= 256) { if (face_value < 0 || face_value >= 256) {
PyErr_SetString(PyExc_ValueError, "byte must be in range(0, 256)"); PyErr_SetString(PyExc_ValueError, "byte must be in range(0, 256)");
return 0; return 0;
@ -350,7 +350,7 @@ bytes_getitem(PyBytesObject *self, Py_ssize_t i)
PyErr_SetString(PyExc_IndexError, "bytearray index out of range"); PyErr_SetString(PyExc_IndexError, "bytearray index out of range");
return NULL; return NULL;
} }
return PyInt_FromLong((unsigned char)(self->ob_bytes[i])); return PyLong_FromLong((unsigned char)(self->ob_bytes[i]));
} }
static PyObject * static PyObject *
@ -369,7 +369,7 @@ bytes_subscript(PyBytesObject *self, PyObject *item)
PyErr_SetString(PyExc_IndexError, "bytearray index out of range"); PyErr_SetString(PyExc_IndexError, "bytearray index out of range");
return NULL; 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)) { else if (PySlice_Check(item)) {
Py_ssize_t start, stop, step, slicelength, cur, i; 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); Py_ssize_t result = bytes_find_internal(self, args, +1);
if (result == -2) if (result == -2)
return NULL; return NULL;
return PyInt_FromSsize_t(result); return PyLong_FromSsize_t(result);
} }
PyDoc_STRVAR(count__doc__, PyDoc_STRVAR(count__doc__,
@ -1119,7 +1119,7 @@ bytes_count(PyBytesObject *self, PyObject *args)
_adjust_indices(&start, &end, PyBytes_GET_SIZE(self)); _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) stringlib_count(str + start, end - start, vsub.buf, vsub.len)
); );
PyObject_ReleaseBuffer(sub_obj, &vsub); PyObject_ReleaseBuffer(sub_obj, &vsub);
@ -1143,7 +1143,7 @@ bytes_index(PyBytesObject *self, PyObject *args)
"subsection not found"); "subsection not found");
return NULL; 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); Py_ssize_t result = bytes_find_internal(self, args, -1);
if (result == -2) if (result == -2)
return NULL; 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"); "subsection not found");
return NULL; 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) if (PyBytes_Resize((PyObject *)self, n - 1) < 0)
return NULL; return NULL;
return PyInt_FromLong(value); return PyLong_FromLong(value);
} }
PyDoc_STRVAR(remove__doc__, PyDoc_STRVAR(remove__doc__,
@ -2809,7 +2809,7 @@ Returns the number of bytes actually allocated.");
static PyObject * static PyObject *
bytes_alloc(PyBytesObject *self) bytes_alloc(PyBytesObject *self)
{ {
return PyInt_FromSsize_t(self->ob_alloc); return PyLong_FromSsize_t(self->ob_alloc);
} }
PyDoc_STRVAR(join_doc, PyDoc_STRVAR(join_doc,
@ -3161,7 +3161,7 @@ bytesiter_next(bytesiterobject *it)
assert(PyBytes_Check(seq)); assert(PyBytes_Check(seq));
if (it->it_index < PyBytes_GET_SIZE(seq)) { if (it->it_index < PyBytes_GET_SIZE(seq)) {
item = PyInt_FromLong( item = PyLong_FromLong(
(unsigned char)seq->ob_bytes[it->it_index]); (unsigned char)seq->ob_bytes[it->it_index]);
if (item != NULL) if (item != NULL)
++it->it_index; ++it->it_index;
@ -3179,7 +3179,7 @@ bytesiter_length_hint(bytesiterobject *it)
Py_ssize_t len = 0; Py_ssize_t len = 0;
if (it->it_seq) if (it->it_seq)
len = PyBytes_GET_SIZE(it->it_seq) - it->it_index; 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, PyDoc_STRVAR(length_hint_doc,

View File

@ -2094,7 +2094,7 @@ dictiter_len(dictiterobject *di)
Py_ssize_t len = 0; Py_ssize_t len = 0;
if (di->di_dict != NULL && di->di_used == di->di_dict->ma_used) if (di->di_dict != NULL && di->di_used == di->di_dict->ma_used)
len = di->len; len = di->len;
return PyInt_FromSize_t(len); return PyLong_FromSize_t(len);
} }
PyDoc_STRVAR(length_hint_doc, PyDoc_STRVAR(length_hint_doc,

View File

@ -67,12 +67,12 @@ enum_next_long(enumobject *en, PyObject* next_item)
PyObject *stepped_up; PyObject *stepped_up;
if (en->en_longindex == NULL) { if (en->en_longindex == NULL) {
en->en_longindex = PyInt_FromLong(LONG_MAX); en->en_longindex = PyLong_FromLong(LONG_MAX);
if (en->en_longindex == NULL) if (en->en_longindex == NULL)
return NULL; return NULL;
} }
if (one == NULL) { if (one == NULL) {
one = PyInt_FromLong(1); one = PyLong_FromLong(1);
if (one == NULL) if (one == NULL)
return NULL; return NULL;
} }
@ -115,7 +115,7 @@ enum_next(enumobject *en)
if (en->en_index == LONG_MAX) if (en->en_index == LONG_MAX)
return enum_next_long(en, next_item); 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) { if (next_index == NULL) {
Py_DECREF(next_item); Py_DECREF(next_item);
return NULL; return NULL;
@ -279,12 +279,12 @@ reversed_len(reversedobject *ro)
Py_ssize_t position, seqsize; Py_ssize_t position, seqsize;
if (ro->seq == NULL) if (ro->seq == NULL)
return PyInt_FromLong(0); return PyLong_FromLong(0);
seqsize = PySequence_Size(ro->seq); seqsize = PySequence_Size(ro->seq);
if (seqsize == -1) if (seqsize == -1)
return NULL; return NULL;
position = ro->index + 1; 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))."); PyDoc_STRVAR(length_hint_doc, "Private method returning an estimate of len(list(it)).");

View File

@ -720,7 +720,7 @@ WindowsError_init(PyWindowsErrorObject *self, PyObject *args, PyObject *kwds)
/* Set errno to the POSIX errno, and winerror to the Win32 /* Set errno to the POSIX errno, and winerror to the Win32
error code. */ error code. */
errcode = PyInt_AsLong(self->myerrno); errcode = PyLong_AsLong(self->myerrno);
if (errcode == -1 && PyErr_Occurred()) if (errcode == -1 && PyErr_Occurred())
return -1; return -1;
posix_errno = winerror_to_errno(errcode); posix_errno = winerror_to_errno(errcode);
@ -728,7 +728,7 @@ WindowsError_init(PyWindowsErrorObject *self, PyObject *args, PyObject *kwds)
Py_CLEAR(self->winerror); Py_CLEAR(self->winerror);
self->winerror = self->myerrno; self->winerror = self->myerrno;
o_errcode = PyInt_FromLong(posix_errno); o_errcode = PyLong_FromLong(posix_errno);
if (!o_errcode) if (!o_errcode)
return -1; return -1;
@ -945,7 +945,7 @@ SyntaxError_str(PySyntaxErrorObject *self)
return PyUnicode_FromFormat("%S (%s, line %ld)", return PyUnicode_FromFormat("%S (%s, line %ld)",
self->msg ? self->msg : Py_None, self->msg ? self->msg : Py_None,
my_basename(filename), my_basename(filename),
PyInt_AsLong(self->lineno)); PyLong_AsLong(self->lineno));
else if (filename) else if (filename)
return PyUnicode_FromFormat("%S (%s)", return PyUnicode_FromFormat("%S (%s)",
self->msg ? self->msg : Py_None, self->msg ? self->msg : Py_None,
@ -953,7 +953,7 @@ SyntaxError_str(PySyntaxErrorObject *self)
else /* only have_lineno */ else /* only have_lineno */
return PyUnicode_FromFormat("%S (line %ld)", return PyUnicode_FromFormat("%S (line %ld)",
self->msg ? self->msg : Py_None, self->msg ? self->msg : Py_None,
PyInt_AsLong(self->lineno)); PyLong_AsLong(self->lineno));
} }
static PyMemberDef SyntaxError_members[] = { static PyMemberDef SyntaxError_members[] = {

View File

@ -413,7 +413,7 @@ stdprinter_write(PyStdPrinter_Object *self, PyObject *args)
static PyObject * static PyObject *
stdprinter_fileno(PyStdPrinter_Object *self) stdprinter_fileno(PyStdPrinter_Object *self)
{ {
return PyInt_FromLong((long) self->fd); return PyLong_FromLong((long) self->fd);
} }
static PyObject * static PyObject *

View File

@ -72,7 +72,7 @@ PyFloat_GetInfo(void)
if (PyDict_SetItemString(d, key, tmp)) return NULL; \ if (PyDict_SetItemString(d, key, tmp)) return NULL; \
Py_DECREF(tmp) Py_DECREF(tmp)
#define SET_INT_CONST(d, key, const) \ #define SET_INT_CONST(d, key, const) \
tmp = PyInt_FromLong(const); \ tmp = PyLong_FromLong(const); \
if (tmp == NULL) return NULL; \ if (tmp == NULL) return NULL; \
if (PyDict_SetItemString(d, key, tmp)) return NULL; \ if (PyDict_SetItemString(d, key, tmp)) return NULL; \
Py_DECREF(tmp) Py_DECREF(tmp)
@ -481,7 +481,7 @@ float_richcompare(PyObject *v, PyObject *w, int op)
*/ */
PyObject *temp; PyObject *temp;
one = PyInt_FromLong(1); one = PyLong_FromLong(1);
if (one == NULL) if (one == NULL)
goto Error; goto Error;
@ -808,7 +808,7 @@ float_trunc(PyObject *v)
*/ */
if (LONG_MIN < wholepart && wholepart < LONG_MAX) { if (LONG_MIN < wholepart && wholepart < LONG_MAX) {
const long aslong = (long)wholepart; const long aslong = (long)wholepart;
return PyInt_FromLong(aslong); return PyLong_FromLong(aslong);
} }
return PyLong_FromDouble(wholepart); return PyLong_FromDouble(wholepart);
} }

View File

@ -44,7 +44,7 @@ frame_getlineno(PyFrameObject *f, void *closure)
else else
lineno = PyCode_Addr2Line(f->f_code, f->f_lasti); 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 /* 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. */ /* 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) { if (new_lineno < f->f_code->co_firstlineno) {
PyErr_Format(PyExc_ValueError, PyErr_Format(PyExc_ValueError,
"line %d comes before the current code block", "line %d comes before the current code block",

View File

@ -81,9 +81,9 @@ iter_len(seqiterobject *it)
return NULL; return NULL;
len = seqsize - it->it_index; len = seqsize - it->it_index;
if (len >= 0) 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))."); PyDoc_STRVAR(length_hint_doc, "Private method returning an estimate of len(list(it)).");

View File

@ -931,7 +931,7 @@ islt(PyObject *x, PyObject *y, PyObject *compare)
Py_DECREF(res); Py_DECREF(res);
return -1; return -1;
} }
i = PyInt_AsLong(res); i = PyLong_AsLong(res);
Py_DECREF(res); Py_DECREF(res);
return i < 0; return i < 0;
} }
@ -2226,7 +2226,7 @@ listindex(PyListObject *self, PyObject *args)
for (i = start; i < stop && i < Py_Size(self); i++) { for (i = start; i < stop && i < Py_Size(self); i++) {
int cmp = PyObject_RichCompareBool(self->ob_item[i], v, Py_EQ); int cmp = PyObject_RichCompareBool(self->ob_item[i], v, Py_EQ);
if (cmp > 0) if (cmp > 0)
return PyInt_FromSsize_t(i); return PyLong_FromSsize_t(i);
else if (cmp < 0) else if (cmp < 0)
return NULL; return NULL;
} }
@ -2247,7 +2247,7 @@ listcount(PyListObject *self, PyObject *v)
else if (cmp < 0) else if (cmp < 0)
return NULL; return NULL;
} }
return PyInt_FromSsize_t(count); return PyLong_FromSsize_t(count);
} }
static PyObject * static PyObject *
@ -2823,9 +2823,9 @@ listiter_len(listiterobject *it)
if (it->it_seq) { if (it->it_seq) {
len = PyList_GET_SIZE(it->it_seq) - it->it_index; len = PyList_GET_SIZE(it->it_seq) - it->it_index;
if (len >= 0) if (len >= 0)
return PyInt_FromSsize_t(len); return PyLong_FromSsize_t(len);
} }
return PyInt_FromLong(0); return PyLong_FromLong(0);
} }
/*********************** List Reverse Iterator **************************/ /*********************** List Reverse Iterator **************************/

View File

@ -59,7 +59,7 @@ get_small_int(int ival)
be a small integer, so negating it must go to PyLong_FromLong */ be a small integer, so negating it must go to PyLong_FromLong */
#define NEGATE(x) \ #define NEGATE(x) \
do if (Py_Refcnt(x) == 1) Py_Size(x) = -Py_Size(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; } \ Py_DECREF(x); (x) = (PyLongObject*)tmp; } \
while(0) while(0)
/* For long multiplication, use the O(N**2) school algorithm unless /* For long multiplication, use the O(N**2) school algorithm unless
@ -976,7 +976,7 @@ PyLong_FromVoidPtr(void *p)
#endif #endif
/* special-case null pointer */ /* special-case null pointer */
if (!p) if (!p)
return PyInt_FromLong(0); return PyLong_FromLong(0);
return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG)(Py_uintptr_t)p); 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); CHECK_BINOP(a, b);
if (ABS(Py_Size(a)) <= 1 && ABS(Py_Size(b)) <= 1) { 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)); MEDIUM_VALUE(b));
return result; return result;
} }

View File

@ -303,7 +303,7 @@ memory_format_get(PyMemoryViewObject *self)
static PyObject * static PyObject *
memory_itemsize_get(PyMemoryViewObject *self) memory_itemsize_get(PyMemoryViewObject *self)
{ {
return PyInt_FromSsize_t(self->view.itemsize); return PyLong_FromSsize_t(self->view.itemsize);
} }
static PyObject * static PyObject *
@ -320,7 +320,7 @@ _IntTupleFromSsizet(int len, Py_ssize_t *vals)
intTuple = PyTuple_New(len); intTuple = PyTuple_New(len);
if (!intTuple) return NULL; if (!intTuple) return NULL;
for(i=0; i<len; i++) { for(i=0; i<len; i++) {
o = PyInt_FromSsize_t(vals[i]); o = PyLong_FromSsize_t(vals[i]);
if (!o) { if (!o) {
Py_DECREF(intTuple); Py_DECREF(intTuple);
return NULL; return NULL;
@ -351,7 +351,7 @@ memory_suboffsets_get(PyMemoryViewObject *self)
static PyObject * static PyObject *
memory_size_get(PyMemoryViewObject *self) memory_size_get(PyMemoryViewObject *self)
{ {
return PyInt_FromSsize_t(self->view.len); return PyLong_FromSsize_t(self->view.len);
} }
static PyObject * static PyObject *
@ -363,7 +363,7 @@ memory_readonly_get(PyMemoryViewObject *self)
static PyObject * static PyObject *
memory_ndim_get(PyMemoryViewObject *self) memory_ndim_get(PyMemoryViewObject *self)
{ {
return PyInt_FromLong(self->view.ndim); return PyLong_FromLong(self->view.ndim);
} }
static PyGetSetDef memory_getsetlist[] ={ static PyGetSetDef memory_getsetlist[] ={

View File

@ -24,7 +24,7 @@ validate_step(PyObject *step)
{ {
/* No step specified, use a step of 1. */ /* No step specified, use a step of 1. */
if (!step) if (!step)
return PyInt_FromLong(1); return PyLong_FromLong(1);
step = PyNumber_Index(step); step = PyNumber_Index(step);
if (step) { if (step) {
@ -63,8 +63,8 @@ range_new(PyTypeObject *type, PyObject *args, PyObject *kw)
stop = PyNumber_Index(stop); stop = PyNumber_Index(stop);
if (!stop) if (!stop)
goto Fail; goto Fail;
start = PyInt_FromLong(0); start = PyLong_FromLong(0);
step = PyInt_FromLong(1); step = PyLong_FromLong(1);
if (!start || !step) if (!start || !step)
goto Fail; goto Fail;
} }
@ -113,7 +113,7 @@ range_dealloc(rangeobject *r)
/* Return number of items in range (lo, hi, step), when arguments are /* Return number of items in range (lo, hi, step), when arguments are
* PyInt or PyLong objects. step > 0 required. Return a value < 0 if * 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. * & 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. * PyLong_Check(). Return -1 when there is an error.
*/ */
static PyObject* static PyObject*
@ -332,14 +332,14 @@ static PyObject *
rangeiter_next(rangeiterobject *r) rangeiter_next(rangeiterobject *r)
{ {
if (r->index < r->len) 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; return NULL;
} }
static PyObject * static PyObject *
rangeiter_len(rangeiterobject *r) rangeiter_len(rangeiterobject *r)
{ {
return PyInt_FromLong(r->len - r->index); return PyLong_FromLong(r->len - r->index);
} }
typedef struct { typedef struct {

View File

@ -801,7 +801,7 @@ setiter_len(setiterobject *si)
Py_ssize_t len = 0; Py_ssize_t len = 0;
if (si->si_set != NULL && si->si_used == si->si_set->used) if (si->si_set != NULL && si->si_used == si->si_set->used)
len = si->len; 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))."); PyDoc_STRVAR(length_hint_doc, "Private method returning an estimate of len(list(it)).");

View File

@ -83,10 +83,10 @@ PyObject *
_PySlice_FromIndices(Py_ssize_t istart, Py_ssize_t istop) _PySlice_FromIndices(Py_ssize_t istart, Py_ssize_t istop)
{ {
PyObject *start, *end, *slice; PyObject *start, *end, *slice;
start = PyInt_FromSsize_t(istart); start = PyLong_FromSsize_t(istart);
if (!start) if (!start)
return NULL; return NULL;
end = PyInt_FromSsize_t(istop); end = PyLong_FromSsize_t(istop);
if (!end) { if (!end) {
Py_DECREF(start); Py_DECREF(start);
return NULL; return NULL;
@ -107,20 +107,20 @@ PySlice_GetIndices(PySliceObject *r, Py_ssize_t length,
*step = 1; *step = 1;
} else { } else {
if (!PyLong_Check(r->step)) return -1; if (!PyLong_Check(r->step)) return -1;
*step = PyInt_AsSsize_t(r->step); *step = PyLong_AsSsize_t(r->step);
} }
if (r->start == Py_None) { if (r->start == Py_None) {
*start = *step < 0 ? length-1 : 0; *start = *step < 0 ? length-1 : 0;
} else { } else {
if (!PyInt_Check(r->start)) return -1; if (!PyLong_Check(r->start)) return -1;
*start = PyInt_AsSsize_t(r->start); *start = PyLong_AsSsize_t(r->start);
if (*start < 0) *start += length; if (*start < 0) *start += length;
} }
if (r->stop == Py_None) { if (r->stop == Py_None) {
*stop = *step < 0 ? -1 : length; *stop = *step < 0 ? -1 : length;
} else { } else {
if (!PyInt_Check(r->stop)) return -1; if (!PyLong_Check(r->stop)) return -1;
*stop = PyInt_AsSsize_t(r->stop); *stop = PyLong_AsSsize_t(r->stop);
if (*stop < 0) *stop += length; if (*stop < 0) *stop += length;
} }
if (*stop > length) return -1; if (*stop > length) return -1;

View File

@ -469,7 +469,7 @@ format_long_internal(PyObject *value, const InternalFormatSpec *format)
/* taken from unicodeobject.c formatchar() */ /* taken from unicodeobject.c formatchar() */
/* Integer input truncated to a character */ /* Integer input truncated to a character */
x = PyInt_AsLong(value); x = PyLong_AsLong(value);
if (x == -1 && PyErr_Occurred()) if (x == -1 && PyErr_Occurred())
goto done; goto done;
#ifdef Py_UNICODE_WIDE #ifdef Py_UNICODE_WIDE

View File

@ -204,7 +204,7 @@ static PyObject *
getitem_idx(PyObject *obj, Py_ssize_t idx) getitem_idx(PyObject *obj, Py_ssize_t idx)
{ {
PyObject *newobj; PyObject *newobj;
PyObject *idx_obj = PyInt_FromSsize_t(idx); PyObject *idx_obj = PyLong_FromSsize_t(idx);
if (idx_obj == NULL) if (idx_obj == NULL)
return NULL; return NULL;
newobj = PyObject_GetItem(obj, idx_obj); newobj = PyObject_GetItem(obj, idx_obj);
@ -1160,7 +1160,7 @@ fieldnameiter_next(fieldnameiterobject *it)
/* either an integer or a string */ /* either an integer or a string */
if (idx != -1) if (idx != -1)
obj = PyInt_FromSsize_t(idx); obj = PyLong_FromSsize_t(idx);
else else
obj = SubString_new_object(&name); obj = SubString_new_object(&name);
if (obj == NULL) if (obj == NULL)
@ -1245,7 +1245,7 @@ formatter_field_name_split(PyUnicodeObject *self)
/* first becomes an integer, if possible; else a string */ /* first becomes an integer, if possible; else a string */
if (first_idx != -1) if (first_idx != -1)
first_obj = PyInt_FromSsize_t(first_idx); first_obj = PyLong_FromSsize_t(first_idx);
else else
/* convert "first" into a string object */ /* convert "first" into a string object */
first_obj = SubString_new_object(&first); first_obj = SubString_new_object(&first);

View File

@ -803,7 +803,7 @@ string_item(PyStringObject *a, register Py_ssize_t i)
PyErr_SetString(PyExc_IndexError, "string index out of range"); PyErr_SetString(PyExc_IndexError, "string index out of range");
return NULL; return NULL;
} }
return PyInt_FromLong((unsigned char)a->ob_sval[i]); return PyLong_FromLong((unsigned char)a->ob_sval[i]);
} }
static PyObject* static PyObject*
@ -922,7 +922,7 @@ string_subscript(PyStringObject* self, PyObject* item)
"string index out of range"); "string index out of range");
return NULL; 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)) { else if (PySlice_Check(item)) {
Py_ssize_t start, stop, step, slicelength, cur, i; 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); Py_ssize_t result = string_find_internal(self, args, +1);
if (result == -2) if (result == -2)
return NULL; 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"); "substring not found");
return NULL; 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); Py_ssize_t result = string_find_internal(self, args, -1);
if (result == -2) if (result == -2)
return NULL; 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"); "substring not found");
return NULL; 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)); 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) stringlib_count(str + start, end - start, sub, sub_len)
); );
} }
@ -3332,7 +3332,7 @@ striter_next(striterobject *it)
assert(PyString_Check(seq)); assert(PyString_Check(seq));
if (it->it_index < PyString_GET_SIZE(seq)) { if (it->it_index < PyString_GET_SIZE(seq)) {
item = PyInt_FromLong( item = PyLong_FromLong(
(unsigned char)seq->ob_sval[it->it_index]); (unsigned char)seq->ob_sval[it->it_index]);
if (item != NULL) if (item != NULL)
++it->it_index; ++it->it_index;
@ -3350,7 +3350,7 @@ striter_len(striterobject *it)
Py_ssize_t len = 0; Py_ssize_t len = 0;
if (it->it_seq) if (it->it_seq)
len = PyString_GET_SIZE(it->it_seq) - it->it_index; 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, PyDoc_STRVAR(length_hint_doc,

View File

@ -14,14 +14,14 @@ static char unnamed_fields_key[] = "n_unnamed_fields";
char *PyStructSequence_UnnamedField = "unnamed field"; char *PyStructSequence_UnnamedField = "unnamed field";
#define VISIBLE_SIZE(op) Py_Size(op) #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)) 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)) PyDict_GetItemString((tp)->tp_dict, real_length_key))
#define REAL_SIZE(op) REAL_SIZE_TP(Py_Type(op)) #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)) PyDict_GetItemString((tp)->tp_dict, unnamed_fields_key))
#define UNNAMED_FIELDS(op) UNNAMED_FIELDS_TP(Py_Type(op)) #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; dict = type->tp_dict;
PyDict_SetItemString(dict, visible_length_key, 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, PyDict_SetItemString(dict, real_length_key,
PyInt_FromLong((long) n_members)); PyLong_FromLong((long) n_members));
PyDict_SetItemString(dict, unnamed_fields_key, PyDict_SetItemString(dict, unnamed_fields_key,
PyInt_FromLong((long) n_unnamed_members)); PyLong_FromLong((long) n_unnamed_members));
} }

View File

@ -828,7 +828,7 @@ tupleiter_len(tupleiterobject *it)
Py_ssize_t len = 0; Py_ssize_t len = 0;
if (it->it_seq) if (it->it_seq)
len = PyTuple_GET_SIZE(it->it_seq) - it->it_index; 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))."); PyDoc_STRVAR(length_hint_doc, "Private method returning an estimate of len(list(it)).");

Some files were not shown because too many files have changed in this diff Show More