mirror of https://github.com/python/cpython
Cleanup: Replaced most PyInt_ aliases with PyLong_ and disabled the aliases in intobject.h
This commit is contained in:
parent
1a3284ed69
commit
217cfd1c86
|
@ -48,7 +48,7 @@ main(int argc, char **argv)
|
|||
static PyObject *
|
||||
xyzzy_foo(PyObject *self, PyObject* args)
|
||||
{
|
||||
return PyInt_FromLong(42L);
|
||||
return PyLong_FromLong(42L);
|
||||
}
|
||||
|
||||
static PyMethodDef xyzzy_methods[] = {
|
||||
|
|
|
@ -26,7 +26,7 @@ main(int argc, char *argv[])
|
|||
if (pFunc && PyCallable_Check(pFunc)) {
|
||||
pArgs = PyTuple_New(argc - 3);
|
||||
for (i = 0; i < argc - 3; ++i) {
|
||||
pValue = PyInt_FromLong(atoi(argv[i + 3]));
|
||||
pValue = PyLong_FromLong(atoi(argv[i + 3]));
|
||||
if (!pValue) {
|
||||
Py_DECREF(pArgs);
|
||||
Py_DECREF(pModule);
|
||||
|
@ -39,7 +39,7 @@ main(int argc, char *argv[])
|
|||
pValue = PyObject_CallObject(pFunc, pArgs);
|
||||
Py_DECREF(pArgs);
|
||||
if (pValue != NULL) {
|
||||
printf("Result of call: %ld\n", PyInt_AsLong(pValue));
|
||||
printf("Result of call: %ld\n", PyLong_AsLong(pValue));
|
||||
Py_DECREF(pValue);
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -10,7 +10,7 @@ static PyObject *
|
|||
Shoddy_increment(Shoddy *self, PyObject *unused)
|
||||
{
|
||||
self->state++;
|
||||
return PyInt_FromLong(self->state);
|
||||
return PyLong_FromLong(self->state);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -29,23 +29,24 @@ typedef struct {
|
|||
PyAPI_DATA(PyTypeObject) PyInt_Type;
|
||||
*/
|
||||
|
||||
#define PyInt_Check(op) PyLong_Check(op)
|
||||
#define PyInt_CheckExact(op) (PyLong_CheckExact(op) && _PyLong_FitsInLong(op))
|
||||
|
||||
#define PyInt_FromString PyLong_FromString
|
||||
#define PyInt_FromUnicode PyLong_FromUnicode
|
||||
#define PyInt_FromLong PyLong_FromLong
|
||||
#define PyInt_FromSize_t PyLong_FromSize_t
|
||||
#define PyInt_FromSsize_t PyLong_FromSsize_t
|
||||
#define PyInt_AsLong PyLong_AsLong
|
||||
#define PyInt_AsSsize_t PyLong_AsSsize_t
|
||||
#define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask
|
||||
#define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
|
||||
#ifdef 0
|
||||
# define PyInt_Check(op) PyLong_Check(op)
|
||||
# define PyInt_FromString PyLong_FromString
|
||||
# define PyInt_FromUnicode PyLong_FromUnicode
|
||||
# define PyInt_FromLong PyLong_FromLong
|
||||
# define PyInt_FromSize_t PyLong_FromSize_t
|
||||
# define PyInt_FromSsize_t PyLong_FromSsize_t
|
||||
# define PyInt_AsLong PyLong_AsLong
|
||||
# define PyInt_AsSsize_t PyLong_AsSsize_t
|
||||
# define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask
|
||||
# define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
|
||||
# define PyInt_AS_LONG PyLong_AS_LONG
|
||||
#endif
|
||||
|
||||
PyAPI_FUNC(long) PyInt_GetMax(void);
|
||||
|
||||
#define PyInt_AS_LONG(op) PyLong_AsLong(op)
|
||||
|
||||
/* These aren't really part of the Int object, but they're handy; the protos
|
||||
* are necessary for systems that need the magic of PyAPI_FUNC.
|
||||
*/
|
||||
|
|
|
@ -26,6 +26,10 @@ PyAPI_FUNC(size_t) PyLong_AsSize_t(PyObject *);
|
|||
PyAPI_FUNC(unsigned long) PyLong_AsUnsignedLong(PyObject *);
|
||||
PyAPI_FUNC(unsigned long) PyLong_AsUnsignedLongMask(PyObject *);
|
||||
|
||||
/* It may be useful in the future. I've added it in the PyInt -> PyLong
|
||||
cleanup to keep the extra information. [CH] */
|
||||
#define PyLong_AS_LONG(op) PyLong_AsLong(op)
|
||||
|
||||
/* Used by socketmodule.c */
|
||||
#if SIZEOF_SOCKET_T <= SIZEOF_LONG
|
||||
#define PyLong_FromSocket_t(fd) PyLong_FromLong((SOCKET_T)(fd))
|
||||
|
|
|
@ -139,7 +139,7 @@ static PyObject *PyCurses_ ## X (PyObject *self, PyObject *args) \
|
|||
static PyObject *PyCurses_ ## X (PyObject *self) \
|
||||
{ \
|
||||
PyCursesInitialised \
|
||||
return PyInt_FromLong((long) X()); }
|
||||
return PyLong_FromLong((long) X()); }
|
||||
|
||||
|
||||
#define NoArgReturnStringFunction(X) \
|
||||
|
|
|
@ -125,7 +125,6 @@ PyAPI_FUNC(void) _PyImport_Init(void);
|
|||
PyAPI_FUNC(void) _PyExc_Init(void);
|
||||
PyAPI_FUNC(void) _PyImportHooks_Init(void);
|
||||
PyAPI_FUNC(int) _PyFrame_Init(void);
|
||||
PyAPI_FUNC(int) _PyInt_Init(void);
|
||||
PyAPI_FUNC(void) _PyFloat_Init(void);
|
||||
PyAPI_FUNC(int) PyBytes_Init(void);
|
||||
|
||||
|
@ -140,7 +139,6 @@ PyAPI_FUNC(void) PyList_Fini(void);
|
|||
PyAPI_FUNC(void) PySet_Fini(void);
|
||||
PyAPI_FUNC(void) PyString_Fini(void);
|
||||
PyAPI_FUNC(void) PyBytes_Fini(void);
|
||||
PyAPI_FUNC(void) PyInt_Fini(void);
|
||||
PyAPI_FUNC(void) PyFloat_Fini(void);
|
||||
PyAPI_FUNC(void) PyOS_FiniInterrupts(void);
|
||||
|
||||
|
|
|
@ -195,7 +195,7 @@ rf_tell(rfobject *self, PyObject *args)
|
|||
PyMac_Error(err);
|
||||
return NULL;
|
||||
}
|
||||
return PyInt_FromLong(where);
|
||||
return PyLong_FromLong(where);
|
||||
}
|
||||
|
||||
static char rf_close__doc__[] =
|
||||
|
|
|
@ -102,8 +102,8 @@ myEventHandler(EventHandlerCallRef handlerRef, EventRef event, void *outPyObject
|
|||
} else {
|
||||
if (retValue == Py_None)
|
||||
status = noErr;
|
||||
else if (PyInt_Check(retValue)) {
|
||||
status = PyInt_AsLong(retValue);
|
||||
else if (PyLong_Check(retValue)) {
|
||||
status = PyLong_AsLong(retValue);
|
||||
} else
|
||||
status = noErr; /* wrong object type, complain? */
|
||||
Py_DECREF(retValue);
|
||||
|
|
|
@ -114,7 +114,7 @@ PyCF_CF2Python_simple(CFTypeRef src) {
|
|||
long l;
|
||||
if (!CFNumberGetValue(src, kCFNumberLongType, &l))
|
||||
/* XXXX Out of range! */;
|
||||
return PyInt_FromLong(l);
|
||||
return PyLong_FromLong(l);
|
||||
}
|
||||
}
|
||||
/* XXXX Should return as CFTypeRef, really... */
|
||||
|
@ -258,8 +258,8 @@ PyCF_Python2CF_simple(PyObject *src, CFTypeRef *dst) {
|
|||
*dst = kCFBooleanFalse;
|
||||
return 1;
|
||||
}
|
||||
if (PyInt_Check(src)) {
|
||||
long v = PyInt_AsLong(src);
|
||||
if (PyLong_Check(src)) {
|
||||
long v = PyLong_AsLong(src);
|
||||
*dst = CFNumberCreate(NULL, kCFNumberLongType, &v);
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -3250,7 +3250,7 @@ static PyObject *CtlObj_TrackControl(ControlObject *_self, PyObject *_args)
|
|||
PyMac_GetPoint, &startPoint, &callback))
|
||||
return NULL;
|
||||
if (callback && callback != Py_None) {
|
||||
if (PyInt_Check(callback) && PyInt_AS_LONG(callback) == -1)
|
||||
if (PyLong_Check(callback) && PyLong_AS_LONG(callback) == -1)
|
||||
upp = (ControlActionUPP)-1;
|
||||
else {
|
||||
settrackfunc(callback);
|
||||
|
@ -3283,7 +3283,7 @@ static PyObject *CtlObj_HandleControlClick(ControlObject *_self, PyObject *_args
|
|||
&callback))
|
||||
return NULL;
|
||||
if (callback && callback != Py_None) {
|
||||
if (PyInt_Check(callback) && PyInt_AS_LONG(callback) == -1)
|
||||
if (PyLong_Check(callback) && PyLong_AS_LONG(callback) == -1)
|
||||
upp = (ControlActionUPP)-1;
|
||||
else {
|
||||
settrackfunc(callback);
|
||||
|
|
|
@ -55,8 +55,8 @@ static pascal Boolean Dlg_UnivFilterProc(DialogPtr dialog,
|
|||
}
|
||||
else {
|
||||
Dlg_FilterProc_callback = callback;
|
||||
if (PyInt_Check(res)) {
|
||||
*itemHit = PyInt_AsLong(res);
|
||||
if (PyLong_Check(res)) {
|
||||
*itemHit = PyLong_AsLong(res);
|
||||
rv = 1;
|
||||
}
|
||||
else
|
||||
|
@ -150,7 +150,7 @@ PyObject *DlgObj_New(DialogPtr itself)
|
|||
int DlgObj_Convert(PyObject *v, DialogPtr *p_itself)
|
||||
{
|
||||
if (v == Py_None) { *p_itself = NULL; return 1; }
|
||||
if (PyInt_Check(v)) { *p_itself = (DialogPtr)PyInt_AsLong(v);
|
||||
if (PyLong_Check(v)) { *p_itself = (DialogPtr)PyLong_AsLong(v);
|
||||
return 1; }
|
||||
if (!DlgObj_Check(v))
|
||||
{
|
||||
|
|
|
@ -40,7 +40,7 @@ gestalt_gestalt(PyObject *self, PyObject *args)
|
|||
iErr = Gestalt ( selector, &response );
|
||||
if (iErr != 0)
|
||||
return PyMac_Error(iErr);
|
||||
return PyInt_FromLong(response);
|
||||
return PyLong_FromLong(response);
|
||||
}
|
||||
|
||||
static struct PyMethodDef gestalt_methods[] = {
|
||||
|
|
|
@ -1488,14 +1488,14 @@ static PyMethodDef BMObj_methods[] = {
|
|||
|
||||
static PyObject *BMObj_get_baseAddr(BitMapObject *self, void *closure)
|
||||
{
|
||||
return PyInt_FromLong((long)self->ob_itself->baseAddr);
|
||||
return PyLong_FromLong((long)self->ob_itself->baseAddr);
|
||||
}
|
||||
|
||||
#define BMObj_set_baseAddr NULL
|
||||
|
||||
static PyObject *BMObj_get_rowBytes(BitMapObject *self, void *closure)
|
||||
{
|
||||
return PyInt_FromLong((long)self->ob_itself->rowBytes);
|
||||
return PyLong_FromLong((long)self->ob_itself->rowBytes);
|
||||
}
|
||||
|
||||
#define BMObj_set_rowBytes NULL
|
||||
|
|
|
@ -556,7 +556,7 @@ static int ResObj_set_data(ResourceObject *self, PyObject *v, void *closure)
|
|||
|
||||
static PyObject *ResObj_get_size(ResourceObject *self, void *closure)
|
||||
{
|
||||
return PyInt_FromLong(GetHandleSize(self->ob_itself));
|
||||
return PyLong_FromLong(GetHandleSize(self->ob_itself));
|
||||
}
|
||||
|
||||
#define ResObj_set_size NULL
|
||||
|
|
|
@ -409,7 +409,7 @@ sndih_getSampleSizeAvailable(self, args)
|
|||
if( (rsizes = PyTuple_New(arg.numsizes)) == NULL)
|
||||
return NULL;
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
|
@ -74,7 +74,7 @@ int WinObj_Convert(PyObject *v, WindowPtr *p_itself)
|
|||
{
|
||||
|
||||
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;
|
||||
|
|
|
@ -48,7 +48,7 @@ bisect_right(PyObject *self, PyObject *args, PyObject *kw)
|
|||
index = internal_bisect_right(list, item, lo, hi);
|
||||
if (index < 0)
|
||||
return NULL;
|
||||
return PyInt_FromLong(index);
|
||||
return PyLong_FromLong(index);
|
||||
}
|
||||
|
||||
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);
|
||||
if (index < 0)
|
||||
return NULL;
|
||||
return PyInt_FromLong(index);
|
||||
return PyLong_FromLong(index);
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(bisect_left_doc,
|
||||
|
|
|
@ -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 */
|
||||
}
|
||||
|
||||
else if (PyInt_Check(keyobj)) {
|
||||
else if (PyLong_Check(keyobj)) {
|
||||
/* verify access method type */
|
||||
type = _DB_get_type(self);
|
||||
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
|
||||
* 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));
|
||||
if (key->data == NULL) {
|
||||
PyErr_SetString(PyExc_MemoryError, "Key memory allocation failed");
|
||||
|
@ -738,7 +738,7 @@ static PyObject* _DBCursor_get(DBCursorObject* self, int extra_flags,
|
|||
/* add an integer to a dictionary using the given name as a key */
|
||||
static void _addIntToDict(PyObject* dict, char *name, int value)
|
||||
{
|
||||
PyObject* v = PyInt_FromLong((long) value);
|
||||
PyObject* v = PyLong_FromLong((long) value);
|
||||
if (!v || PyDict_SetItemString(dict, name, v))
|
||||
PyErr_Clear();
|
||||
|
||||
|
@ -755,7 +755,7 @@ static void _addTimeTToDict(PyObject* dict, char *name, time_t value)
|
|||
v = PyLong_FromLongLong((PY_LONG_LONG) value);
|
||||
else
|
||||
#endif
|
||||
v = PyInt_FromLong((long) value);
|
||||
v = PyLong_FromLong((long) value);
|
||||
if (!v || PyDict_SetItemString(dict, name, v))
|
||||
PyErr_Clear();
|
||||
|
||||
|
@ -1132,7 +1132,7 @@ DB_append(DBObject* self, PyObject* args)
|
|||
}
|
||||
|
||||
free_buf_view(dataobj, data_buf_view);
|
||||
return PyInt_FromLong(recno);
|
||||
return PyLong_FromLong(recno);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1168,8 +1168,8 @@ _db_associateCallback(DB* db, const DBT* priKey, const DBT* priData,
|
|||
else if (result == Py_None) {
|
||||
retval = DB_DONOTINDEX;
|
||||
}
|
||||
else if (PyInt_Check(result)) {
|
||||
retval = PyInt_AsLong(result);
|
||||
else if (PyLong_Check(result)) {
|
||||
retval = PyLong_AsLong(result);
|
||||
}
|
||||
else if (PyBytes_Check(result) || PyString_Check(result)) {
|
||||
char* data;
|
||||
|
@ -1457,7 +1457,7 @@ DB_fd(DBObject* self, PyObject* args)
|
|||
err = self->db->fd(self->db, &the_fd);
|
||||
MYDB_END_ALLOW_THREADS;
|
||||
RETURN_IF_ERR();
|
||||
return PyInt_FromLong(the_fd);
|
||||
return PyLong_FromLong(the_fd);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1594,7 +1594,7 @@ DB_pget(DBObject* self, PyObject* args, PyObject* kwargs)
|
|||
|
||||
if (self->primaryDBType == DB_RECNO ||
|
||||
self->primaryDBType == DB_QUEUE)
|
||||
pkeyObj = PyInt_FromLong(*(int *)pkey.data);
|
||||
pkeyObj = PyLong_FromLong(*(int *)pkey.data);
|
||||
else
|
||||
pkeyObj = PyString_FromStringAndSize(pkey.data, pkey.size);
|
||||
|
||||
|
@ -1603,7 +1603,7 @@ DB_pget(DBObject* self, PyObject* args, PyObject* kwargs)
|
|||
PyObject *keyObj;
|
||||
int type = _DB_get_type(self);
|
||||
if (type == DB_RECNO || type == DB_QUEUE)
|
||||
keyObj = PyInt_FromLong(*(int *)key.data);
|
||||
keyObj = PyLong_FromLong(*(int *)key.data);
|
||||
else
|
||||
keyObj = PyString_FromStringAndSize(key.data, key.size);
|
||||
#if (PY_VERSION_HEX >= 0x02040000)
|
||||
|
@ -1667,7 +1667,7 @@ DB_get_size(DBObject* self, PyObject* args, PyObject* kwargs)
|
|||
err = self->db->get(self->db, txn, &key, &data, flags);
|
||||
MYDB_END_ALLOW_THREADS;
|
||||
if (err == DB_BUFFER_SMALL) {
|
||||
retval = PyInt_FromLong((long)data.size);
|
||||
retval = PyLong_FromLong((long)data.size);
|
||||
err = 0;
|
||||
}
|
||||
|
||||
|
@ -1769,7 +1769,7 @@ DB_get_byteswapped(DBObject* self, PyObject* args)
|
|||
retval = self->db->get_byteswapped(self->db);
|
||||
MYDB_END_ALLOW_THREADS;
|
||||
#endif
|
||||
return PyInt_FromLong(retval);
|
||||
return PyLong_FromLong(retval);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1785,7 +1785,7 @@ DB_get_type(DBObject* self, PyObject* args)
|
|||
type = _DB_get_type(self);
|
||||
if (type == -1)
|
||||
return NULL;
|
||||
return PyInt_FromLong(type);
|
||||
return PyLong_FromLong(type);
|
||||
}
|
||||
|
||||
|
||||
|
@ -2004,7 +2004,7 @@ DB_put(DBObject* self, PyObject* args, PyObject* kwargs)
|
|||
}
|
||||
|
||||
if (flags & DB_APPEND)
|
||||
retval = PyInt_FromLong(*((db_recno_t*)key.data));
|
||||
retval = PyLong_FromLong(*((db_recno_t*)key.data));
|
||||
else {
|
||||
retval = Py_None;
|
||||
Py_INCREF(retval);
|
||||
|
@ -2130,8 +2130,8 @@ _db_compareCallback(DB* db,
|
|||
/* we're in a callback within the DB code, we can't raise */
|
||||
PyErr_Print();
|
||||
res = _default_cmp(leftKey, rightKey);
|
||||
} else if (PyInt_Check(result)) {
|
||||
res = PyInt_AsLong(result);
|
||||
} else if (PyLong_Check(result)) {
|
||||
res = PyLong_AsLong(result);
|
||||
} else {
|
||||
PyErr_SetString(PyExc_TypeError,
|
||||
"DB_bt_compare callback MUST return an int.");
|
||||
|
@ -2175,11 +2175,11 @@ DB_set_bt_compare(DBObject* self, PyObject* args)
|
|||
Py_DECREF(tuple);
|
||||
if (result == NULL)
|
||||
return NULL;
|
||||
if (!PyInt_Check(result)) {
|
||||
if (!PyLong_Check(result)) {
|
||||
PyErr_SetString(PyExc_TypeError,
|
||||
"callback MUST return an int");
|
||||
return NULL;
|
||||
} else if (PyInt_AsLong(result) != 0) {
|
||||
} else if (PyLong_AsLong(result) != 0) {
|
||||
PyErr_SetString(PyExc_TypeError,
|
||||
"callback failed to return 0 on two empty strings");
|
||||
return NULL;
|
||||
|
@ -2581,7 +2581,7 @@ DB_truncate(DBObject* self, PyObject* args, PyObject* kwargs)
|
|||
err = self->db->truncate(self->db, txn, &count, flags);
|
||||
MYDB_END_ALLOW_THREADS;
|
||||
RETURN_IF_ERR();
|
||||
return PyInt_FromLong(count);
|
||||
return PyLong_FromLong(count);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -2662,7 +2662,7 @@ DB_set_get_returns_none(DBObject* self, PyObject* args)
|
|||
++oldValue;
|
||||
self->moduleFlags.getReturnsNone = (flags >= 1);
|
||||
self->moduleFlags.cursorSetReturnsNone = (flags >= 2);
|
||||
return PyInt_FromLong(oldValue);
|
||||
return PyLong_FromLong(oldValue);
|
||||
}
|
||||
|
||||
#if (DBVER >= 41)
|
||||
|
@ -2866,9 +2866,9 @@ DB_has_key(DBObject* self, PyObject* args)
|
|||
FREE_DBT_VIEW(key, keyobj, key_buf_view);
|
||||
|
||||
if (err == DB_BUFFER_SMALL || err == 0) {
|
||||
return PyInt_FromLong(1);
|
||||
return PyLong_FromLong(1);
|
||||
} else if (err == DB_NOTFOUND || err == DB_KEYEMPTY) {
|
||||
return PyInt_FromLong(0);
|
||||
return PyLong_FromLong(0);
|
||||
}
|
||||
|
||||
makeDBError(err);
|
||||
|
@ -2936,7 +2936,7 @@ _DB_make_list(DBObject* self, DB_TXN* txn, int type)
|
|||
break;
|
||||
case DB_RECNO:
|
||||
case DB_QUEUE:
|
||||
item = PyInt_FromLong(*((db_recno_t*)key.data));
|
||||
item = PyLong_FromLong(*((db_recno_t*)key.data));
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
@ -3071,7 +3071,7 @@ DBC_count(DBCursorObject* self, PyObject* args)
|
|||
MYDB_END_ALLOW_THREADS;
|
||||
RETURN_IF_ERR();
|
||||
|
||||
return PyInt_FromLong(count);
|
||||
return PyLong_FromLong(count);
|
||||
}
|
||||
|
||||
|
||||
|
@ -3294,7 +3294,7 @@ DBC_pget(DBCursorObject* self, PyObject* args, PyObject *kwargs)
|
|||
|
||||
if (self->mydb->primaryDBType == DB_RECNO ||
|
||||
self->mydb->primaryDBType == DB_QUEUE)
|
||||
pkeyObj = PyInt_FromLong(*(int *)pkey.data);
|
||||
pkeyObj = PyLong_FromLong(*(int *)pkey.data);
|
||||
else
|
||||
pkeyObj = PyString_FromStringAndSize(pkey.data, pkey.size);
|
||||
|
||||
|
@ -3303,7 +3303,7 @@ DBC_pget(DBCursorObject* self, PyObject* args, PyObject *kwargs)
|
|||
PyObject *keyObj;
|
||||
int type = _DB_get_type(self->mydb);
|
||||
if (type == DB_RECNO || type == DB_QUEUE)
|
||||
keyObj = PyInt_FromLong(*(int *)key.data);
|
||||
keyObj = PyLong_FromLong(*(int *)key.data);
|
||||
else
|
||||
keyObj = PyString_FromStringAndSize(key.data, key.size);
|
||||
retval = PyTuple_Pack(3, keyObj, pkeyObj, dataObj);
|
||||
|
@ -3359,7 +3359,7 @@ DBC_get_recno(DBCursorObject* self, PyObject* args)
|
|||
recno = *((db_recno_t*)data.data);
|
||||
free_dbt(&key);
|
||||
free_dbt(&data);
|
||||
return PyInt_FromLong(recno);
|
||||
return PyLong_FromLong(recno);
|
||||
}
|
||||
|
||||
|
||||
|
@ -3661,7 +3661,7 @@ DBC_get_current_size(DBCursorObject* self, PyObject* args)
|
|||
MYDB_END_ALLOW_THREADS;
|
||||
if (err == DB_BUFFER_SMALL || !err) {
|
||||
/* DB_BUFFER_SMALL means positive size, !err means zero length value */
|
||||
retval = PyInt_FromLong((long)data.size);
|
||||
retval = PyLong_FromLong((long)data.size);
|
||||
err = 0;
|
||||
}
|
||||
|
||||
|
@ -4336,7 +4336,7 @@ DBEnv_lock_detect(DBEnvObject* self, PyObject* args)
|
|||
#endif
|
||||
MYDB_END_ALLOW_THREADS;
|
||||
RETURN_IF_ERR();
|
||||
return PyInt_FromLong(aborted);
|
||||
return PyLong_FromLong(aborted);
|
||||
}
|
||||
|
||||
|
||||
|
@ -4380,7 +4380,7 @@ DBEnv_lock_id(DBEnvObject* self, PyObject* args)
|
|||
MYDB_END_ALLOW_THREADS;
|
||||
RETURN_IF_ERR();
|
||||
|
||||
return PyInt_FromLong((long)theID);
|
||||
return PyLong_FromLong((long)theID);
|
||||
}
|
||||
|
||||
#if (DBVER >= 40)
|
||||
|
@ -4695,7 +4695,7 @@ DBEnv_set_get_returns_none(DBEnvObject* self, PyObject* args)
|
|||
++oldValue;
|
||||
self->moduleFlags.getReturnsNone = (flags >= 1);
|
||||
self->moduleFlags.cursorSetReturnsNone = (flags >= 2);
|
||||
return PyInt_FromLong(oldValue);
|
||||
return PyLong_FromLong(oldValue);
|
||||
}
|
||||
|
||||
|
||||
|
@ -4839,7 +4839,7 @@ DBTxn_id(DBTxnObject* self, PyObject* args)
|
|||
id = txn_id(self->txn);
|
||||
#endif
|
||||
MYDB_END_ALLOW_THREADS;
|
||||
return PyInt_FromLong(id);
|
||||
return PyLong_FromLong(id);
|
||||
}
|
||||
|
||||
#if (DBVER >= 43)
|
||||
|
@ -5022,7 +5022,7 @@ DBSequence_get_cachesize(DBSequenceObject* self, PyObject* args)
|
|||
MYDB_END_ALLOW_THREADS
|
||||
|
||||
RETURN_IF_ERR();
|
||||
return PyInt_FromLong(size);
|
||||
return PyLong_FromLong(size);
|
||||
}
|
||||
|
||||
static PyObject*
|
||||
|
@ -5056,7 +5056,7 @@ DBSequence_get_flags(DBSequenceObject* self, PyObject* args)
|
|||
MYDB_END_ALLOW_THREADS
|
||||
|
||||
RETURN_IF_ERR();
|
||||
return PyInt_FromLong((int)flags);
|
||||
return PyLong_FromLong((int)flags);
|
||||
}
|
||||
|
||||
static PyObject*
|
||||
|
|
|
@ -775,7 +775,7 @@ deque_init(dequeobject *deque, PyObject *args, PyObject *kwdargs)
|
|||
if (!PyArg_ParseTupleAndKeywords(args, kwdargs, "|OO:deque", kwlist, &iterable, &maxlenobj))
|
||||
return -1;
|
||||
if (maxlenobj != NULL && maxlenobj != Py_None) {
|
||||
maxlen = PyInt_AsLong(maxlenobj);
|
||||
maxlen = PyLong_AsLong(maxlenobj);
|
||||
if (maxlen == -1 && PyErr_Occurred())
|
||||
return -1;
|
||||
if (maxlen < 0) {
|
||||
|
@ -954,7 +954,7 @@ dequeiter_next(dequeiterobject *it)
|
|||
static PyObject *
|
||||
dequeiter_len(dequeiterobject *it)
|
||||
{
|
||||
return PyInt_FromLong(it->counter);
|
||||
return PyLong_FromLong(it->counter);
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(length_hint_doc, "Private method returning an estimate of len(list(it)).");
|
||||
|
|
|
@ -162,7 +162,7 @@ Dialect_get_quotechar(DialectObj *self)
|
|||
static PyObject *
|
||||
Dialect_get_quoting(DialectObj *self)
|
||||
{
|
||||
return PyInt_FromLong(self->quoting);
|
||||
return PyLong_FromLong(self->quoting);
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -186,7 +186,7 @@ _set_int(const char *name, int *target, PyObject *src, int dflt)
|
|||
"\"%s\" must be an integer", name);
|
||||
return -1;
|
||||
}
|
||||
*target = PyInt_AsLong(src);
|
||||
*target = PyLong_AsLong(src);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -1390,9 +1390,9 @@ csv_field_size_limit(PyObject *module, PyObject *args)
|
|||
"limit must be an integer");
|
||||
return NULL;
|
||||
}
|
||||
field_limit = PyInt_AsLong(new_limit);
|
||||
field_limit = PyLong_AsLong(new_limit);
|
||||
}
|
||||
return PyInt_FromLong(old_limit);
|
||||
return PyLong_FromLong(old_limit);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -236,7 +236,7 @@ static PyObject *
|
|||
CDataType_from_address(PyObject *type, PyObject *value)
|
||||
{
|
||||
void *buf;
|
||||
if (!PyInt_Check(value)) {
|
||||
if (!PyLong_Check(value)) {
|
||||
PyErr_SetString(PyExc_TypeError,
|
||||
"integer expected");
|
||||
return NULL;
|
||||
|
@ -265,7 +265,7 @@ CDataType_in_dll(PyObject *type, PyObject *args)
|
|||
obj = PyObject_GetAttrString(dll, "_handle");
|
||||
if (!obj)
|
||||
return NULL;
|
||||
if (!PyInt_Check(obj)) {
|
||||
if (!PyLong_Check(obj)) {
|
||||
PyErr_SetString(PyExc_TypeError,
|
||||
"the _handle attribute of the second argument must be an integer");
|
||||
Py_DECREF(obj);
|
||||
|
@ -641,7 +641,7 @@ PointerType_from_param(PyObject *type, PyObject *value)
|
|||
StgDictObject *typedict;
|
||||
|
||||
if (value == Py_None)
|
||||
return PyInt_FromLong(0); /* NULL pointer */
|
||||
return PyLong_FromLong(0); /* NULL pointer */
|
||||
|
||||
typedict = PyType_stgdict(type);
|
||||
assert(typedict); /* Cannot be NULL for pointer types */
|
||||
|
@ -969,7 +969,7 @@ ArrayType_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
|
|||
"which must be a positive integer");
|
||||
return NULL;
|
||||
}
|
||||
length = PyInt_AS_LONG(proto);
|
||||
length = PyLong_AS_LONG(proto);
|
||||
|
||||
proto = PyDict_GetItemString(typedict, "_type_"); /* Borrowed ref */
|
||||
if (!proto) {
|
||||
|
@ -1233,7 +1233,7 @@ c_void_p_from_param(PyObject *type, PyObject *value)
|
|||
}
|
||||
/* Should probably allow buffer interface as well */
|
||||
/* int, long */
|
||||
if (PyInt_Check(value)) {
|
||||
if (PyLong_Check(value)) {
|
||||
PyCArgObject *parg;
|
||||
struct fielddesc *fd = getentry("P");
|
||||
|
||||
|
@ -1784,12 +1784,12 @@ make_funcptrtype_dict(StgDictObject *stgdict)
|
|||
stgdict->ffi_type_pointer = ffi_type_pointer;
|
||||
|
||||
ob = PyDict_GetItemString((PyObject *)stgdict, "_flags_");
|
||||
if (!ob || !PyInt_Check(ob)) {
|
||||
if (!ob || !PyLong_Check(ob)) {
|
||||
PyErr_SetString(PyExc_TypeError,
|
||||
"class must define _flags_ which must be an integer");
|
||||
return -1;
|
||||
}
|
||||
stgdict->flags = PyInt_AS_LONG(ob);
|
||||
stgdict->flags = PyLong_AS_LONG(ob);
|
||||
|
||||
/* _argtypes_ is optional... */
|
||||
ob = PyDict_GetItemString((PyObject *)stgdict, "_argtypes_");
|
||||
|
@ -2697,11 +2697,11 @@ static int
|
|||
_get_name(PyObject *obj, char **pname)
|
||||
{
|
||||
#ifdef MS_WIN32
|
||||
if (PyInt_Check(obj)) {
|
||||
if (PyLong_Check(obj)) {
|
||||
/* We have to use MAKEINTRESOURCEA for Windows CE.
|
||||
Works on Windows as well, of course.
|
||||
*/
|
||||
*pname = MAKEINTRESOURCEA(PyInt_AsUnsignedLongMask(obj) & 0xFFFF);
|
||||
*pname = MAKEINTRESOURCEA(PyLong_AsUnsignedLongMask(obj) & 0xFFFF);
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
@ -2738,7 +2738,7 @@ CFuncPtr_FromDll(PyTypeObject *type, PyObject *args, PyObject *kwds)
|
|||
obj = PyObject_GetAttrString(dll, "_handle");
|
||||
if (!obj)
|
||||
return NULL;
|
||||
if (!PyInt_Check(obj)) {
|
||||
if (!PyLong_Check(obj)) {
|
||||
PyErr_SetString(PyExc_TypeError,
|
||||
"the _handle attribute of the second argument must be an integer");
|
||||
Py_DECREF(obj);
|
||||
|
@ -2858,12 +2858,12 @@ CFuncPtr_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
|
|||
return CFuncPtr_FromDll(type, args, kwds);
|
||||
|
||||
#ifdef MS_WIN32
|
||||
if (2 <= PyTuple_GET_SIZE(args) && PyInt_Check(PyTuple_GET_ITEM(args, 0)))
|
||||
if (2 <= PyTuple_GET_SIZE(args) && PyLong_Check(PyTuple_GET_ITEM(args, 0)))
|
||||
return CFuncPtr_FromVtblIndex(type, args, kwds);
|
||||
#endif
|
||||
|
||||
if (1 == PyTuple_GET_SIZE(args)
|
||||
&& (PyInt_Check(PyTuple_GET_ITEM(args, 0)))) {
|
||||
&& (PyLong_Check(PyTuple_GET_ITEM(args, 0)))) {
|
||||
CDataObject *ob;
|
||||
void *ptr = PyLong_AsVoidPtr(PyTuple_GET_ITEM(args, 0));
|
||||
if (ptr == NULL)
|
||||
|
@ -3068,7 +3068,7 @@ _build_callargs(CFuncPtrObject *self, PyObject *argtypes,
|
|||
calls below. */
|
||||
/* We HAVE already checked that the tuple can be parsed with "i|ZO", so... */
|
||||
Py_ssize_t tsize = PyTuple_GET_SIZE(item);
|
||||
flag = PyInt_AS_LONG(PyTuple_GET_ITEM(item, 0));
|
||||
flag = PyLong_AS_LONG(PyTuple_GET_ITEM(item, 0));
|
||||
name = tsize > 1 ? PyTuple_GET_ITEM(item, 1) : NULL;
|
||||
defval = tsize > 2 ? PyTuple_GET_ITEM(item, 2) : NULL;
|
||||
|
||||
|
@ -3077,7 +3077,7 @@ _build_callargs(CFuncPtrObject *self, PyObject *argtypes,
|
|||
/* ['in', 'lcid'] parameter. Always taken from defval,
|
||||
if given, else the integer 0. */
|
||||
if (defval == NULL) {
|
||||
defval = PyInt_FromLong(0);
|
||||
defval = PyLong_FromLong(0);
|
||||
if (defval == NULL)
|
||||
goto error;
|
||||
} else
|
||||
|
@ -4864,11 +4864,11 @@ init_ctypes(void)
|
|||
return;
|
||||
PyModule_AddObject(m, "COMError", ComError);
|
||||
|
||||
PyModule_AddObject(m, "FUNCFLAG_HRESULT", PyInt_FromLong(FUNCFLAG_HRESULT));
|
||||
PyModule_AddObject(m, "FUNCFLAG_STDCALL", PyInt_FromLong(FUNCFLAG_STDCALL));
|
||||
PyModule_AddObject(m, "FUNCFLAG_HRESULT", PyLong_FromLong(FUNCFLAG_HRESULT));
|
||||
PyModule_AddObject(m, "FUNCFLAG_STDCALL", PyLong_FromLong(FUNCFLAG_STDCALL));
|
||||
#endif
|
||||
PyModule_AddObject(m, "FUNCFLAG_CDECL", PyInt_FromLong(FUNCFLAG_CDECL));
|
||||
PyModule_AddObject(m, "FUNCFLAG_PYTHONAPI", PyInt_FromLong(FUNCFLAG_PYTHONAPI));
|
||||
PyModule_AddObject(m, "FUNCFLAG_CDECL", PyLong_FromLong(FUNCFLAG_CDECL));
|
||||
PyModule_AddObject(m, "FUNCFLAG_PYTHONAPI", PyLong_FromLong(FUNCFLAG_PYTHONAPI));
|
||||
PyModule_AddStringConstant(m, "__version__", "1.1.0");
|
||||
|
||||
PyModule_AddObject(m, "_memmove_addr", PyLong_FromVoidPtr(memmove));
|
||||
|
@ -4891,8 +4891,8 @@ init_ctypes(void)
|
|||
#define RTLD_GLOBAL RTLD_LOCAL
|
||||
#endif
|
||||
|
||||
PyModule_AddObject(m, "RTLD_LOCAL", PyInt_FromLong(RTLD_LOCAL));
|
||||
PyModule_AddObject(m, "RTLD_GLOBAL", PyInt_FromLong(RTLD_GLOBAL));
|
||||
PyModule_AddObject(m, "RTLD_LOCAL", PyLong_FromLong(RTLD_LOCAL));
|
||||
PyModule_AddObject(m, "RTLD_GLOBAL", PyLong_FromLong(RTLD_GLOBAL));
|
||||
|
||||
PyExc_ArgError = PyErr_NewException("ctypes.ArgumentError", NULL, NULL);
|
||||
if (PyExc_ArgError) {
|
||||
|
|
|
@ -408,7 +408,7 @@ long Call_GetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
|
|||
return E_FAIL;
|
||||
}
|
||||
|
||||
retval = PyInt_AsLong(result);
|
||||
retval = PyLong_AsLong(result);
|
||||
if (PyErr_Occurred()) {
|
||||
PyErr_WriteUnraisable(context ? context : Py_None);
|
||||
retval = E_FAIL;
|
||||
|
@ -469,7 +469,7 @@ long Call_CanUnloadNow(void)
|
|||
return E_FAIL;
|
||||
}
|
||||
|
||||
retval = PyInt_AsLong(result);
|
||||
retval = PyLong_AsLong(result);
|
||||
if (PyErr_Occurred()) {
|
||||
PyErr_WriteUnraisable(context ? context : Py_None);
|
||||
retval = E_FAIL;
|
||||
|
|
|
@ -269,7 +269,7 @@ check_hresult(PyObject *self, PyObject *args)
|
|||
return NULL;
|
||||
if (FAILED(hr))
|
||||
return PyErr_SetFromWindowsErr(hr);
|
||||
return PyInt_FromLong(hr);
|
||||
return PyLong_FromLong(hr);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -727,7 +727,7 @@ static PyObject *GetResult(PyObject *restype, void *result, PyObject *checker)
|
|||
PyObject *retval, *v;
|
||||
|
||||
if (restype == NULL)
|
||||
return PyInt_FromLong(*(int *)result);
|
||||
return PyLong_FromLong(*(int *)result);
|
||||
|
||||
if (restype == Py_None) {
|
||||
Py_INCREF(Py_None);
|
||||
|
@ -1020,12 +1020,12 @@ PyObject *_CallProc(PPROC pProc,
|
|||
if (*(int *)resbuf & 0x80000000)
|
||||
retval = GetComError(*(HRESULT *)resbuf, iid, pIunk);
|
||||
else
|
||||
retval = PyInt_FromLong(*(int *)resbuf);
|
||||
retval = PyLong_FromLong(*(int *)resbuf);
|
||||
} else if (flags & FUNCFLAG_HRESULT) {
|
||||
if (*(int *)resbuf & 0x80000000)
|
||||
retval = PyErr_SetFromWindowsErr(*(int *)resbuf);
|
||||
else
|
||||
retval = PyInt_FromLong(*(int *)resbuf);
|
||||
retval = PyLong_FromLong(*(int *)resbuf);
|
||||
} else
|
||||
#endif
|
||||
retval = GetResult(restype, resbuf, checker);
|
||||
|
@ -1198,12 +1198,12 @@ copy_com_pointer(PyObject *self, PyObject *args)
|
|||
pdst = (IUnknown **)b.value.p;
|
||||
|
||||
if (pdst == NULL)
|
||||
r = PyInt_FromLong(E_POINTER);
|
||||
r = PyLong_FromLong(E_POINTER);
|
||||
else {
|
||||
if (src)
|
||||
src->lpVtbl->AddRef(src);
|
||||
*pdst = src;
|
||||
r = PyInt_FromLong(S_OK);
|
||||
r = PyLong_FromLong(S_OK);
|
||||
}
|
||||
done:
|
||||
Py_XDECREF(a.keep);
|
||||
|
@ -1345,10 +1345,10 @@ sizeof_func(PyObject *self, PyObject *obj)
|
|||
|
||||
dict = PyType_stgdict(obj);
|
||||
if (dict)
|
||||
return PyInt_FromSsize_t(dict->size);
|
||||
return PyLong_FromSsize_t(dict->size);
|
||||
|
||||
if (CDataObject_Check(obj))
|
||||
return PyInt_FromSsize_t(((CDataObject *)obj)->b_size);
|
||||
return PyLong_FromSsize_t(((CDataObject *)obj)->b_size);
|
||||
PyErr_SetString(PyExc_TypeError,
|
||||
"this type has no size");
|
||||
return NULL;
|
||||
|
@ -1366,11 +1366,11 @@ align_func(PyObject *self, PyObject *obj)
|
|||
|
||||
dict = PyType_stgdict(obj);
|
||||
if (dict)
|
||||
return PyInt_FromSsize_t(dict->align);
|
||||
return PyLong_FromSsize_t(dict->align);
|
||||
|
||||
dict = PyObject_stgdict(obj);
|
||||
if (dict)
|
||||
return PyInt_FromSsize_t(dict->align);
|
||||
return PyLong_FromSsize_t(dict->align);
|
||||
|
||||
PyErr_SetString(PyExc_TypeError,
|
||||
"no alignment info");
|
||||
|
|
|
@ -216,13 +216,13 @@ CField_get(CFieldObject *self, PyObject *inst, PyTypeObject *type)
|
|||
static PyObject *
|
||||
CField_get_offset(PyObject *self, void *data)
|
||||
{
|
||||
return PyInt_FromSsize_t(((CFieldObject *)self)->offset);
|
||||
return PyLong_FromSsize_t(((CFieldObject *)self)->offset);
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
CField_get_size(PyObject *self, void *data)
|
||||
{
|
||||
return PyInt_FromSsize_t(((CFieldObject *)self)->size);
|
||||
return PyLong_FromSsize_t(((CFieldObject *)self)->size);
|
||||
}
|
||||
|
||||
static PyGetSetDef CField_getset[] = {
|
||||
|
@ -329,13 +329,13 @@ static int
|
|||
get_long(PyObject *v, long *p)
|
||||
{
|
||||
long x;
|
||||
if (!PyInt_Check(v)) {
|
||||
if (!PyLong_Check(v)) {
|
||||
PyErr_Format(PyExc_TypeError,
|
||||
"int expected instead of %s instance",
|
||||
v->ob_type->tp_name);
|
||||
return -1;
|
||||
}
|
||||
x = PyInt_AsUnsignedLongMask(v);
|
||||
x = PyLong_AsUnsignedLongMask(v);
|
||||
if (x == -1 && PyErr_Occurred())
|
||||
return -1;
|
||||
*p = x;
|
||||
|
@ -348,13 +348,13 @@ static int
|
|||
get_ulong(PyObject *v, unsigned long *p)
|
||||
{
|
||||
unsigned long x;
|
||||
if (!PyInt_Check(v)) {
|
||||
if (!PyLong_Check(v)) {
|
||||
PyErr_Format(PyExc_TypeError,
|
||||
"int expected instead of %s instance",
|
||||
v->ob_type->tp_name);
|
||||
return -1;
|
||||
}
|
||||
x = PyInt_AsUnsignedLongMask(v);
|
||||
x = PyLong_AsUnsignedLongMask(v);
|
||||
if (x == -1 && PyErr_Occurred())
|
||||
return -1;
|
||||
*p = x;
|
||||
|
@ -369,13 +369,13 @@ static int
|
|||
get_longlong(PyObject *v, PY_LONG_LONG *p)
|
||||
{
|
||||
PY_LONG_LONG x;
|
||||
if (!PyInt_Check(v)) {
|
||||
if (!PyLong_Check(v)) {
|
||||
PyErr_Format(PyExc_TypeError,
|
||||
"int expected instead of %s instance",
|
||||
v->ob_type->tp_name);
|
||||
return -1;
|
||||
}
|
||||
x = PyInt_AsUnsignedLongLongMask(v);
|
||||
x = PyLong_AsUnsignedLongLongMask(v);
|
||||
if (x == -1 && PyErr_Occurred())
|
||||
return -1;
|
||||
*p = x;
|
||||
|
@ -388,13 +388,13 @@ static int
|
|||
get_ulonglong(PyObject *v, unsigned PY_LONG_LONG *p)
|
||||
{
|
||||
unsigned PY_LONG_LONG x;
|
||||
if (!PyInt_Check(v)) {
|
||||
if (!PyLong_Check(v)) {
|
||||
PyErr_Format(PyExc_TypeError,
|
||||
"int expected instead of %s instance",
|
||||
v->ob_type->tp_name);
|
||||
return -1;
|
||||
}
|
||||
x = PyInt_AsUnsignedLongLongMask(v);
|
||||
x = PyLong_AsUnsignedLongLongMask(v);
|
||||
if (x == -1 && PyErr_Occurred())
|
||||
return -1;
|
||||
*p = x;
|
||||
|
@ -513,7 +513,7 @@ b_get(void *ptr, Py_ssize_t size)
|
|||
{
|
||||
signed char val = *(signed char *)ptr;
|
||||
GET_BITFIELD(val, size);
|
||||
return PyInt_FromLong(val);
|
||||
return PyLong_FromLong(val);
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
|
@ -533,7 +533,7 @@ B_get(void *ptr, Py_ssize_t size)
|
|||
{
|
||||
unsigned char val = *(unsigned char *)ptr;
|
||||
GET_BITFIELD(val, size);
|
||||
return PyInt_FromLong(val);
|
||||
return PyLong_FromLong(val);
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
|
@ -571,7 +571,7 @@ h_get(void *ptr, Py_ssize_t size)
|
|||
short val;
|
||||
memcpy(&val, ptr, sizeof(val));
|
||||
GET_BITFIELD(val, size);
|
||||
return PyInt_FromLong((long)val);
|
||||
return PyLong_FromLong((long)val);
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
|
@ -581,7 +581,7 @@ h_get_sw(void *ptr, Py_ssize_t size)
|
|||
memcpy(&val, ptr, sizeof(val));
|
||||
val = SWAP_2(val);
|
||||
GET_BITFIELD(val, size);
|
||||
return PyInt_FromLong(val);
|
||||
return PyLong_FromLong(val);
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
|
@ -619,7 +619,7 @@ H_get(void *ptr, Py_ssize_t size)
|
|||
unsigned short val;
|
||||
memcpy(&val, ptr, sizeof(val));
|
||||
GET_BITFIELD(val, size);
|
||||
return PyInt_FromLong(val);
|
||||
return PyLong_FromLong(val);
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
|
@ -629,7 +629,7 @@ H_get_sw(void *ptr, Py_ssize_t size)
|
|||
memcpy(&val, ptr, sizeof(val));
|
||||
val = SWAP_2(val);
|
||||
GET_BITFIELD(val, size);
|
||||
return PyInt_FromLong(val);
|
||||
return PyLong_FromLong(val);
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
|
@ -667,7 +667,7 @@ i_get(void *ptr, Py_ssize_t size)
|
|||
int val;
|
||||
memcpy(&val, ptr, sizeof(val));
|
||||
GET_BITFIELD(val, size);
|
||||
return PyInt_FromLong(val);
|
||||
return PyLong_FromLong(val);
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
|
@ -677,7 +677,7 @@ i_get_sw(void *ptr, Py_ssize_t size)
|
|||
memcpy(&val, ptr, sizeof(val));
|
||||
val = SWAP_INT(val);
|
||||
GET_BITFIELD(val, size);
|
||||
return PyInt_FromLong(val);
|
||||
return PyLong_FromLong(val);
|
||||
}
|
||||
|
||||
#ifdef MS_WIN32
|
||||
|
@ -815,7 +815,7 @@ l_get(void *ptr, Py_ssize_t size)
|
|||
long val;
|
||||
memcpy(&val, ptr, sizeof(val));
|
||||
GET_BITFIELD(val, size);
|
||||
return PyInt_FromLong(val);
|
||||
return PyLong_FromLong(val);
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
|
@ -825,7 +825,7 @@ l_get_sw(void *ptr, Py_ssize_t size)
|
|||
memcpy(&val, ptr, sizeof(val));
|
||||
val = SWAP_LONG(val);
|
||||
GET_BITFIELD(val, size);
|
||||
return PyInt_FromLong(val);
|
||||
return PyLong_FromLong(val);
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
|
@ -1173,9 +1173,9 @@ c_set(void *ptr, PyObject *value, Py_ssize_t size)
|
|||
*(char *)ptr = PyBytes_AS_STRING(value)[0];
|
||||
_RET(value);
|
||||
}
|
||||
if (PyInt_Check(value))
|
||||
if (PyLong_Check(value))
|
||||
{
|
||||
long longval = PyInt_AS_LONG(value);
|
||||
long longval = PyLong_AS_LONG(value);
|
||||
if (longval < 0 || longval >= 256)
|
||||
goto error;
|
||||
*(char *)ptr = (char)longval;
|
||||
|
@ -1384,11 +1384,11 @@ z_set(void *ptr, PyObject *value, Py_ssize_t size)
|
|||
return NULL;
|
||||
*(char **)ptr = PyString_AS_STRING(str);
|
||||
return str;
|
||||
} else if (PyInt_Check(value)) {
|
||||
} else if (PyLong_Check(value)) {
|
||||
#if SIZEOF_VOID_P == SIZEOF_LONG_LONG
|
||||
*(char **)ptr = (char *)PyInt_AsUnsignedLongLongMask(value);
|
||||
*(char **)ptr = (char *)PyLong_AsUnsignedLongLongMask(value);
|
||||
#else
|
||||
*(char **)ptr = (char *)PyInt_AsUnsignedLongMask(value);
|
||||
*(char **)ptr = (char *)PyLong_AsUnsignedLongMask(value);
|
||||
#endif
|
||||
_RET(value);
|
||||
}
|
||||
|
@ -1427,11 +1427,11 @@ Z_set(void *ptr, PyObject *value, Py_ssize_t size)
|
|||
Py_INCREF(value);
|
||||
return value;
|
||||
}
|
||||
if (PyInt_Check(value) || PyLong_Check(value)) {
|
||||
if (PyLong_Check(value) || PyLong_Check(value)) {
|
||||
#if SIZEOF_VOID_P == SIZEOF_LONG_LONG
|
||||
*(wchar_t **)ptr = (wchar_t *)PyInt_AsUnsignedLongLongMask(value);
|
||||
*(wchar_t **)ptr = (wchar_t *)PyLong_AsUnsignedLongLongMask(value);
|
||||
#else
|
||||
*(wchar_t **)ptr = (wchar_t *)PyInt_AsUnsignedLongMask(value);
|
||||
*(wchar_t **)ptr = (wchar_t *)PyLong_AsUnsignedLongMask(value);
|
||||
#endif
|
||||
Py_INCREF(Py_None);
|
||||
return Py_None;
|
||||
|
@ -1585,21 +1585,21 @@ P_set(void *ptr, PyObject *value, Py_ssize_t size)
|
|||
_RET(value);
|
||||
}
|
||||
|
||||
if (!PyInt_Check(value) && !PyLong_Check(value)) {
|
||||
if (!PyLong_Check(value) && !PyLong_Check(value)) {
|
||||
PyErr_SetString(PyExc_TypeError,
|
||||
"cannot be converted to pointer");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#if SIZEOF_VOID_P <= SIZEOF_LONG
|
||||
v = (void *)PyInt_AsUnsignedLongMask(value);
|
||||
v = (void *)PyLong_AsUnsignedLongMask(value);
|
||||
#else
|
||||
#ifndef HAVE_LONG_LONG
|
||||
# error "PyLong_AsVoidPtr: sizeof(void*) > sizeof(long), but no long long"
|
||||
#elif SIZEOF_LONG_LONG < SIZEOF_VOID_P
|
||||
# error "PyLong_AsVoidPtr: sizeof(PY_LONG_LONG) < sizeof(void*)"
|
||||
#endif
|
||||
v = (void *)PyInt_AsUnsignedLongLongMask(value);
|
||||
v = (void *)PyLong_AsUnsignedLongLongMask(value);
|
||||
#endif
|
||||
|
||||
if (PyErr_Occurred())
|
||||
|
|
|
@ -311,7 +311,7 @@ StructUnionType_update_stgdict(PyObject *type, PyObject *fields, int isStruct)
|
|||
|
||||
isPacked = PyObject_GetAttrString(type, "_pack_");
|
||||
if (isPacked) {
|
||||
pack = PyInt_AsLong(isPacked);
|
||||
pack = PyLong_AsLong(isPacked);
|
||||
if (pack < 0 || PyErr_Occurred()) {
|
||||
Py_XDECREF(isPacked);
|
||||
PyErr_SetString(PyExc_ValueError,
|
||||
|
|
|
@ -197,7 +197,7 @@ static int
|
|||
PyCurses_ConvertToChtype(PyObject *obj, chtype *ch)
|
||||
{
|
||||
if (PyInt_CheckExact(obj)) {
|
||||
*ch = (chtype) PyInt_AsLong(obj);
|
||||
*ch = (chtype) PyLong_AsLong(obj);
|
||||
} else if(PyString_Check(obj)
|
||||
&& (PyString_Size(obj) == 1)) {
|
||||
*ch = (chtype) *PyString_AsString(obj);
|
||||
|
@ -777,14 +777,14 @@ PyCursesWindow_Enclose(PyCursesWindowObject *self, PyObject *args)
|
|||
if (!PyArg_ParseTuple(args,"ii;y,x", &y, &x))
|
||||
return NULL;
|
||||
|
||||
return PyInt_FromLong( wenclose(self->win,y,x) );
|
||||
return PyLong_FromLong( wenclose(self->win,y,x) );
|
||||
}
|
||||
#endif
|
||||
|
||||
static PyObject *
|
||||
PyCursesWindow_GetBkgd(PyCursesWindowObject *self)
|
||||
{
|
||||
return PyInt_FromLong((long) getbkgd(self->win));
|
||||
return PyLong_FromLong((long) getbkgd(self->win));
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
|
@ -810,7 +810,7 @@ PyCursesWindow_GetCh(PyCursesWindowObject *self, PyObject *args)
|
|||
PyErr_SetString(PyExc_TypeError, "getch requires 0 or 2 arguments");
|
||||
return NULL;
|
||||
}
|
||||
return PyInt_FromLong((long)rtn);
|
||||
return PyLong_FromLong((long)rtn);
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
|
@ -1012,7 +1012,7 @@ PyCursesWindow_InCh(PyCursesWindowObject *self, PyObject *args)
|
|||
PyErr_SetString(PyExc_TypeError, "inch requires 0 or 2 arguments");
|
||||
return NULL;
|
||||
}
|
||||
return PyInt_FromLong((long) rtn);
|
||||
return PyLong_FromLong((long) rtn);
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
|
@ -1679,7 +1679,7 @@ PyCurses_color_pair(PyObject *self, PyObject *args)
|
|||
PyCursesInitialisedColor
|
||||
|
||||
if (!PyArg_ParseTuple(args, "i:color_pair", &n)) return NULL;
|
||||
return PyInt_FromLong((long) (n << 8));
|
||||
return PyLong_FromLong((long) (n << 8));
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
|
@ -1694,7 +1694,7 @@ PyCurses_Curs_Set(PyObject *self, PyObject *args)
|
|||
erg = curs_set(vis);
|
||||
if (erg == ERR) return PyCursesCheckERR(erg, "curs_set");
|
||||
|
||||
return PyInt_FromLong((long) erg);
|
||||
return PyLong_FromLong((long) erg);
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
|
@ -1912,7 +1912,7 @@ PyCurses_InitScr(PyObject *self)
|
|||
where they're not defined until you've called initscr() */
|
||||
#define SetDictInt(string,ch) \
|
||||
do { \
|
||||
PyObject *o = PyInt_FromLong((long) (ch)); \
|
||||
PyObject *o = PyLong_FromLong((long) (ch)); \
|
||||
if (o && PyDict_SetItemString(ModDict, string, o) == 0) { \
|
||||
Py_DECREF(o); \
|
||||
} \
|
||||
|
@ -2269,7 +2269,7 @@ PyCurses_pair_number(PyObject *self, PyObject *args)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
return PyInt_FromLong((long) ((n & A_COLOR) >> 8));
|
||||
return PyLong_FromLong((long) ((n & A_COLOR) >> 8));
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
|
@ -2316,7 +2316,7 @@ update_lines_cols(void)
|
|||
if (!m)
|
||||
return 0;
|
||||
|
||||
o = PyInt_FromLong(LINES);
|
||||
o = PyLong_FromLong(LINES);
|
||||
if (!o) {
|
||||
Py_DECREF(m);
|
||||
return 0;
|
||||
|
@ -2332,7 +2332,7 @@ update_lines_cols(void)
|
|||
return 0;
|
||||
}
|
||||
Py_DECREF(o);
|
||||
o = PyInt_FromLong(COLS);
|
||||
o = PyLong_FromLong(COLS);
|
||||
if (!o) {
|
||||
Py_DECREF(m);
|
||||
return 0;
|
||||
|
@ -2429,10 +2429,10 @@ PyCurses_Start_Color(PyObject *self)
|
|||
code = start_color();
|
||||
if (code != ERR) {
|
||||
initialisedcolors = TRUE;
|
||||
c = PyInt_FromLong((long) COLORS);
|
||||
c = PyLong_FromLong((long) COLORS);
|
||||
PyDict_SetItemString(ModDict, "COLORS", c);
|
||||
Py_DECREF(c);
|
||||
cp = PyInt_FromLong((long) COLOR_PAIRS);
|
||||
cp = PyLong_FromLong((long) COLOR_PAIRS);
|
||||
PyDict_SetItemString(ModDict, "COLOR_PAIRS", cp);
|
||||
Py_DECREF(cp);
|
||||
Py_INCREF(Py_None);
|
||||
|
@ -2453,7 +2453,7 @@ PyCurses_tigetflag(PyObject *self, PyObject *args)
|
|||
if (!PyArg_ParseTuple(args, "z", &capname))
|
||||
return NULL;
|
||||
|
||||
return PyInt_FromLong( (long) tigetflag( capname ) );
|
||||
return PyLong_FromLong( (long) tigetflag( capname ) );
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
|
@ -2466,7 +2466,7 @@ PyCurses_tigetnum(PyObject *self, PyObject *args)
|
|||
if (!PyArg_ParseTuple(args, "z", &capname))
|
||||
return NULL;
|
||||
|
||||
return PyInt_FromLong( (long) tigetnum( capname ) );
|
||||
return PyLong_FromLong( (long) tigetnum( capname ) );
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
|
|
|
@ -677,7 +677,7 @@ element_deepcopy(ElementObject* self, PyObject* args)
|
|||
}
|
||||
|
||||
/* add object to memo dictionary (so deepcopy won't visit it again) */
|
||||
id = PyInt_FromLong((Py_uintptr_t) self);
|
||||
id = PyLong_FromLong((Py_uintptr_t) self);
|
||||
|
||||
i = PyDict_SetItem(memo, id, (PyObject*) element);
|
||||
|
||||
|
|
|
@ -326,7 +326,7 @@ fileio_fileno(PyFileIOObject *self)
|
|||
{
|
||||
if (self->fd < 0)
|
||||
return err_closed();
|
||||
return PyInt_FromLong((long) self->fd);
|
||||
return PyLong_FromLong((long) self->fd);
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
|
@ -388,7 +388,7 @@ fileio_readinto(PyFileIOObject *self, PyObject *args)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
return PyInt_FromSsize_t(n);
|
||||
return PyLong_FromSsize_t(n);
|
||||
}
|
||||
|
||||
#define DEFAULT_BUFFER_SIZE (8*1024)
|
||||
|
@ -521,7 +521,7 @@ fileio_write(PyFileIOObject *self, PyObject *args)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
return PyInt_FromSsize_t(n);
|
||||
return PyLong_FromSsize_t(n);
|
||||
}
|
||||
|
||||
/* XXX Windows support below is likely incomplete */
|
||||
|
@ -561,10 +561,10 @@ portable_lseek(int fd, PyObject *posobj, int whence)
|
|||
return NULL;
|
||||
}
|
||||
#if !defined(HAVE_LARGEFILE_SUPPORT)
|
||||
pos = PyInt_AsLong(posobj);
|
||||
pos = PyLong_AsLong(posobj);
|
||||
#else
|
||||
pos = PyLong_Check(posobj) ?
|
||||
PyLong_AsLongLong(posobj) : PyInt_AsLong(posobj);
|
||||
PyLong_AsLongLong(posobj) : PyLong_AsLong(posobj);
|
||||
#endif
|
||||
if (PyErr_Occurred())
|
||||
return NULL;
|
||||
|
@ -581,7 +581,7 @@ portable_lseek(int fd, PyObject *posobj, int whence)
|
|||
return PyErr_SetFromErrno(PyExc_IOError);
|
||||
|
||||
#if !defined(HAVE_LARGEFILE_SUPPORT)
|
||||
return PyInt_FromLong(res);
|
||||
return PyLong_FromLong(res);
|
||||
#else
|
||||
return PyLong_FromLongLong(res);
|
||||
#endif
|
||||
|
@ -639,10 +639,10 @@ fileio_truncate(PyFileIOObject *self, PyObject *args)
|
|||
}
|
||||
|
||||
#if !defined(HAVE_LARGEFILE_SUPPORT)
|
||||
pos = PyInt_AsLong(posobj);
|
||||
pos = PyLong_AsLong(posobj);
|
||||
#else
|
||||
pos = PyLong_Check(posobj) ?
|
||||
PyLong_AsLongLong(posobj) : PyInt_AsLong(posobj);
|
||||
PyLong_AsLongLong(posobj) : PyLong_AsLong(posobj);
|
||||
#endif
|
||||
if (PyErr_Occurred()) {
|
||||
Py_DECREF(posobj);
|
||||
|
|
|
@ -203,13 +203,13 @@ static PyMethodDef EVP_methods[] = {
|
|||
static PyObject *
|
||||
EVP_get_block_size(EVPobject *self, void *closure)
|
||||
{
|
||||
return PyInt_FromLong(EVP_MD_CTX_block_size(&((EVPobject *)self)->ctx));
|
||||
return PyLong_FromLong(EVP_MD_CTX_block_size(&((EVPobject *)self)->ctx));
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
EVP_get_digest_size(EVPobject *self, void *closure)
|
||||
{
|
||||
return PyInt_FromLong(EVP_MD_CTX_size(&((EVPobject *)self)->ctx));
|
||||
return PyLong_FromLong(EVP_MD_CTX_size(&((EVPobject *)self)->ctx));
|
||||
}
|
||||
|
||||
static PyMemberDef EVP_members[] = {
|
||||
|
|
|
@ -71,7 +71,7 @@ copy_grouping(char* s)
|
|||
i = -1;
|
||||
do {
|
||||
i++;
|
||||
val = PyInt_FromLong(s[i]);
|
||||
val = PyLong_FromLong(s[i]);
|
||||
if (!val)
|
||||
break;
|
||||
if (PyList_SetItem(result, i, val)) {
|
||||
|
@ -149,7 +149,7 @@ PyLocale_localeconv(PyObject* self)
|
|||
Py_XDECREF(x)
|
||||
|
||||
#define RESULT_INT(i)\
|
||||
x = PyInt_FromLong(l->i);\
|
||||
x = PyLong_FromLong(l->i);\
|
||||
if (!x) goto failed;\
|
||||
PyDict_SetItemString(result, #i, x);\
|
||||
Py_XDECREF(x)
|
||||
|
@ -202,7 +202,7 @@ PyLocale_strcoll(PyObject* self, PyObject* args)
|
|||
|
||||
if (!PyArg_ParseTuple(args, "ss:strcoll", &s1, &s2))
|
||||
return NULL;
|
||||
return PyInt_FromLong(strcoll(s1, s2));
|
||||
return PyLong_FromLong(strcoll(s1, s2));
|
||||
#else
|
||||
PyObject *os1, *os2, *result = NULL;
|
||||
wchar_t *ws1 = NULL, *ws2 = NULL;
|
||||
|
@ -234,7 +234,7 @@ PyLocale_strcoll(PyObject* self, PyObject* args)
|
|||
goto done;
|
||||
ws2[len2 - 1] = 0;
|
||||
/* Collate the strings. */
|
||||
result = PyInt_FromLong(wcscoll(ws1, ws2));
|
||||
result = PyLong_FromLong(wcscoll(ws1, ws2));
|
||||
done:
|
||||
/* Deallocate everything. */
|
||||
if (ws1) PyMem_FREE(ws1);
|
||||
|
@ -628,37 +628,37 @@ init_locale(void)
|
|||
|
||||
d = PyModule_GetDict(m);
|
||||
|
||||
x = PyInt_FromLong(LC_CTYPE);
|
||||
x = PyLong_FromLong(LC_CTYPE);
|
||||
PyDict_SetItemString(d, "LC_CTYPE", x);
|
||||
Py_XDECREF(x);
|
||||
|
||||
x = PyInt_FromLong(LC_TIME);
|
||||
x = PyLong_FromLong(LC_TIME);
|
||||
PyDict_SetItemString(d, "LC_TIME", x);
|
||||
Py_XDECREF(x);
|
||||
|
||||
x = PyInt_FromLong(LC_COLLATE);
|
||||
x = PyLong_FromLong(LC_COLLATE);
|
||||
PyDict_SetItemString(d, "LC_COLLATE", x);
|
||||
Py_XDECREF(x);
|
||||
|
||||
x = PyInt_FromLong(LC_MONETARY);
|
||||
x = PyLong_FromLong(LC_MONETARY);
|
||||
PyDict_SetItemString(d, "LC_MONETARY", x);
|
||||
Py_XDECREF(x);
|
||||
|
||||
#ifdef LC_MESSAGES
|
||||
x = PyInt_FromLong(LC_MESSAGES);
|
||||
x = PyLong_FromLong(LC_MESSAGES);
|
||||
PyDict_SetItemString(d, "LC_MESSAGES", x);
|
||||
Py_XDECREF(x);
|
||||
#endif /* LC_MESSAGES */
|
||||
|
||||
x = PyInt_FromLong(LC_NUMERIC);
|
||||
x = PyLong_FromLong(LC_NUMERIC);
|
||||
PyDict_SetItemString(d, "LC_NUMERIC", x);
|
||||
Py_XDECREF(x);
|
||||
|
||||
x = PyInt_FromLong(LC_ALL);
|
||||
x = PyLong_FromLong(LC_ALL);
|
||||
PyDict_SetItemString(d, "LC_ALL", x);
|
||||
Py_XDECREF(x);
|
||||
|
||||
x = PyInt_FromLong(CHAR_MAX);
|
||||
x = PyLong_FromLong(CHAR_MAX);
|
||||
PyDict_SetItemString(d, "CHAR_MAX", x);
|
||||
Py_XDECREF(x);
|
||||
|
||||
|
|
|
@ -259,7 +259,7 @@ random_seed(RandomObject *self, PyObject *args)
|
|||
masklower = PyLong_FromUnsignedLong(0xffffffffU);
|
||||
if (masklower == NULL)
|
||||
goto Done;
|
||||
thirtytwo = PyInt_FromLong(32L);
|
||||
thirtytwo = PyLong_FromLong(32L);
|
||||
if (thirtytwo == NULL)
|
||||
goto Done;
|
||||
while ((err=PyObject_IsTrue(n))) {
|
||||
|
@ -319,12 +319,12 @@ random_getstate(RandomObject *self)
|
|||
if (state == NULL)
|
||||
return NULL;
|
||||
for (i=0; i<N ; i++) {
|
||||
element = PyInt_FromLong((long)(self->state[i]));
|
||||
element = PyLong_FromLong((long)(self->state[i]));
|
||||
if (element == NULL)
|
||||
goto Fail;
|
||||
PyTuple_SET_ITEM(state, i, element);
|
||||
}
|
||||
element = PyInt_FromLong((long)(self->index));
|
||||
element = PyLong_FromLong((long)(self->index));
|
||||
if (element == NULL)
|
||||
goto Fail;
|
||||
PyTuple_SET_ITEM(state, i, element);
|
||||
|
@ -353,13 +353,13 @@ random_setstate(RandomObject *self, PyObject *state)
|
|||
}
|
||||
|
||||
for (i=0; i<N ; i++) {
|
||||
element = PyInt_AsLong(PyTuple_GET_ITEM(state, i));
|
||||
element = PyLong_AsLong(PyTuple_GET_ITEM(state, i));
|
||||
if (element == -1 && PyErr_Occurred())
|
||||
return NULL;
|
||||
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())
|
||||
return NULL;
|
||||
self->index = (int)element;
|
||||
|
@ -410,14 +410,14 @@ random_jumpahead(RandomObject *self, PyObject *n)
|
|||
|
||||
mt = self->state;
|
||||
for (i = N-1; i > 1; i--) {
|
||||
iobj = PyInt_FromLong(i);
|
||||
iobj = PyLong_FromLong(i);
|
||||
if (iobj == NULL)
|
||||
return NULL;
|
||||
remobj = PyNumber_Remainder(n, iobj);
|
||||
Py_DECREF(iobj);
|
||||
if (remobj == NULL)
|
||||
return NULL;
|
||||
j = PyInt_AsLong(remobj);
|
||||
j = PyLong_AsLong(remobj);
|
||||
Py_DECREF(remobj);
|
||||
if (j == -1L && PyErr_Occurred())
|
||||
return NULL;
|
||||
|
|
|
@ -420,8 +420,8 @@ void _pysqlite_set_result(sqlite3_context* context, PyObject* py_val)
|
|||
sqlite3_result_null(context);
|
||||
} else if (py_val == Py_None) {
|
||||
sqlite3_result_null(context);
|
||||
} else if (PyInt_Check(py_val)) {
|
||||
longval = PyInt_AsLong(py_val);
|
||||
} else if (PyLong_Check(py_val)) {
|
||||
longval = PyLong_AsLong(py_val);
|
||||
sqlite3_result_int64(context, (PY_LONG_LONG)longval);
|
||||
} else if (PyFloat_Check(py_val)) {
|
||||
sqlite3_result_double(context, PyFloat_AsDouble(py_val));
|
||||
|
@ -458,7 +458,7 @@ PyObject* _pysqlite_build_py_params(sqlite3_context *context, int argc, sqlite3_
|
|||
switch (sqlite3_value_type(argv[i])) {
|
||||
case SQLITE_INTEGER:
|
||||
val_int = sqlite3_value_int64(cur_value);
|
||||
cur_py_value = PyInt_FromLong((long)val_int);
|
||||
cur_py_value = PyLong_FromLong((long)val_int);
|
||||
break;
|
||||
case SQLITE_FLOAT:
|
||||
cur_py_value = PyFloat_FromDouble(sqlite3_value_double(cur_value));
|
||||
|
@ -734,8 +734,8 @@ static int _authorizer_callback(void* user_arg, int action, const char* arg1, co
|
|||
|
||||
rc = SQLITE_DENY;
|
||||
} else {
|
||||
if (PyInt_Check(ret)) {
|
||||
rc = (int)PyInt_AsLong(ret);
|
||||
if (PyLong_Check(ret)) {
|
||||
rc = (int)PyLong_AsLong(ret);
|
||||
} else {
|
||||
rc = SQLITE_DENY;
|
||||
}
|
||||
|
@ -1036,7 +1036,7 @@ pysqlite_collation_callback(
|
|||
goto finally;
|
||||
}
|
||||
|
||||
result = PyInt_AsLong(retval);
|
||||
result = PyLong_AsLong(retval);
|
||||
if (PyErr_Occurred()) {
|
||||
result = 0;
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
#include "util.h"
|
||||
#include "sqlitecompat.h"
|
||||
|
||||
/* used to decide wether to call PyInt_FromLong or PyLong_FromLongLong */
|
||||
/* used to decide wether to call PyLong_FromLong or PyLong_FromLongLong */
|
||||
#ifndef INT32_MIN
|
||||
#define INT32_MIN (-2147483647 - 1)
|
||||
#endif
|
||||
|
@ -101,7 +101,7 @@ int pysqlite_cursor_init(pysqlite_Cursor* self, PyObject* args, PyObject* kwargs
|
|||
|
||||
self->arraysize = 1;
|
||||
|
||||
self->rowcount = PyInt_FromLong(-1L);
|
||||
self->rowcount = PyLong_FromLong(-1L);
|
||||
if (!self->rowcount) {
|
||||
return -1;
|
||||
}
|
||||
|
@ -344,7 +344,7 @@ PyObject* _pysqlite_fetch_one_row(pysqlite_Cursor* self)
|
|||
if (intval < INT32_MIN || intval > INT32_MAX) {
|
||||
converted = PyLong_FromLongLong(intval);
|
||||
} else {
|
||||
converted = PyInt_FromLong((long)intval);
|
||||
converted = PyLong_FromLong((long)intval);
|
||||
}
|
||||
} else if (coltype == SQLITE_FLOAT) {
|
||||
converted = PyFloat_FromDouble(sqlite3_column_double(self->statement->st, i));
|
||||
|
@ -499,7 +499,7 @@ PyObject* _pysqlite_query_execute(pysqlite_Cursor* self, int multiple, PyObject*
|
|||
self->description = Py_None;
|
||||
|
||||
Py_DECREF(self->rowcount);
|
||||
self->rowcount = PyInt_FromLong(-1L);
|
||||
self->rowcount = PyLong_FromLong(-1L);
|
||||
if (!self->rowcount) {
|
||||
goto error;
|
||||
}
|
||||
|
@ -680,7 +680,7 @@ PyObject* _pysqlite_query_execute(pysqlite_Cursor* self, int multiple, PyObject*
|
|||
rowcount += (long)sqlite3_changes(self->connection->db);
|
||||
Py_END_ALLOW_THREADS
|
||||
Py_DECREF(self->rowcount);
|
||||
self->rowcount = PyInt_FromLong(rowcount);
|
||||
self->rowcount = PyLong_FromLong(rowcount);
|
||||
}
|
||||
|
||||
Py_DECREF(self->lastrowid);
|
||||
|
@ -688,7 +688,7 @@ PyObject* _pysqlite_query_execute(pysqlite_Cursor* self, int multiple, PyObject*
|
|||
Py_BEGIN_ALLOW_THREADS
|
||||
lastrowid = sqlite3_last_insert_rowid(self->connection->db);
|
||||
Py_END_ALLOW_THREADS
|
||||
self->lastrowid = PyInt_FromLong((long)lastrowid);
|
||||
self->lastrowid = PyLong_FromLong((long)lastrowid);
|
||||
} else {
|
||||
Py_INCREF(Py_None);
|
||||
self->lastrowid = Py_None;
|
||||
|
|
|
@ -351,7 +351,7 @@ PyMODINIT_FUNC init_sqlite3(void)
|
|||
|
||||
/* Set integer constants */
|
||||
for (i = 0; _int_constants[i].constant_name != 0; i++) {
|
||||
tmp_obj = PyInt_FromLong(_int_constants[i].constant_value);
|
||||
tmp_obj = PyLong_FromLong(_int_constants[i].constant_value);
|
||||
if (!tmp_obj) {
|
||||
goto error;
|
||||
}
|
||||
|
|
|
@ -2756,8 +2756,8 @@ match_getindex(MatchObject* self, PyObject* index)
|
|||
/* Default value */
|
||||
return 0;
|
||||
|
||||
if (PyInt_Check(index))
|
||||
return PyInt_AsSsize_t(index);
|
||||
if (PyLong_Check(index))
|
||||
return PyLong_AsSsize_t(index);
|
||||
|
||||
i = -1;
|
||||
|
||||
|
@ -2765,7 +2765,7 @@ match_getindex(MatchObject* self, PyObject* index)
|
|||
index = PyObject_GetItem(self->pattern->groupindex, index);
|
||||
if (index) {
|
||||
if (PyLong_Check(index))
|
||||
i = PyInt_AsSsize_t(index);
|
||||
i = PyLong_AsSsize_t(index);
|
||||
Py_DECREF(index);
|
||||
} else
|
||||
PyErr_Clear();
|
||||
|
@ -2957,12 +2957,12 @@ _pair(Py_ssize_t i1, Py_ssize_t i2)
|
|||
if (!pair)
|
||||
return NULL;
|
||||
|
||||
item = PyInt_FromSsize_t(i1);
|
||||
item = PyLong_FromSsize_t(i1);
|
||||
if (!item)
|
||||
goto error;
|
||||
PyTuple_SET_ITEM(pair, 0, item);
|
||||
|
||||
item = PyInt_FromSsize_t(i2);
|
||||
item = PyLong_FromSsize_t(i2);
|
||||
if (!item)
|
||||
goto error;
|
||||
PyTuple_SET_ITEM(pair, 1, item);
|
||||
|
@ -3397,13 +3397,13 @@ PyMODINIT_FUNC init_sre(void)
|
|||
return;
|
||||
d = PyModule_GetDict(m);
|
||||
|
||||
x = PyInt_FromLong(SRE_MAGIC);
|
||||
x = PyLong_FromLong(SRE_MAGIC);
|
||||
if (x) {
|
||||
PyDict_SetItemString(d, "MAGIC", x);
|
||||
Py_DECREF(x);
|
||||
}
|
||||
|
||||
x = PyInt_FromLong(sizeof(SRE_CODE));
|
||||
x = PyLong_FromLong(sizeof(SRE_CODE));
|
||||
if (x) {
|
||||
PyDict_SetItemString(d, "CODESIZE", x);
|
||||
Py_DECREF(x);
|
||||
|
|
|
@ -818,7 +818,7 @@ _decode_certificate (X509 *certificate, int verbose) {
|
|||
}
|
||||
Py_DECREF(issuer);
|
||||
|
||||
version = PyInt_FromLong(X509_get_version(certificate) + 1);
|
||||
version = PyLong_FromLong(X509_get_version(certificate) + 1);
|
||||
if (PyDict_SetItemString(retval, "version", version) < 0) {
|
||||
Py_DECREF(version);
|
||||
goto fail0;
|
||||
|
@ -1039,7 +1039,7 @@ static PyObject *PySSL_cipher (PySSLObject *self) {
|
|||
goto fail0;
|
||||
PyTuple_SET_ITEM(retval, 1, v);
|
||||
}
|
||||
v = PyInt_FromLong(SSL_CIPHER_get_bits(current, NULL));
|
||||
v = PyLong_FromLong(SSL_CIPHER_get_bits(current, NULL));
|
||||
if (v == NULL)
|
||||
goto fail0;
|
||||
PyTuple_SET_ITEM(retval, 2, v);
|
||||
|
@ -1194,7 +1194,7 @@ static PyObject *PySSL_SSLwrite(PySSLObject *self, PyObject *args)
|
|||
}
|
||||
} while (err == SSL_ERROR_WANT_READ || err == SSL_ERROR_WANT_WRITE);
|
||||
if (len > 0)
|
||||
return PyInt_FromLong(len);
|
||||
return PyLong_FromLong(len);
|
||||
else
|
||||
return PySSL_SetError(self, len, __FILE__, __LINE__);
|
||||
}
|
||||
|
@ -1215,7 +1215,7 @@ static PyObject *PySSL_SSLpending(PySSLObject *self)
|
|||
if (count < 0)
|
||||
return PySSL_SetError(self, count, __FILE__, __LINE__);
|
||||
else
|
||||
return PyInt_FromLong(count);
|
||||
return PyLong_FromLong(count);
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(PySSL_SSLpending_doc,
|
||||
|
@ -1240,8 +1240,8 @@ static PyObject *PySSL_SSLread(PySSLObject *self, PyObject *args)
|
|||
if ((buf == NULL) || (buf == Py_None)) {
|
||||
if (!(buf = PyBytes_FromStringAndSize((char *) 0, len)))
|
||||
return NULL;
|
||||
} else if (PyInt_Check(buf)) {
|
||||
len = PyInt_AS_LONG(buf);
|
||||
} else if (PyLong_Check(buf)) {
|
||||
len = PyLong_AS_LONG(buf);
|
||||
if (!(buf = PyBytes_FromStringAndSize((char *) 0, len)))
|
||||
return NULL;
|
||||
} else {
|
||||
|
@ -1336,7 +1336,7 @@ static PyObject *PySSL_SSLread(PySSLObject *self, PyObject *args)
|
|||
Py_DECREF(buf);
|
||||
return res;
|
||||
} else {
|
||||
return PyInt_FromLong(count);
|
||||
return PyLong_FromLong(count);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1408,7 +1408,7 @@ bound on the entropy contained in string. See RFC 1750.");
|
|||
static PyObject *
|
||||
PySSL_RAND_status(PyObject *self)
|
||||
{
|
||||
return PyInt_FromLong(RAND_status());
|
||||
return PyLong_FromLong(RAND_status());
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(PySSL_RAND_status_doc,
|
||||
|
@ -1434,7 +1434,7 @@ PySSL_RAND_egd(PyObject *self, PyObject *arg)
|
|||
"enough data to seed the PRNG");
|
||||
return NULL;
|
||||
}
|
||||
return PyInt_FromLong(bytes);
|
||||
return PyLong_FromLong(bytes);
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(PySSL_RAND_egd_doc,
|
||||
|
|
|
@ -146,7 +146,7 @@ get_pylong(PyObject *v)
|
|||
static int
|
||||
get_long(PyObject *v, long *p)
|
||||
{
|
||||
long x = PyInt_AsLong(v);
|
||||
long x = PyLong_AsLong(v);
|
||||
if (x == -1 && PyErr_Occurred()) {
|
||||
#ifdef PY_STRUCT_FLOAT_COERCE
|
||||
if (PyFloat_Check(v)) {
|
||||
|
@ -445,13 +445,13 @@ nu_char(const char *p, const formatdef *f)
|
|||
static PyObject *
|
||||
nu_byte(const char *p, const formatdef *f)
|
||||
{
|
||||
return PyInt_FromLong((long) *(signed char *)p);
|
||||
return PyLong_FromLong((long) *(signed char *)p);
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
nu_ubyte(const char *p, const formatdef *f)
|
||||
{
|
||||
return PyInt_FromLong((long) *(unsigned char *)p);
|
||||
return PyLong_FromLong((long) *(unsigned char *)p);
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
|
@ -459,7 +459,7 @@ nu_short(const char *p, const formatdef *f)
|
|||
{
|
||||
short x;
|
||||
memcpy((char *)&x, p, sizeof x);
|
||||
return PyInt_FromLong((long)x);
|
||||
return PyLong_FromLong((long)x);
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
|
@ -467,7 +467,7 @@ nu_ushort(const char *p, const formatdef *f)
|
|||
{
|
||||
unsigned short x;
|
||||
memcpy((char *)&x, p, sizeof x);
|
||||
return PyInt_FromLong((long)x);
|
||||
return PyLong_FromLong((long)x);
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
|
@ -475,7 +475,7 @@ nu_int(const char *p, const formatdef *f)
|
|||
{
|
||||
int x;
|
||||
memcpy((char *)&x, p, sizeof x);
|
||||
return PyInt_FromLong((long)x);
|
||||
return PyLong_FromLong((long)x);
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
|
@ -484,10 +484,10 @@ nu_uint(const char *p, const formatdef *f)
|
|||
unsigned int x;
|
||||
memcpy((char *)&x, p, sizeof x);
|
||||
#if (SIZEOF_LONG > SIZEOF_INT)
|
||||
return PyInt_FromLong((long)x);
|
||||
return PyLong_FromLong((long)x);
|
||||
#else
|
||||
if (x <= ((unsigned int)LONG_MAX))
|
||||
return PyInt_FromLong((long)x);
|
||||
return PyLong_FromLong((long)x);
|
||||
return PyLong_FromUnsignedLong((unsigned long)x);
|
||||
#endif
|
||||
}
|
||||
|
@ -497,7 +497,7 @@ nu_long(const char *p, const formatdef *f)
|
|||
{
|
||||
long x;
|
||||
memcpy((char *)&x, p, sizeof x);
|
||||
return PyInt_FromLong(x);
|
||||
return PyLong_FromLong(x);
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
|
@ -506,7 +506,7 @@ nu_ulong(const char *p, const formatdef *f)
|
|||
unsigned long x;
|
||||
memcpy((char *)&x, p, sizeof x);
|
||||
if (x <= LONG_MAX)
|
||||
return PyInt_FromLong((long)x);
|
||||
return PyLong_FromLong((long)x);
|
||||
return PyLong_FromUnsignedLong(x);
|
||||
}
|
||||
|
||||
|
@ -521,7 +521,7 @@ nu_longlong(const char *p, const formatdef *f)
|
|||
PY_LONG_LONG x;
|
||||
memcpy((char *)&x, p, sizeof x);
|
||||
if (x >= LONG_MIN && x <= LONG_MAX)
|
||||
return PyInt_FromLong(Py_SAFE_DOWNCAST(x, PY_LONG_LONG, long));
|
||||
return PyLong_FromLong(Py_SAFE_DOWNCAST(x, PY_LONG_LONG, long));
|
||||
return PyLong_FromLongLong(x);
|
||||
}
|
||||
|
||||
|
@ -531,7 +531,7 @@ nu_ulonglong(const char *p, const formatdef *f)
|
|||
unsigned PY_LONG_LONG x;
|
||||
memcpy((char *)&x, p, sizeof x);
|
||||
if (x <= LONG_MAX)
|
||||
return PyInt_FromLong(Py_SAFE_DOWNCAST(x, unsigned PY_LONG_LONG, long));
|
||||
return PyLong_FromLong(Py_SAFE_DOWNCAST(x, unsigned PY_LONG_LONG, long));
|
||||
return PyLong_FromUnsignedLongLong(x);
|
||||
}
|
||||
|
||||
|
@ -818,7 +818,7 @@ bu_int(const char *p, const formatdef *f)
|
|||
/* Extend the sign bit. */
|
||||
if (SIZEOF_LONG > f->size)
|
||||
x |= -(x & (1L << ((8 * f->size) - 1)));
|
||||
return PyInt_FromLong(x);
|
||||
return PyLong_FromLong(x);
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
|
@ -831,7 +831,7 @@ bu_uint(const char *p, const formatdef *f)
|
|||
x = (x<<8) | *bytes++;
|
||||
} while (--i > 0);
|
||||
if (x <= LONG_MAX)
|
||||
return PyInt_FromLong((long)x);
|
||||
return PyLong_FromLong((long)x);
|
||||
return PyLong_FromUnsignedLong(x);
|
||||
}
|
||||
|
||||
|
@ -849,7 +849,7 @@ bu_longlong(const char *p, const formatdef *f)
|
|||
if (SIZEOF_LONG_LONG > f->size)
|
||||
x |= -(x & ((PY_LONG_LONG)1 << ((8 * f->size) - 1)));
|
||||
if (x >= LONG_MIN && x <= LONG_MAX)
|
||||
return PyInt_FromLong(Py_SAFE_DOWNCAST(x, PY_LONG_LONG, long));
|
||||
return PyLong_FromLong(Py_SAFE_DOWNCAST(x, PY_LONG_LONG, long));
|
||||
return PyLong_FromLongLong(x);
|
||||
#else
|
||||
return _PyLong_FromByteArray((const unsigned char *)p,
|
||||
|
@ -870,7 +870,7 @@ bu_ulonglong(const char *p, const formatdef *f)
|
|||
x = (x<<8) | *bytes++;
|
||||
} while (--i > 0);
|
||||
if (x <= LONG_MAX)
|
||||
return PyInt_FromLong(Py_SAFE_DOWNCAST(x, unsigned PY_LONG_LONG, long));
|
||||
return PyLong_FromLong(Py_SAFE_DOWNCAST(x, unsigned PY_LONG_LONG, long));
|
||||
return PyLong_FromUnsignedLongLong(x);
|
||||
#else
|
||||
return _PyLong_FromByteArray((const unsigned char *)p,
|
||||
|
@ -1054,7 +1054,7 @@ lu_int(const char *p, const formatdef *f)
|
|||
/* Extend the sign bit. */
|
||||
if (SIZEOF_LONG > f->size)
|
||||
x |= -(x & (1L << ((8 * f->size) - 1)));
|
||||
return PyInt_FromLong(x);
|
||||
return PyLong_FromLong(x);
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
|
@ -1067,7 +1067,7 @@ lu_uint(const char *p, const formatdef *f)
|
|||
x = (x<<8) | bytes[--i];
|
||||
} while (i > 0);
|
||||
if (x <= LONG_MAX)
|
||||
return PyInt_FromLong((long)x);
|
||||
return PyLong_FromLong((long)x);
|
||||
return PyLong_FromUnsignedLong((long)x);
|
||||
}
|
||||
|
||||
|
@ -1085,7 +1085,7 @@ lu_longlong(const char *p, const formatdef *f)
|
|||
if (SIZEOF_LONG_LONG > f->size)
|
||||
x |= -(x & ((PY_LONG_LONG)1 << ((8 * f->size) - 1)));
|
||||
if (x >= LONG_MIN && x <= LONG_MAX)
|
||||
return PyInt_FromLong(Py_SAFE_DOWNCAST(x, PY_LONG_LONG, long));
|
||||
return PyLong_FromLong(Py_SAFE_DOWNCAST(x, PY_LONG_LONG, long));
|
||||
return PyLong_FromLongLong(x);
|
||||
#else
|
||||
return _PyLong_FromByteArray((const unsigned char *)p,
|
||||
|
@ -1106,7 +1106,7 @@ lu_ulonglong(const char *p, const formatdef *f)
|
|||
x = (x<<8) | bytes[--i];
|
||||
} while (i > 0);
|
||||
if (x <= LONG_MAX)
|
||||
return PyInt_FromLong(Py_SAFE_DOWNCAST(x, unsigned PY_LONG_LONG, long));
|
||||
return PyLong_FromLong(Py_SAFE_DOWNCAST(x, unsigned PY_LONG_LONG, long));
|
||||
return PyLong_FromUnsignedLongLong(x);
|
||||
#else
|
||||
return _PyLong_FromByteArray((const unsigned char *)p,
|
||||
|
@ -1762,7 +1762,7 @@ s_pack_into(PyObject *self, PyObject *args)
|
|||
assert( buffer_len >= 0 );
|
||||
|
||||
/* Extract the offset from the first argument */
|
||||
offset = PyInt_AsSsize_t(PyTuple_GET_ITEM(args, 1));
|
||||
offset = PyLong_AsSsize_t(PyTuple_GET_ITEM(args, 1));
|
||||
|
||||
/* Support negative offsets. */
|
||||
if (offset < 0)
|
||||
|
@ -1794,7 +1794,7 @@ s_get_format(PyStructObject *self, void *unused)
|
|||
static PyObject *
|
||||
s_get_size(PyStructObject *self, void *unused)
|
||||
{
|
||||
return PyInt_FromSsize_t(self->s_size);
|
||||
return PyLong_FromSsize_t(self->s_size);
|
||||
}
|
||||
|
||||
/* List of functions */
|
||||
|
@ -1876,7 +1876,7 @@ init_struct(void)
|
|||
|
||||
#ifdef PY_STRUCT_OVERFLOW_MASKING
|
||||
if (pyint_zero == NULL) {
|
||||
pyint_zero = PyInt_FromLong(0);
|
||||
pyint_zero = PyLong_FromLong(0);
|
||||
if (pyint_zero == NULL)
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -85,7 +85,7 @@ test_list_api(PyObject *self)
|
|||
return (PyObject*)NULL;
|
||||
/* list = range(NLIST) */
|
||||
for (i = 0; i < NLIST; ++i) {
|
||||
PyObject* anint = PyInt_FromLong(i);
|
||||
PyObject* anint = PyLong_FromLong(i);
|
||||
if (anint == (PyObject*)NULL) {
|
||||
Py_DECREF(list);
|
||||
return (PyObject*)NULL;
|
||||
|
@ -101,7 +101,7 @@ test_list_api(PyObject *self)
|
|||
/* Check that list == range(29, -1, -1) now */
|
||||
for (i = 0; i < NLIST; ++i) {
|
||||
PyObject* anint = PyList_GET_ITEM(list, i);
|
||||
if (PyInt_AS_LONG(anint) != NLIST-1-i) {
|
||||
if (PyLong_AS_LONG(anint) != NLIST-1-i) {
|
||||
PyErr_SetString(TestError,
|
||||
"test_list_api: reverse screwed up");
|
||||
Py_DECREF(list);
|
||||
|
@ -127,7 +127,7 @@ test_dict_inner(int count)
|
|||
return -1;
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
v = PyInt_FromLong(i);
|
||||
v = PyLong_FromLong(i);
|
||||
PyDict_SetItem(dict, v, v);
|
||||
Py_DECREF(v);
|
||||
}
|
||||
|
@ -136,8 +136,8 @@ test_dict_inner(int count)
|
|||
PyObject *o;
|
||||
iterations++;
|
||||
|
||||
i = PyInt_AS_LONG(v) + 1;
|
||||
o = PyInt_FromLong(i);
|
||||
i = PyLong_AS_LONG(v) + 1;
|
||||
o = PyLong_FromLong(i);
|
||||
if (o == NULL)
|
||||
return -1;
|
||||
if (PyDict_SetItem(dict, k, o) < 0) {
|
||||
|
@ -278,7 +278,7 @@ test_L_code(PyObject *self)
|
|||
"L code returned wrong value for long 42");
|
||||
|
||||
Py_DECREF(num);
|
||||
num = PyInt_FromLong(42);
|
||||
num = PyLong_FromLong(42);
|
||||
if (num == NULL)
|
||||
return NULL;
|
||||
|
||||
|
@ -404,7 +404,7 @@ getargs_K(PyObject *self, PyObject *args)
|
|||
#endif
|
||||
|
||||
/* This function not only tests the 'k' getargs code, but also the
|
||||
PyInt_AsUnsignedLongMask() and PyInt_AsUnsignedLongMask() functions. */
|
||||
PyLong_AsUnsignedLongMask() and PyLong_AsUnsignedLongMask() functions. */
|
||||
static PyObject *
|
||||
test_k_code(PyObject *self)
|
||||
{
|
||||
|
@ -420,10 +420,10 @@ test_k_code(PyObject *self)
|
|||
if (num == NULL)
|
||||
return NULL;
|
||||
|
||||
value = PyInt_AsUnsignedLongMask(num);
|
||||
value = PyLong_AsUnsignedLongMask(num);
|
||||
if (value != ULONG_MAX)
|
||||
return raiseTestError("test_k_code",
|
||||
"PyInt_AsUnsignedLongMask() returned wrong value for long 0xFFF...FFF");
|
||||
"PyLong_AsUnsignedLongMask() returned wrong value for long 0xFFF...FFF");
|
||||
|
||||
PyTuple_SET_ITEM(tuple, 0, num);
|
||||
|
||||
|
@ -439,10 +439,10 @@ test_k_code(PyObject *self)
|
|||
if (num == NULL)
|
||||
return NULL;
|
||||
|
||||
value = PyInt_AsUnsignedLongMask(num);
|
||||
value = PyLong_AsUnsignedLongMask(num);
|
||||
if (value != (unsigned long)-0x42)
|
||||
return raiseTestError("test_k_code",
|
||||
"PyInt_AsUnsignedLongMask() returned wrong value for long 0xFFF...FFF");
|
||||
"PyLong_AsUnsignedLongMask() returned wrong value for long 0xFFF...FFF");
|
||||
|
||||
PyTuple_SET_ITEM(tuple, 0, num);
|
||||
|
||||
|
@ -642,7 +642,7 @@ raise_exception(PyObject *self, PyObject *args)
|
|||
if (exc_args == NULL)
|
||||
return NULL;
|
||||
for (i = 0; i < num_args; ++i) {
|
||||
v = PyInt_FromLong(i);
|
||||
v = PyLong_FromLong(i);
|
||||
if (v == NULL) {
|
||||
Py_DECREF(exc_args);
|
||||
return NULL;
|
||||
|
@ -796,7 +796,7 @@ profile_int(PyObject *self, PyObject* args)
|
|||
gettimeofday(&start, NULL);
|
||||
for(k=0; k < 20000; k++)
|
||||
for(i=0; i < 1000; i++) {
|
||||
single = PyInt_FromLong(i);
|
||||
single = PyLong_FromLong(i);
|
||||
Py_DECREF(single);
|
||||
}
|
||||
gettimeofday(&stop, NULL);
|
||||
|
@ -807,7 +807,7 @@ profile_int(PyObject *self, PyObject* args)
|
|||
gettimeofday(&start, NULL);
|
||||
for(k=0; k < 20000; k++)
|
||||
for(i=0; i < 1000; i++) {
|
||||
single = PyInt_FromLong(i+1000000);
|
||||
single = PyLong_FromLong(i+1000000);
|
||||
Py_DECREF(single);
|
||||
}
|
||||
gettimeofday(&stop, NULL);
|
||||
|
@ -819,7 +819,7 @@ profile_int(PyObject *self, PyObject* args)
|
|||
gettimeofday(&start, NULL);
|
||||
for(k=0; k < 20000; k++) {
|
||||
for(i=0; i < 1000; i++) {
|
||||
multiple[i] = PyInt_FromLong(i+1000000);
|
||||
multiple[i] = PyLong_FromLong(i+1000000);
|
||||
}
|
||||
for(i=0; i < 1000; i++) {
|
||||
Py_DECREF(multiple[i]);
|
||||
|
@ -834,7 +834,7 @@ profile_int(PyObject *self, PyObject* args)
|
|||
gettimeofday(&start, NULL);
|
||||
for(k=0; k < 20; k++) {
|
||||
for(i=0; i < 1000000; i++) {
|
||||
multiple[i] = PyInt_FromLong(i+1000000);
|
||||
multiple[i] = PyLong_FromLong(i+1000000);
|
||||
}
|
||||
for(i=0; i < 1000000; i++) {
|
||||
Py_DECREF(multiple[i]);
|
||||
|
@ -848,7 +848,7 @@ profile_int(PyObject *self, PyObject* args)
|
|||
gettimeofday(&start, NULL);
|
||||
for(k=0; k < 10; k++) {
|
||||
for(i=0; i < 1000000; i++) {
|
||||
multiple[i] = PyInt_FromLong(i+1000);
|
||||
multiple[i] = PyLong_FromLong(i+1000);
|
||||
}
|
||||
for(i=0; i < 1000000; i++) {
|
||||
Py_DECREF(multiple[i]);
|
||||
|
@ -858,7 +858,7 @@ profile_int(PyObject *self, PyObject* args)
|
|||
print_delta(5, &start, &stop);
|
||||
|
||||
/* Test 6: Perform small int addition */
|
||||
op1 = PyInt_FromLong(1);
|
||||
op1 = PyLong_FromLong(1);
|
||||
gettimeofday(&start, NULL);
|
||||
for(i=0; i < 10000000; i++) {
|
||||
result = PyNumber_Add(op1, op1);
|
||||
|
@ -869,7 +869,7 @@ profile_int(PyObject *self, PyObject* args)
|
|||
print_delta(6, &start, &stop);
|
||||
|
||||
/* Test 7: Perform medium int addition */
|
||||
op1 = PyInt_FromLong(1000);
|
||||
op1 = PyLong_FromLong(1000);
|
||||
gettimeofday(&start, NULL);
|
||||
for(i=0; i < 10000000; i++) {
|
||||
result = PyNumber_Add(op1, op1);
|
||||
|
@ -1061,17 +1061,17 @@ init_testcapi(void)
|
|||
Py_INCREF(&test_structmembersType);
|
||||
PyModule_AddObject(m, "test_structmembersType", (PyObject *)&test_structmembersType);
|
||||
|
||||
PyModule_AddObject(m, "CHAR_MAX", PyInt_FromLong(CHAR_MAX));
|
||||
PyModule_AddObject(m, "CHAR_MIN", PyInt_FromLong(CHAR_MIN));
|
||||
PyModule_AddObject(m, "UCHAR_MAX", PyInt_FromLong(UCHAR_MAX));
|
||||
PyModule_AddObject(m, "SHRT_MAX", PyInt_FromLong(SHRT_MAX));
|
||||
PyModule_AddObject(m, "SHRT_MIN", PyInt_FromLong(SHRT_MIN));
|
||||
PyModule_AddObject(m, "USHRT_MAX", PyInt_FromLong(USHRT_MAX));
|
||||
PyModule_AddObject(m, "CHAR_MAX", PyLong_FromLong(CHAR_MAX));
|
||||
PyModule_AddObject(m, "CHAR_MIN", PyLong_FromLong(CHAR_MIN));
|
||||
PyModule_AddObject(m, "UCHAR_MAX", PyLong_FromLong(UCHAR_MAX));
|
||||
PyModule_AddObject(m, "SHRT_MAX", PyLong_FromLong(SHRT_MAX));
|
||||
PyModule_AddObject(m, "SHRT_MIN", PyLong_FromLong(SHRT_MIN));
|
||||
PyModule_AddObject(m, "USHRT_MAX", PyLong_FromLong(USHRT_MAX));
|
||||
PyModule_AddObject(m, "INT_MAX", PyLong_FromLong(INT_MAX));
|
||||
PyModule_AddObject(m, "INT_MIN", PyLong_FromLong(INT_MIN));
|
||||
PyModule_AddObject(m, "UINT_MAX", PyLong_FromUnsignedLong(UINT_MAX));
|
||||
PyModule_AddObject(m, "LONG_MAX", PyInt_FromLong(LONG_MAX));
|
||||
PyModule_AddObject(m, "LONG_MIN", PyInt_FromLong(LONG_MIN));
|
||||
PyModule_AddObject(m, "LONG_MAX", PyLong_FromLong(LONG_MAX));
|
||||
PyModule_AddObject(m, "LONG_MIN", PyLong_FromLong(LONG_MIN));
|
||||
PyModule_AddObject(m, "ULONG_MAX", PyLong_FromUnsignedLong(ULONG_MAX));
|
||||
PyModule_AddObject(m, "FLT_MAX", PyFloat_FromDouble(FLT_MAX));
|
||||
PyModule_AddObject(m, "FLT_MIN", PyFloat_FromDouble(FLT_MIN));
|
||||
|
@ -1080,8 +1080,8 @@ init_testcapi(void)
|
|||
PyModule_AddObject(m, "LLONG_MAX", PyLong_FromLongLong(PY_LLONG_MAX));
|
||||
PyModule_AddObject(m, "LLONG_MIN", PyLong_FromLongLong(PY_LLONG_MIN));
|
||||
PyModule_AddObject(m, "ULLONG_MAX", PyLong_FromUnsignedLongLong(PY_ULLONG_MAX));
|
||||
PyModule_AddObject(m, "PY_SSIZE_T_MAX", PyInt_FromSsize_t(PY_SSIZE_T_MAX));
|
||||
PyModule_AddObject(m, "PY_SSIZE_T_MIN", PyInt_FromSsize_t(PY_SSIZE_T_MIN));
|
||||
PyModule_AddObject(m, "PY_SSIZE_T_MAX", PyLong_FromSsize_t(PY_SSIZE_T_MAX));
|
||||
PyModule_AddObject(m, "PY_SSIZE_T_MIN", PyLong_FromSsize_t(PY_SSIZE_T_MIN));
|
||||
|
||||
TestError = PyErr_NewException("_testcapi.error", NULL, NULL);
|
||||
Py_INCREF(TestError);
|
||||
|
|
|
@ -44,7 +44,7 @@ Copyright (C) 1994 Steen Lumholt.
|
|||
|
||||
#ifndef PyBool_Check
|
||||
#define PyBool_Check(o) 0
|
||||
#define PyBool_FromLong PyInt_FromLong
|
||||
#define PyBool_FromLong PyLong_FromLong
|
||||
#endif
|
||||
|
||||
/* Starting with Tcl 8.4, many APIs offer const-correctness. Unfortunately,
|
||||
|
@ -870,7 +870,7 @@ AsObj(PyObject *value)
|
|||
else if (PyBool_Check(value))
|
||||
return Tcl_NewBooleanObj(PyObject_IsTrue(value));
|
||||
else if (PyInt_CheckExact(value))
|
||||
return Tcl_NewLongObj(PyInt_AS_LONG(value));
|
||||
return Tcl_NewLongObj(PyLong_AS_LONG(value));
|
||||
else if (PyFloat_Check(value))
|
||||
return Tcl_NewDoubleObj(PyFloat_AS_DOUBLE(value));
|
||||
else if (PyTuple_Check(value)) {
|
||||
|
@ -960,7 +960,7 @@ FromObj(PyObject* tkapp, Tcl_Obj *value)
|
|||
}
|
||||
|
||||
if (value->typePtr == app->IntType) {
|
||||
return PyInt_FromLong(value->internalRep.longValue);
|
||||
return PyLong_FromLong(value->internalRep.longValue);
|
||||
}
|
||||
|
||||
if (value->typePtr == app->ListType) {
|
||||
|
@ -1647,7 +1647,7 @@ Tkapp_GetInt(PyObject *self, PyObject *args)
|
|||
|
||||
if (PyTuple_Size(args) == 1) {
|
||||
PyObject* o = PyTuple_GetItem(args, 0);
|
||||
if (PyInt_Check(o)) {
|
||||
if (PyLong_Check(o)) {
|
||||
Py_INCREF(o);
|
||||
return o;
|
||||
}
|
||||
|
@ -1687,7 +1687,7 @@ Tkapp_GetBoolean(PyObject *self, PyObject *args)
|
|||
|
||||
if (PyTuple_Size(args) == 1) {
|
||||
PyObject *o = PyTuple_GetItem(args, 0);
|
||||
if (PyInt_Check(o)) {
|
||||
if (PyLong_Check(o)) {
|
||||
Py_INCREF(o);
|
||||
return o;
|
||||
}
|
||||
|
@ -2527,7 +2527,7 @@ Tkapp_InterpAddr(PyObject *self, PyObject *args)
|
|||
if (!PyArg_ParseTuple(args, ":interpaddr"))
|
||||
return NULL;
|
||||
|
||||
return PyInt_FromLong((long)Tkapp_Interp(self));
|
||||
return PyLong_FromLong((long)Tkapp_Interp(self));
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
|
@ -2856,7 +2856,7 @@ frames in an animation.";
|
|||
static PyObject *
|
||||
Tkinter_getbusywaitinterval(PyObject *self, PyObject *args)
|
||||
{
|
||||
return PyInt_FromLong(Tkinter_busywaitinterval);
|
||||
return PyLong_FromLong(Tkinter_busywaitinterval);
|
||||
}
|
||||
|
||||
static char getbusywaitinterval_doc[] =
|
||||
|
@ -2987,7 +2987,7 @@ DisableEventHook(void)
|
|||
static void
|
||||
ins_long(PyObject *d, char *name, long val)
|
||||
{
|
||||
PyObject *v = PyInt_FromLong(val);
|
||||
PyObject *v = PyLong_FromLong(val);
|
||||
if (v) {
|
||||
PyDict_SetItemString(d, name, v);
|
||||
Py_DECREF(v);
|
||||
|
|
|
@ -17,10 +17,10 @@ weakref_getweakrefcount(PyObject *self, PyObject *object)
|
|||
if (PyType_SUPPORTS_WEAKREFS(Py_Type(object))) {
|
||||
PyWeakReference **list = GET_WEAKREFS_LISTPTR(object);
|
||||
|
||||
result = PyInt_FromSsize_t(_PyWeakref_GetWeakrefCount(*list));
|
||||
result = PyLong_FromSsize_t(_PyWeakref_GetWeakrefCount(*list));
|
||||
}
|
||||
else
|
||||
result = PyInt_FromLong(0);
|
||||
result = PyLong_FromLong(0);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -115,7 +115,7 @@ b_getitem(arrayobject *ap, Py_ssize_t i)
|
|||
long x = ((char *)ap->ob_item)[i];
|
||||
if (x >= 128)
|
||||
x -= 256;
|
||||
return PyInt_FromLong(x);
|
||||
return PyLong_FromLong(x);
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -146,7 +146,7 @@ static PyObject *
|
|||
BB_getitem(arrayobject *ap, Py_ssize_t i)
|
||||
{
|
||||
long x = ((unsigned char *)ap->ob_item)[i];
|
||||
return PyInt_FromLong(x);
|
||||
return PyLong_FromLong(x);
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -189,7 +189,7 @@ u_setitem(arrayobject *ap, Py_ssize_t i, PyObject *v)
|
|||
static PyObject *
|
||||
h_getitem(arrayobject *ap, Py_ssize_t i)
|
||||
{
|
||||
return PyInt_FromLong((long) ((short *)ap->ob_item)[i]);
|
||||
return PyLong_FromLong((long) ((short *)ap->ob_item)[i]);
|
||||
}
|
||||
|
||||
|
||||
|
@ -208,7 +208,7 @@ h_setitem(arrayobject *ap, Py_ssize_t i, PyObject *v)
|
|||
static PyObject *
|
||||
HH_getitem(arrayobject *ap, Py_ssize_t i)
|
||||
{
|
||||
return PyInt_FromLong((long) ((unsigned short *)ap->ob_item)[i]);
|
||||
return PyLong_FromLong((long) ((unsigned short *)ap->ob_item)[i]);
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -237,7 +237,7 @@ HH_setitem(arrayobject *ap, Py_ssize_t i, PyObject *v)
|
|||
static PyObject *
|
||||
i_getitem(arrayobject *ap, Py_ssize_t i)
|
||||
{
|
||||
return PyInt_FromLong((long) ((int *)ap->ob_item)[i]);
|
||||
return PyLong_FromLong((long) ((int *)ap->ob_item)[i]);
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -294,7 +294,7 @@ II_setitem(arrayobject *ap, Py_ssize_t i, PyObject *v)
|
|||
static PyObject *
|
||||
l_getitem(arrayobject *ap, Py_ssize_t i)
|
||||
{
|
||||
return PyInt_FromLong(((long *)ap->ob_item)[i]);
|
||||
return PyLong_FromLong(((long *)ap->ob_item)[i]);
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -899,7 +899,7 @@ array_count(arrayobject *self, PyObject *v)
|
|||
else if (cmp < 0)
|
||||
return NULL;
|
||||
}
|
||||
return PyInt_FromSsize_t(count);
|
||||
return PyLong_FromSsize_t(count);
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(count_doc,
|
||||
|
@ -917,7 +917,7 @@ array_index(arrayobject *self, PyObject *v)
|
|||
int cmp = PyObject_RichCompareBool(selfi, v, Py_EQ);
|
||||
Py_DECREF(selfi);
|
||||
if (cmp > 0) {
|
||||
return PyInt_FromLong((long)i);
|
||||
return PyLong_FromLong((long)i);
|
||||
}
|
||||
else if (cmp < 0)
|
||||
return NULL;
|
||||
|
@ -1043,7 +1043,7 @@ array_buffer_info(arrayobject *self, PyObject *unused)
|
|||
return NULL;
|
||||
|
||||
PyTuple_SET_ITEM(retval, 0, PyLong_FromVoidPtr(self->ob_item));
|
||||
PyTuple_SET_ITEM(retval, 1, PyInt_FromLong((long)(Py_Size(self))));
|
||||
PyTuple_SET_ITEM(retval, 1, PyLong_FromLong((long)(Py_Size(self))));
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
@ -1483,7 +1483,7 @@ array_get_typecode(arrayobject *a, void *closure)
|
|||
static PyObject *
|
||||
array_get_itemsize(arrayobject *a, void *closure)
|
||||
{
|
||||
return PyInt_FromLong((long)a->ob_descr->itemsize);
|
||||
return PyLong_FromLong((long)a->ob_descr->itemsize);
|
||||
}
|
||||
|
||||
static PyGetSetDef array_getsets [] = {
|
||||
|
|
|
@ -315,7 +315,7 @@ audioop_getsample(PyObject *self, PyObject *args)
|
|||
if ( size == 1 ) val = (int)*CHARP(cp, i);
|
||||
else if ( size == 2 ) val = (int)*SHORTP(cp, i*2);
|
||||
else if ( size == 4 ) val = (int)*LONGP(cp, i*4);
|
||||
return PyInt_FromLong(val);
|
||||
return PyLong_FromLong(val);
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
|
@ -339,7 +339,7 @@ audioop_max(PyObject *self, PyObject *args)
|
|||
if ( val < 0 ) val = (-val);
|
||||
if ( val > max ) max = val;
|
||||
}
|
||||
return PyInt_FromLong(max);
|
||||
return PyLong_FromLong(max);
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
|
@ -390,7 +390,7 @@ audioop_avg(PyObject *self, PyObject *args)
|
|||
val = 0;
|
||||
else
|
||||
val = (int)(avg / (double)(len/size));
|
||||
return PyInt_FromLong(val);
|
||||
return PyLong_FromLong(val);
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
|
@ -417,7 +417,7 @@ audioop_rms(PyObject *self, PyObject *args)
|
|||
val = 0;
|
||||
else
|
||||
val = (int)sqrt(sum_squares / (double)(len/size));
|
||||
return PyInt_FromLong(val);
|
||||
return PyLong_FromLong(val);
|
||||
}
|
||||
|
||||
static double _sum2(short *a, short *b, int len)
|
||||
|
@ -599,7 +599,7 @@ audioop_findmax(PyObject *self, PyObject *args)
|
|||
|
||||
}
|
||||
|
||||
return PyInt_FromLong(best_j);
|
||||
return PyLong_FromLong(best_j);
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
|
@ -656,7 +656,7 @@ audioop_avgpp(PyObject *self, PyObject *args)
|
|||
val = 0;
|
||||
else
|
||||
val = (int)(avg / (double)nextreme);
|
||||
return PyInt_FromLong(val);
|
||||
return PyLong_FromLong(val);
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
|
@ -709,7 +709,7 @@ audioop_maxpp(PyObject *self, PyObject *args)
|
|||
if ( diff != 0 )
|
||||
prevdiff = diff;
|
||||
}
|
||||
return PyInt_FromLong(max);
|
||||
return PyLong_FromLong(max);
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
|
@ -736,7 +736,7 @@ audioop_cross(PyObject *self, PyObject *args)
|
|||
if ( val != prevval ) ncross++;
|
||||
prevval = val;
|
||||
}
|
||||
return PyInt_FromLong(ncross);
|
||||
return PyLong_FromLong(ncross);
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
|
|
|
@ -924,7 +924,7 @@ binascii_crc32(PyObject *self, PyObject *args)
|
|||
*/
|
||||
result |= -(result & (1L << 31));
|
||||
#endif
|
||||
return PyInt_FromLong(result);
|
||||
return PyLong_FromLong(result);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -894,10 +894,10 @@ BZ2File_seek(BZ2FileObject *self, PyObject *args)
|
|||
if (!PyArg_ParseTuple(args, "O|i:seek", &offobj, &where))
|
||||
return NULL;
|
||||
#if !defined(HAVE_LARGEFILE_SUPPORT)
|
||||
offset = PyInt_AsLong(offobj);
|
||||
offset = PyLong_AsLong(offobj);
|
||||
#else
|
||||
offset = PyLong_Check(offobj) ?
|
||||
PyLong_AsLongLong(offobj) : PyInt_AsLong(offobj);
|
||||
PyLong_AsLongLong(offobj) : PyLong_AsLong(offobj);
|
||||
#endif
|
||||
if (PyErr_Occurred())
|
||||
return NULL;
|
||||
|
@ -1028,7 +1028,7 @@ BZ2File_tell(BZ2FileObject *self, PyObject *args)
|
|||
}
|
||||
|
||||
#if !defined(HAVE_LARGEFILE_SUPPORT)
|
||||
ret = PyInt_FromLong(self->pos);
|
||||
ret = PyLong_FromLong(self->pos);
|
||||
#else
|
||||
ret = PyLong_FromLongLong(self->pos);
|
||||
#endif
|
||||
|
@ -1102,7 +1102,7 @@ static PyMethodDef BZ2File_methods[] = {
|
|||
static PyObject *
|
||||
BZ2File_get_closed(BZ2FileObject *self, void *closure)
|
||||
{
|
||||
return PyInt_FromLong(self->mode == MODE_CLOSED);
|
||||
return PyLong_FromLong(self->mode == MODE_CLOSED);
|
||||
}
|
||||
|
||||
static PyGetSetDef BZ2File_getset[] = {
|
||||
|
|
|
@ -276,7 +276,7 @@ IO_tell(IOobject *self, PyObject *unused) {
|
|||
|
||||
if (!IO__opencheck(self)) return NULL;
|
||||
|
||||
return PyInt_FromSsize_t(self->pos);
|
||||
return PyLong_FromSsize_t(self->pos);
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(IO_truncate__doc__,
|
||||
|
|
|
@ -65,7 +65,7 @@ make_tuple(PyObject *object, Py_ssize_t len)
|
|||
}
|
||||
PyTuple_SET_ITEM(v, 0, object);
|
||||
|
||||
w = PyInt_FromSsize_t(len);
|
||||
w = PyLong_FromSsize_t(len);
|
||||
if (w == NULL) {
|
||||
Py_DECREF(v);
|
||||
return NULL;
|
||||
|
@ -313,7 +313,7 @@ multibytecodec_encerror(MultibyteCodec *codec,
|
|||
|
||||
if (!PyTuple_Check(retobj) || PyTuple_GET_SIZE(retobj) != 2 ||
|
||||
!PyUnicode_Check((tobj = PyTuple_GET_ITEM(retobj, 0))) ||
|
||||
!PyInt_Check(PyTuple_GET_ITEM(retobj, 1))) {
|
||||
!PyLong_Check(PyTuple_GET_ITEM(retobj, 1))) {
|
||||
PyErr_SetString(PyExc_TypeError,
|
||||
"encoding error handler must return "
|
||||
"(unicode, int) tuple");
|
||||
|
@ -337,7 +337,7 @@ multibytecodec_encerror(MultibyteCodec *codec,
|
|||
memcpy(buf->outbuf, PyString_AS_STRING(retstr), retstrsize);
|
||||
buf->outbuf += retstrsize;
|
||||
|
||||
newpos = PyInt_AsSsize_t(PyTuple_GET_ITEM(retobj, 1));
|
||||
newpos = PyLong_AsSsize_t(PyTuple_GET_ITEM(retobj, 1));
|
||||
if (newpos < 0 && !PyErr_Occurred())
|
||||
newpos += (Py_ssize_t)(buf->inbuf_end - buf->inbuf_top);
|
||||
if (newpos < 0 || buf->inbuf_top + newpos > buf->inbuf_end) {
|
||||
|
@ -432,7 +432,7 @@ multibytecodec_decerror(MultibyteCodec *codec,
|
|||
|
||||
if (!PyTuple_Check(retobj) || PyTuple_GET_SIZE(retobj) != 2 ||
|
||||
!PyUnicode_Check((retuni = PyTuple_GET_ITEM(retobj, 0))) ||
|
||||
!PyInt_Check(PyTuple_GET_ITEM(retobj, 1))) {
|
||||
!PyLong_Check(PyTuple_GET_ITEM(retobj, 1))) {
|
||||
PyErr_SetString(PyExc_TypeError,
|
||||
"decoding error handler must return "
|
||||
"(unicode, int) tuple");
|
||||
|
@ -447,7 +447,7 @@ multibytecodec_decerror(MultibyteCodec *codec,
|
|||
buf->outbuf += retunisize;
|
||||
}
|
||||
|
||||
newpos = PyInt_AsSsize_t(PyTuple_GET_ITEM(retobj, 1));
|
||||
newpos = PyLong_AsSsize_t(PyTuple_GET_ITEM(retobj, 1));
|
||||
if (newpos < 0 && !PyErr_Occurred())
|
||||
newpos += (Py_ssize_t)(buf->inbuf_end - buf->inbuf_top);
|
||||
if (newpos < 0 || buf->inbuf_top + newpos > buf->inbuf_end) {
|
||||
|
@ -1317,8 +1317,8 @@ mbstreamreader_read(MultibyteStreamReaderObject *self, PyObject *args)
|
|||
|
||||
if (sizeobj == Py_None || sizeobj == NULL)
|
||||
size = -1;
|
||||
else if (PyInt_Check(sizeobj))
|
||||
size = PyInt_AsSsize_t(sizeobj);
|
||||
else if (PyLong_Check(sizeobj))
|
||||
size = PyLong_AsSsize_t(sizeobj);
|
||||
else {
|
||||
PyErr_SetString(PyExc_TypeError, "arg 1 must be an integer");
|
||||
return NULL;
|
||||
|
@ -1341,8 +1341,8 @@ mbstreamreader_readline(MultibyteStreamReaderObject *self, PyObject *args)
|
|||
|
||||
if (sizeobj == Py_None || sizeobj == NULL)
|
||||
size = -1;
|
||||
else if (PyInt_Check(sizeobj))
|
||||
size = PyInt_AsSsize_t(sizeobj);
|
||||
else if (PyLong_Check(sizeobj))
|
||||
size = PyLong_AsSsize_t(sizeobj);
|
||||
else {
|
||||
PyErr_SetString(PyExc_TypeError, "arg 1 must be an integer");
|
||||
return NULL;
|
||||
|
@ -1365,8 +1365,8 @@ mbstreamreader_readlines(MultibyteStreamReaderObject *self, PyObject *args)
|
|||
|
||||
if (sizehintobj == Py_None || sizehintobj == NULL)
|
||||
sizehint = -1;
|
||||
else if (PyInt_Check(sizehintobj))
|
||||
sizehint = PyInt_AsSsize_t(sizehintobj);
|
||||
else if (PyLong_Check(sizehintobj))
|
||||
sizehint = PyLong_AsSsize_t(sizehintobj);
|
||||
else {
|
||||
PyErr_SetString(PyExc_TypeError, "arg 1 must be an integer");
|
||||
return NULL;
|
||||
|
|
|
@ -1220,8 +1220,8 @@ wrap_strftime(PyObject *object, PyObject *format, PyObject *timetuple,
|
|||
long year;
|
||||
PyObject *pyyear = PySequence_GetItem(timetuple, 0);
|
||||
if (pyyear == NULL) return NULL;
|
||||
assert(PyInt_Check(pyyear));
|
||||
year = PyInt_AsLong(pyyear);
|
||||
assert(PyLong_Check(pyyear));
|
||||
year = PyLong_AsLong(pyyear);
|
||||
Py_DECREF(pyyear);
|
||||
if (year < 1900) {
|
||||
PyErr_Format(PyExc_ValueError, "year=%ld is before "
|
||||
|
@ -1465,7 +1465,7 @@ delta_to_microseconds(PyDateTime_Delta *self)
|
|||
PyObject *x3 = NULL;
|
||||
PyObject *result = NULL;
|
||||
|
||||
x1 = PyInt_FromLong(GET_TD_DAYS(self));
|
||||
x1 = PyLong_FromLong(GET_TD_DAYS(self));
|
||||
if (x1 == NULL)
|
||||
goto Done;
|
||||
x2 = PyNumber_Multiply(x1, seconds_per_day); /* days in seconds */
|
||||
|
@ -1475,7 +1475,7 @@ delta_to_microseconds(PyDateTime_Delta *self)
|
|||
x1 = NULL;
|
||||
|
||||
/* x2 has days in seconds */
|
||||
x1 = PyInt_FromLong(GET_TD_SECONDS(self)); /* seconds */
|
||||
x1 = PyLong_FromLong(GET_TD_SECONDS(self)); /* seconds */
|
||||
if (x1 == NULL)
|
||||
goto Done;
|
||||
x3 = PyNumber_Add(x1, x2); /* days and seconds in seconds */
|
||||
|
@ -1493,7 +1493,7 @@ delta_to_microseconds(PyDateTime_Delta *self)
|
|||
x3 = NULL;
|
||||
|
||||
/* x1 has days+seconds in us */
|
||||
x2 = PyInt_FromLong(GET_TD_MICROSECONDS(self));
|
||||
x2 = PyLong_FromLong(GET_TD_MICROSECONDS(self));
|
||||
if (x2 == NULL)
|
||||
goto Done;
|
||||
result = PyNumber_Add(x1, x2);
|
||||
|
@ -1902,7 +1902,7 @@ delta_new(PyTypeObject *type, PyObject *args, PyObject *kw)
|
|||
&ms, &minute, &hour, &week) == 0)
|
||||
goto Done;
|
||||
|
||||
x = PyInt_FromLong(0);
|
||||
x = PyLong_FromLong(0);
|
||||
if (x == NULL)
|
||||
goto Done;
|
||||
|
||||
|
@ -2149,19 +2149,19 @@ static PyTypeObject PyDateTime_DeltaType = {
|
|||
static PyObject *
|
||||
date_year(PyDateTime_Date *self, void *unused)
|
||||
{
|
||||
return PyInt_FromLong(GET_YEAR(self));
|
||||
return PyLong_FromLong(GET_YEAR(self));
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
date_month(PyDateTime_Date *self, void *unused)
|
||||
{
|
||||
return PyInt_FromLong(GET_MONTH(self));
|
||||
return PyLong_FromLong(GET_MONTH(self));
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
date_day(PyDateTime_Date *self, void *unused)
|
||||
{
|
||||
return PyInt_FromLong(GET_DAY(self));
|
||||
return PyLong_FromLong(GET_DAY(self));
|
||||
}
|
||||
|
||||
static PyGetSetDef date_getset[] = {
|
||||
|
@ -2456,7 +2456,7 @@ date_isoweekday(PyDateTime_Date *self)
|
|||
{
|
||||
int dow = weekday(GET_YEAR(self), GET_MONTH(self), GET_DAY(self));
|
||||
|
||||
return PyInt_FromLong(dow + 1);
|
||||
return PyLong_FromLong(dow + 1);
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
|
@ -2563,7 +2563,7 @@ date_hash(PyDateTime_Date *self)
|
|||
static PyObject *
|
||||
date_toordinal(PyDateTime_Date *self)
|
||||
{
|
||||
return PyInt_FromLong(ymd_to_ord(GET_YEAR(self), GET_MONTH(self),
|
||||
return PyLong_FromLong(ymd_to_ord(GET_YEAR(self), GET_MONTH(self),
|
||||
GET_DAY(self)));
|
||||
}
|
||||
|
||||
|
@ -2572,7 +2572,7 @@ date_weekday(PyDateTime_Date *self)
|
|||
{
|
||||
int dow = weekday(GET_YEAR(self), GET_MONTH(self), GET_DAY(self));
|
||||
|
||||
return PyInt_FromLong(dow);
|
||||
return PyLong_FromLong(dow);
|
||||
}
|
||||
|
||||
/* Pickle support, a simple use of __reduce__. */
|
||||
|
@ -2975,26 +2975,26 @@ static PyTypeObject PyDateTime_TZInfoType = {
|
|||
static PyObject *
|
||||
time_hour(PyDateTime_Time *self, void *unused)
|
||||
{
|
||||
return PyInt_FromLong(TIME_GET_HOUR(self));
|
||||
return PyLong_FromLong(TIME_GET_HOUR(self));
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
time_minute(PyDateTime_Time *self, void *unused)
|
||||
{
|
||||
return PyInt_FromLong(TIME_GET_MINUTE(self));
|
||||
return PyLong_FromLong(TIME_GET_MINUTE(self));
|
||||
}
|
||||
|
||||
/* The name time_second conflicted with some platform header file. */
|
||||
static PyObject *
|
||||
py_time_second(PyDateTime_Time *self, void *unused)
|
||||
{
|
||||
return PyInt_FromLong(TIME_GET_SECOND(self));
|
||||
return PyLong_FromLong(TIME_GET_SECOND(self));
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
time_microsecond(PyDateTime_Time *self, void *unused)
|
||||
{
|
||||
return PyInt_FromLong(TIME_GET_MICROSECOND(self));
|
||||
return PyLong_FromLong(TIME_GET_MICROSECOND(self));
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
|
@ -3505,25 +3505,25 @@ static PyTypeObject PyDateTime_TimeType = {
|
|||
static PyObject *
|
||||
datetime_hour(PyDateTime_DateTime *self, void *unused)
|
||||
{
|
||||
return PyInt_FromLong(DATE_GET_HOUR(self));
|
||||
return PyLong_FromLong(DATE_GET_HOUR(self));
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
datetime_minute(PyDateTime_DateTime *self, void *unused)
|
||||
{
|
||||
return PyInt_FromLong(DATE_GET_MINUTE(self));
|
||||
return PyLong_FromLong(DATE_GET_MINUTE(self));
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
datetime_second(PyDateTime_DateTime *self, void *unused)
|
||||
{
|
||||
return PyInt_FromLong(DATE_GET_SECOND(self));
|
||||
return PyLong_FromLong(DATE_GET_SECOND(self));
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
datetime_microsecond(PyDateTime_DateTime *self, void *unused)
|
||||
{
|
||||
return PyInt_FromLong(DATE_GET_MICROSECOND(self));
|
||||
return PyLong_FromLong(DATE_GET_MICROSECOND(self));
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
|
@ -3837,7 +3837,7 @@ datetime_strptime(PyObject *cls, PyObject *args)
|
|||
return NULL;
|
||||
}
|
||||
if (PyInt_CheckExact(p))
|
||||
ia[i] = PyInt_AsLong(p);
|
||||
ia[i] = PyLong_AsLong(p);
|
||||
else
|
||||
good_timetuple = 0;
|
||||
Py_DECREF(p);
|
||||
|
@ -4753,11 +4753,11 @@ initdatetime(void)
|
|||
assert(DI100Y == 25 * DI4Y - 1);
|
||||
assert(DI100Y == days_before_year(100+1));
|
||||
|
||||
us_per_us = PyInt_FromLong(1);
|
||||
us_per_ms = PyInt_FromLong(1000);
|
||||
us_per_second = PyInt_FromLong(1000000);
|
||||
us_per_minute = PyInt_FromLong(60000000);
|
||||
seconds_per_day = PyInt_FromLong(24 * 3600);
|
||||
us_per_us = PyLong_FromLong(1);
|
||||
us_per_ms = PyLong_FromLong(1000);
|
||||
us_per_second = PyLong_FromLong(1000000);
|
||||
us_per_minute = PyLong_FromLong(60000000);
|
||||
seconds_per_day = PyLong_FromLong(24 * 3600);
|
||||
if (us_per_us == NULL || us_per_ms == NULL || us_per_second == NULL ||
|
||||
us_per_minute == NULL || seconds_per_day == NULL)
|
||||
return;
|
||||
|
|
|
@ -70,7 +70,7 @@ dl_sym(dlobject *xp, PyObject *args)
|
|||
Py_INCREF(Py_None);
|
||||
return Py_None;
|
||||
}
|
||||
return PyInt_FromLong((long)func);
|
||||
return PyLong_FromLong((long)func);
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
|
@ -107,8 +107,8 @@ dl_call(dlobject *xp, PyObject *args)
|
|||
}
|
||||
for (i = 1; i < n; i++) {
|
||||
PyObject *v = PyTuple_GetItem(args, i);
|
||||
if (PyInt_Check(v)) {
|
||||
alist[i-1] = PyInt_AsLong(v);
|
||||
if (PyLong_Check(v)) {
|
||||
alist[i-1] = PyLong_AsLong(v);
|
||||
if (alist[i-1] == -1 && PyErr_Occurred())
|
||||
return NULL;
|
||||
} else if (PyUnicode_Check(v))
|
||||
|
@ -125,7 +125,7 @@ dl_call(dlobject *xp, PyObject *args)
|
|||
alist[i-1] = 0;
|
||||
res = (*func)(alist[0], alist[1], alist[2], alist[3], alist[4],
|
||||
alist[5], alist[6], alist[7], alist[8], alist[9]);
|
||||
return PyInt_FromLong(res);
|
||||
return PyLong_FromLong(res);
|
||||
}
|
||||
|
||||
static PyMethodDef dlobject_methods[] = {
|
||||
|
@ -225,7 +225,7 @@ static PyMethodDef dl_methods[] = {
|
|||
static void
|
||||
insint(PyObject *d, char *name, int value)
|
||||
{
|
||||
PyObject *v = PyInt_FromLong((long) value);
|
||||
PyObject *v = PyLong_FromLong((long) value);
|
||||
if (!v || PyDict_SetItemString(d, name, v))
|
||||
PyErr_Clear();
|
||||
|
||||
|
@ -249,7 +249,7 @@ initdl(void)
|
|||
d = PyModule_GetDict(m);
|
||||
Dlerror = x = PyErr_NewException("dl.error", NULL, NULL);
|
||||
PyDict_SetItemString(d, "error", x);
|
||||
x = PyInt_FromLong((long)RTLD_LAZY);
|
||||
x = PyLong_FromLong((long)RTLD_LAZY);
|
||||
PyDict_SetItemString(d, "RTLD_LAZY", x);
|
||||
#define INSINT(X) insint(d,#X,X)
|
||||
#ifdef RTLD_NOW
|
||||
|
|
|
@ -22,7 +22,7 @@ static void
|
|||
_inscode(PyObject *d, PyObject *de, const char *name, int code)
|
||||
{
|
||||
PyObject *u = PyUnicode_FromString(name);
|
||||
PyObject *v = PyInt_FromLong((long) code);
|
||||
PyObject *v = PyLong_FromLong((long) code);
|
||||
|
||||
/* Don't bother checking for errors; they'll be caught at the end
|
||||
* of the module initialization function by the caller of
|
||||
|
|
|
@ -73,7 +73,7 @@ fcntl_fcntl(PyObject *self, PyObject *args)
|
|||
PyErr_SetFromErrno(PyExc_IOError);
|
||||
return NULL;
|
||||
}
|
||||
return PyInt_FromLong((long)ret);
|
||||
return PyLong_FromLong((long)ret);
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(fcntl_doc,
|
||||
|
@ -152,7 +152,7 @@ fcntl_ioctl(PyObject *self, PyObject *args)
|
|||
return NULL;
|
||||
}
|
||||
if (mutate_arg) {
|
||||
return PyInt_FromLong(ret);
|
||||
return PyLong_FromLong(ret);
|
||||
}
|
||||
else {
|
||||
return PyString_FromStringAndSize(buf, len);
|
||||
|
@ -198,7 +198,7 @@ fcntl_ioctl(PyObject *self, PyObject *args)
|
|||
PyErr_SetFromErrno(PyExc_IOError);
|
||||
return NULL;
|
||||
}
|
||||
return PyInt_FromLong((long)ret);
|
||||
return PyLong_FromLong((long)ret);
|
||||
#undef IOCTL_BUFSZ
|
||||
}
|
||||
|
||||
|
@ -333,22 +333,22 @@ fcntl_lockf(PyObject *self, PyObject *args)
|
|||
l.l_start = l.l_len = 0;
|
||||
if (startobj != NULL) {
|
||||
#if !defined(HAVE_LARGEFILE_SUPPORT)
|
||||
l.l_start = PyInt_AsLong(startobj);
|
||||
l.l_start = PyLong_AsLong(startobj);
|
||||
#else
|
||||
l.l_start = PyLong_Check(startobj) ?
|
||||
PyLong_AsLongLong(startobj) :
|
||||
PyInt_AsLong(startobj);
|
||||
PyLong_AsLong(startobj);
|
||||
#endif
|
||||
if (PyErr_Occurred())
|
||||
return NULL;
|
||||
}
|
||||
if (lenobj != NULL) {
|
||||
#if !defined(HAVE_LARGEFILE_SUPPORT)
|
||||
l.l_len = PyInt_AsLong(lenobj);
|
||||
l.l_len = PyLong_AsLong(lenobj);
|
||||
#else
|
||||
l.l_len = PyLong_Check(lenobj) ?
|
||||
PyLong_AsLongLong(lenobj) :
|
||||
PyInt_AsLong(lenobj);
|
||||
PyLong_AsLong(lenobj);
|
||||
#endif
|
||||
if (PyErr_Occurred())
|
||||
return NULL;
|
||||
|
@ -414,7 +414,7 @@ a file or socket object.");
|
|||
static int
|
||||
ins(PyObject* d, char* symbol, long value)
|
||||
{
|
||||
PyObject* v = PyInt_FromLong(value);
|
||||
PyObject* v = PyLong_FromLong(value);
|
||||
if (!v || PyDict_SetItemString(d, symbol, v) < 0)
|
||||
return -1;
|
||||
|
||||
|
|
|
@ -944,7 +944,7 @@ gc_collect(PyObject *self, PyObject *args, PyObject *kws)
|
|||
collecting = 0;
|
||||
}
|
||||
|
||||
return PyInt_FromSsize_t(n);
|
||||
return PyLong_FromSsize_t(n);
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(gc_set_debug__doc__,
|
||||
|
|
|
@ -70,7 +70,7 @@ mkgrent(struct group *p)
|
|||
Py_INCREF(Py_None);
|
||||
}
|
||||
#endif
|
||||
SET(setIndex++, PyInt_FromLong((long) p->gr_gid));
|
||||
SET(setIndex++, PyLong_FromLong((long) p->gr_gid));
|
||||
SET(setIndex++, w);
|
||||
#undef SET
|
||||
|
||||
|
@ -93,7 +93,7 @@ grp_getgrgid(PyObject *self, PyObject *pyo_id)
|
|||
py_int_id = PyNumber_Int(pyo_id);
|
||||
if (!py_int_id)
|
||||
return NULL;
|
||||
gid = PyInt_AS_LONG(py_int_id);
|
||||
gid = PyLong_AS_LONG(py_int_id);
|
||||
Py_DECREF(py_int_id);
|
||||
|
||||
if ((p = getgrgid(gid)) == NULL) {
|
||||
|
|
|
@ -1122,7 +1122,7 @@ islice_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
|
|||
numargs = PyTuple_Size(args);
|
||||
if (numargs == 2) {
|
||||
if (a1 != Py_None) {
|
||||
stop = PyInt_AsSsize_t(a1);
|
||||
stop = PyLong_AsSsize_t(a1);
|
||||
if (stop == -1) {
|
||||
if (PyErr_Occurred())
|
||||
PyErr_Clear();
|
||||
|
@ -1133,11 +1133,11 @@ islice_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
|
|||
}
|
||||
} else {
|
||||
if (a1 != Py_None)
|
||||
start = PyInt_AsSsize_t(a1);
|
||||
start = PyLong_AsSsize_t(a1);
|
||||
if (start == -1 && PyErr_Occurred())
|
||||
PyErr_Clear();
|
||||
if (a2 != Py_None) {
|
||||
stop = PyInt_AsSsize_t(a2);
|
||||
stop = PyLong_AsSsize_t(a2);
|
||||
if (stop == -1) {
|
||||
if (PyErr_Occurred())
|
||||
PyErr_Clear();
|
||||
|
@ -1155,7 +1155,7 @@ islice_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
|
|||
|
||||
if (a3 != NULL) {
|
||||
if (a3 != Py_None)
|
||||
step = PyInt_AsSsize_t(a3);
|
||||
step = PyLong_AsSsize_t(a3);
|
||||
if (step == -1 && PyErr_Occurred())
|
||||
PyErr_Clear();
|
||||
}
|
||||
|
@ -2052,7 +2052,7 @@ count_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
|
|||
return NULL;
|
||||
|
||||
if (cnt_arg != NULL) {
|
||||
cnt = PyInt_AsSsize_t(cnt_arg);
|
||||
cnt = PyLong_AsSsize_t(cnt_arg);
|
||||
if (cnt == -1 && PyErr_Occurred()) {
|
||||
PyErr_Clear();
|
||||
if (!PyLong_Check(cnt_arg)) {
|
||||
|
@ -2092,12 +2092,12 @@ count_nextlong(countobject *lz)
|
|||
PyObject *stepped_up;
|
||||
|
||||
if (lz->long_cnt == NULL) {
|
||||
lz->long_cnt = PyInt_FromSsize_t(PY_SSIZE_T_MAX);
|
||||
lz->long_cnt = PyLong_FromSsize_t(PY_SSIZE_T_MAX);
|
||||
if (lz->long_cnt == NULL)
|
||||
return NULL;
|
||||
}
|
||||
if (one == NULL) {
|
||||
one = PyInt_FromLong(1);
|
||||
one = PyLong_FromLong(1);
|
||||
if (one == NULL)
|
||||
return NULL;
|
||||
}
|
||||
|
@ -2115,7 +2115,7 @@ count_next(countobject *lz)
|
|||
{
|
||||
if (lz->cnt == PY_SSIZE_T_MAX)
|
||||
return count_nextlong(lz);
|
||||
return PyInt_FromSsize_t(lz->cnt++);
|
||||
return PyLong_FromSsize_t(lz->cnt++);
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
|
@ -2440,7 +2440,7 @@ repeat_len(repeatobject *ro)
|
|||
PyErr_SetString(PyExc_TypeError, "len() of unsized object");
|
||||
return NULL;
|
||||
}
|
||||
return PyInt_FromSize_t(ro->cnt);
|
||||
return PyLong_FromSize_t(ro->cnt);
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(length_hint_doc, "Private method returning an estimate of len(list(it)).");
|
||||
|
|
|
@ -434,7 +434,7 @@ static PyMethodDef MD5_methods[] = {
|
|||
static PyObject *
|
||||
MD5_get_block_size(PyObject *self, void *closure)
|
||||
{
|
||||
return PyInt_FromLong(MD5_BLOCKSIZE);
|
||||
return PyLong_FromLong(MD5_BLOCKSIZE);
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
|
@ -446,7 +446,7 @@ MD5_get_name(PyObject *self, void *closure)
|
|||
static PyObject *
|
||||
md5_get_digest_size(PyObject *self, void *closure)
|
||||
{
|
||||
return PyInt_FromLong(MD5_DIGESTSIZE);
|
||||
return PyLong_FromLong(MD5_DIGESTSIZE);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -280,10 +280,10 @@ mmap_find_method(mmap_object *self,
|
|||
for (i = 0; i < len && needle[i] == p[i]; ++i)
|
||||
/* nothing */;
|
||||
if (i == len) {
|
||||
return PyInt_FromSsize_t(p - self->data);
|
||||
return PyLong_FromSsize_t(p - self->data);
|
||||
}
|
||||
}
|
||||
return PyInt_FromLong(-1);
|
||||
return PyLong_FromLong(-1);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -373,11 +373,11 @@ mmap_size_method(mmap_object *self,
|
|||
return PyErr_SetFromWindowsErr(error);
|
||||
}
|
||||
if (!high && low < LONG_MAX)
|
||||
return PyInt_FromLong((long)low);
|
||||
return PyLong_FromLong((long)low);
|
||||
size = (((PY_LONG_LONG)high)<<32) + low;
|
||||
return PyLong_FromLongLong(size);
|
||||
} else {
|
||||
return PyInt_FromSsize_t(self->size);
|
||||
return PyLong_FromSsize_t(self->size);
|
||||
}
|
||||
#endif /* MS_WINDOWS */
|
||||
|
||||
|
@ -388,7 +388,7 @@ mmap_size_method(mmap_object *self,
|
|||
PyErr_SetFromErrno(mmap_module_error);
|
||||
return NULL;
|
||||
}
|
||||
return PyInt_FromSsize_t(buf.st_size);
|
||||
return PyLong_FromSsize_t(buf.st_size);
|
||||
}
|
||||
#endif /* UNIX */
|
||||
}
|
||||
|
@ -501,7 +501,7 @@ static PyObject *
|
|||
mmap_tell_method(mmap_object *self, PyObject *unused)
|
||||
{
|
||||
CHECK_VALID(NULL);
|
||||
return PyInt_FromSize_t(self->pos);
|
||||
return PyLong_FromSize_t(self->pos);
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
|
@ -517,7 +517,7 @@ mmap_flush_method(mmap_object *self, PyObject *args)
|
|||
return NULL;
|
||||
} else {
|
||||
#ifdef MS_WINDOWS
|
||||
return PyInt_FromLong((long)
|
||||
return PyLong_FromLong((long)
|
||||
FlushViewOfFile(self->data+offset, size));
|
||||
#endif /* MS_WINDOWS */
|
||||
#ifdef UNIX
|
||||
|
@ -529,7 +529,7 @@ mmap_flush_method(mmap_object *self, PyObject *args)
|
|||
PyErr_SetFromErrno(mmap_module_error);
|
||||
return NULL;
|
||||
}
|
||||
return PyInt_FromLong(0);
|
||||
return PyLong_FromLong(0);
|
||||
#endif /* UNIX */
|
||||
}
|
||||
}
|
||||
|
@ -676,7 +676,7 @@ mmap_subscript(mmap_object *self, PyObject *item)
|
|||
"mmap index out of range");
|
||||
return NULL;
|
||||
}
|
||||
return PyInt_FromLong(Py_CHARMASK(self->data[i]));
|
||||
return PyLong_FromLong(Py_CHARMASK(self->data[i]));
|
||||
}
|
||||
else if (PySlice_Check(item)) {
|
||||
Py_ssize_t start, stop, step, slicelen;
|
||||
|
@ -1241,7 +1241,7 @@ static struct PyMethodDef mmap_functions[] = {
|
|||
static void
|
||||
setint(PyObject *d, const char *name, long value)
|
||||
{
|
||||
PyObject *o = PyInt_FromLong(value);
|
||||
PyObject *o = PyLong_FromLong(value);
|
||||
if (o && PyDict_SetItemString(d, name, o) == 0) {
|
||||
Py_DECREF(o);
|
||||
}
|
||||
|
|
|
@ -46,13 +46,13 @@ used for special class methods; variants without leading and trailing\n\
|
|||
PyObject *a1, *a2; long r; \
|
||||
if(! PyArg_UnpackTuple(a,#OP,2,2,&a1,&a2)) return NULL; \
|
||||
if(-1 == (r=AOP(a1,a2))) return NULL; \
|
||||
return PyInt_FromLong(r); }
|
||||
return PyLong_FromLong(r); }
|
||||
|
||||
#define spamn2(OP,AOP) static PyObject *OP(PyObject *s, PyObject *a) { \
|
||||
PyObject *a1, *a2; Py_ssize_t r; \
|
||||
if(! PyArg_UnpackTuple(a,#OP,2,2,&a1,&a2)) return NULL; \
|
||||
if(-1 == (r=AOP(a1,a2))) return NULL; \
|
||||
return PyInt_FromSsize_t(r); }
|
||||
return PyLong_FromSsize_t(r); }
|
||||
|
||||
#define spami2b(OP,AOP) static PyObject *OP(PyObject *s, PyObject *a) { \
|
||||
PyObject *a1, *a2; long r; \
|
||||
|
|
|
@ -235,7 +235,7 @@ _do_ioctl_1(int fd, PyObject *args, char *fname, int cmd)
|
|||
|
||||
if (ioctl(fd, cmd, &arg) == -1)
|
||||
return PyErr_SetFromErrno(PyExc_IOError);
|
||||
return PyInt_FromLong(arg);
|
||||
return PyLong_FromLong(arg);
|
||||
}
|
||||
|
||||
|
||||
|
@ -260,7 +260,7 @@ _do_ioctl_1_internal(int fd, PyObject *args, char *fname, int cmd)
|
|||
|
||||
if (ioctl(fd, cmd, &arg) == -1)
|
||||
return PyErr_SetFromErrno(PyExc_IOError);
|
||||
return PyInt_FromLong(arg);
|
||||
return PyLong_FromLong(arg);
|
||||
}
|
||||
|
||||
|
||||
|
@ -320,7 +320,7 @@ oss_getfmts(oss_audio_t *self, PyObject *unused)
|
|||
int mask;
|
||||
if (ioctl(self->fd, SNDCTL_DSP_GETFMTS, &mask) == -1)
|
||||
return PyErr_SetFromErrno(PyExc_IOError);
|
||||
return PyInt_FromLong(mask);
|
||||
return PyLong_FromLong(mask);
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
|
@ -404,7 +404,7 @@ oss_write(oss_audio_t *self, PyObject *args)
|
|||
} else {
|
||||
self->ocount += rv;
|
||||
}
|
||||
return PyInt_FromLong(rv);
|
||||
return PyLong_FromLong(rv);
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
|
@ -472,7 +472,7 @@ oss_close(oss_audio_t *self, PyObject *unused)
|
|||
static PyObject *
|
||||
oss_fileno(oss_audio_t *self, PyObject *unused)
|
||||
{
|
||||
return PyInt_FromLong(self->fd);
|
||||
return PyLong_FromLong(self->fd);
|
||||
}
|
||||
|
||||
|
||||
|
@ -529,9 +529,9 @@ oss_setparameters(oss_audio_t *self, PyObject *args)
|
|||
rv = PyTuple_New(3);
|
||||
if (rv == NULL)
|
||||
return NULL;
|
||||
PyTuple_SET_ITEM(rv, 0, PyInt_FromLong(fmt));
|
||||
PyTuple_SET_ITEM(rv, 1, PyInt_FromLong(channels));
|
||||
PyTuple_SET_ITEM(rv, 2, PyInt_FromLong(rate));
|
||||
PyTuple_SET_ITEM(rv, 0, PyLong_FromLong(fmt));
|
||||
PyTuple_SET_ITEM(rv, 1, PyLong_FromLong(channels));
|
||||
PyTuple_SET_ITEM(rv, 2, PyLong_FromLong(rate));
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
@ -584,7 +584,7 @@ oss_bufsize(oss_audio_t *self, PyObject *unused)
|
|||
PyErr_SetFromErrno(PyExc_IOError);
|
||||
return NULL;
|
||||
}
|
||||
return PyInt_FromLong((ai.fragstotal * ai.fragsize) / (nchannels * ssize));
|
||||
return PyLong_FromLong((ai.fragstotal * ai.fragsize) / (nchannels * ssize));
|
||||
}
|
||||
|
||||
/* obufcount returns the number of samples that are available in the
|
||||
|
@ -603,7 +603,7 @@ oss_obufcount(oss_audio_t *self, PyObject *unused)
|
|||
PyErr_SetFromErrno(PyExc_IOError);
|
||||
return NULL;
|
||||
}
|
||||
return PyInt_FromLong((ai.fragstotal * ai.fragsize - ai.bytes) /
|
||||
return PyLong_FromLong((ai.fragstotal * ai.fragsize - ai.bytes) /
|
||||
(ssize * nchannels));
|
||||
}
|
||||
|
||||
|
@ -623,7 +623,7 @@ oss_obuffree(oss_audio_t *self, PyObject *unused)
|
|||
PyErr_SetFromErrno(PyExc_IOError);
|
||||
return NULL;
|
||||
}
|
||||
return PyInt_FromLong(ai.bytes / (ssize * nchannels));
|
||||
return PyLong_FromLong(ai.bytes / (ssize * nchannels));
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
|
@ -662,7 +662,7 @@ oss_mixer_close(oss_mixer_t *self, PyObject *unused)
|
|||
static PyObject *
|
||||
oss_mixer_fileno(oss_mixer_t *self, PyObject *unused)
|
||||
{
|
||||
return PyInt_FromLong(self->fd);
|
||||
return PyLong_FromLong(self->fd);
|
||||
}
|
||||
|
||||
/* Simple mixer interface methods */
|
||||
|
|
|
@ -89,7 +89,7 @@ node2tuple(node *n, /* node to convert */
|
|||
v = mkseq(1 + NCH(n) + (TYPE(n) == encoding_decl));
|
||||
if (v == NULL)
|
||||
return (v);
|
||||
w = PyInt_FromLong(TYPE(n));
|
||||
w = PyLong_FromLong(TYPE(n));
|
||||
if (w == NULL) {
|
||||
Py_DECREF(v);
|
||||
return ((PyObject*) NULL);
|
||||
|
@ -111,12 +111,12 @@ node2tuple(node *n, /* node to convert */
|
|||
else if (ISTERMINAL(TYPE(n))) {
|
||||
PyObject *result = mkseq(2 + lineno + col_offset);
|
||||
if (result != NULL) {
|
||||
(void) addelem(result, 0, PyInt_FromLong(TYPE(n)));
|
||||
(void) addelem(result, 0, PyLong_FromLong(TYPE(n)));
|
||||
(void) addelem(result, 1, PyUnicode_FromString(STR(n)));
|
||||
if (lineno == 1)
|
||||
(void) addelem(result, 2, PyInt_FromLong(n->n_lineno));
|
||||
(void) addelem(result, 2, PyLong_FromLong(n->n_lineno));
|
||||
if (col_offset == 1)
|
||||
(void) addelem(result, 3, PyInt_FromLong(n->n_col_offset));
|
||||
(void) addelem(result, 3, PyLong_FromLong(n->n_col_offset));
|
||||
}
|
||||
return (result);
|
||||
}
|
||||
|
@ -664,9 +664,9 @@ build_node_children(PyObject *tuple, node *root, int *line_num)
|
|||
if (temp == NULL)
|
||||
ok = 0;
|
||||
else {
|
||||
ok = PyInt_Check(temp);
|
||||
ok = PyLong_Check(temp);
|
||||
if (ok)
|
||||
type = PyInt_AS_LONG(temp);
|
||||
type = PyLong_AS_LONG(temp);
|
||||
Py_DECREF(temp);
|
||||
}
|
||||
}
|
||||
|
@ -702,8 +702,8 @@ build_node_children(PyObject *tuple, node *root, int *line_num)
|
|||
if (len == 3) {
|
||||
PyObject *o = PySequence_GetItem(elem, 2);
|
||||
if (o != NULL) {
|
||||
if (PyInt_Check(o))
|
||||
*line_num = PyInt_AS_LONG(o);
|
||||
if (PyLong_Check(o))
|
||||
*line_num = PyLong_AS_LONG(o);
|
||||
else {
|
||||
PyErr_Format(parser_error,
|
||||
"third item in terminal node must be an"
|
||||
|
@ -774,7 +774,7 @@ build_node_tree(PyObject *tuple)
|
|||
long num = -1;
|
||||
|
||||
if (temp != NULL)
|
||||
num = PyInt_AsLong(temp);
|
||||
num = PyLong_AsLong(temp);
|
||||
Py_XDECREF(temp);
|
||||
if (ISTERMINAL(num)) {
|
||||
/*
|
||||
|
|
|
@ -1281,7 +1281,7 @@ fill_time(PyObject *v, int index, time_t sec, unsigned long nsec)
|
|||
#if SIZEOF_TIME_T > SIZEOF_LONG
|
||||
ival = PyLong_FromLongLong((PY_LONG_LONG)sec);
|
||||
#else
|
||||
ival = PyInt_FromLong((long)sec);
|
||||
ival = PyLong_FromLong((long)sec);
|
||||
#endif
|
||||
if (!ival)
|
||||
return;
|
||||
|
@ -1305,27 +1305,27 @@ _pystat_fromstructstat(STRUCT_STAT *st)
|
|||
if (v == NULL)
|
||||
return NULL;
|
||||
|
||||
PyStructSequence_SET_ITEM(v, 0, PyInt_FromLong((long)st->st_mode));
|
||||
PyStructSequence_SET_ITEM(v, 0, PyLong_FromLong((long)st->st_mode));
|
||||
#ifdef HAVE_LARGEFILE_SUPPORT
|
||||
PyStructSequence_SET_ITEM(v, 1,
|
||||
PyLong_FromLongLong((PY_LONG_LONG)st->st_ino));
|
||||
#else
|
||||
PyStructSequence_SET_ITEM(v, 1, PyInt_FromLong((long)st->st_ino));
|
||||
PyStructSequence_SET_ITEM(v, 1, PyLong_FromLong((long)st->st_ino));
|
||||
#endif
|
||||
#if defined(HAVE_LONG_LONG) && !defined(MS_WINDOWS)
|
||||
PyStructSequence_SET_ITEM(v, 2,
|
||||
PyLong_FromLongLong((PY_LONG_LONG)st->st_dev));
|
||||
#else
|
||||
PyStructSequence_SET_ITEM(v, 2, PyInt_FromLong((long)st->st_dev));
|
||||
PyStructSequence_SET_ITEM(v, 2, PyLong_FromLong((long)st->st_dev));
|
||||
#endif
|
||||
PyStructSequence_SET_ITEM(v, 3, PyInt_FromLong((long)st->st_nlink));
|
||||
PyStructSequence_SET_ITEM(v, 4, PyInt_FromLong((long)st->st_uid));
|
||||
PyStructSequence_SET_ITEM(v, 5, PyInt_FromLong((long)st->st_gid));
|
||||
PyStructSequence_SET_ITEM(v, 3, PyLong_FromLong((long)st->st_nlink));
|
||||
PyStructSequence_SET_ITEM(v, 4, PyLong_FromLong((long)st->st_uid));
|
||||
PyStructSequence_SET_ITEM(v, 5, PyLong_FromLong((long)st->st_gid));
|
||||
#ifdef HAVE_LARGEFILE_SUPPORT
|
||||
PyStructSequence_SET_ITEM(v, 6,
|
||||
PyLong_FromLongLong((PY_LONG_LONG)st->st_size));
|
||||
#else
|
||||
PyStructSequence_SET_ITEM(v, 6, PyInt_FromLong(st->st_size));
|
||||
PyStructSequence_SET_ITEM(v, 6, PyLong_FromLong(st->st_size));
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_STAT_TV_NSEC)
|
||||
|
@ -1349,19 +1349,19 @@ _pystat_fromstructstat(STRUCT_STAT *st)
|
|||
|
||||
#ifdef HAVE_STRUCT_STAT_ST_BLKSIZE
|
||||
PyStructSequence_SET_ITEM(v, ST_BLKSIZE_IDX,
|
||||
PyInt_FromLong((long)st->st_blksize));
|
||||
PyLong_FromLong((long)st->st_blksize));
|
||||
#endif
|
||||
#ifdef HAVE_STRUCT_STAT_ST_BLOCKS
|
||||
PyStructSequence_SET_ITEM(v, ST_BLOCKS_IDX,
|
||||
PyInt_FromLong((long)st->st_blocks));
|
||||
PyLong_FromLong((long)st->st_blocks));
|
||||
#endif
|
||||
#ifdef HAVE_STRUCT_STAT_ST_RDEV
|
||||
PyStructSequence_SET_ITEM(v, ST_RDEV_IDX,
|
||||
PyInt_FromLong((long)st->st_rdev));
|
||||
PyLong_FromLong((long)st->st_rdev));
|
||||
#endif
|
||||
#ifdef HAVE_STRUCT_STAT_ST_GEN
|
||||
PyStructSequence_SET_ITEM(v, ST_GEN_IDX,
|
||||
PyInt_FromLong((long)st->st_gen));
|
||||
PyLong_FromLong((long)st->st_gen));
|
||||
#endif
|
||||
#ifdef HAVE_STRUCT_STAT_ST_BIRTHTIME
|
||||
{
|
||||
|
@ -1376,7 +1376,7 @@ _pystat_fromstructstat(STRUCT_STAT *st)
|
|||
if (_stat_float_times) {
|
||||
val = PyFloat_FromDouble(bsec + 1e-9*bnsec);
|
||||
} else {
|
||||
val = PyInt_FromLong((long)bsec);
|
||||
val = PyLong_FromLong((long)bsec);
|
||||
}
|
||||
PyStructSequence_SET_ITEM(v, ST_BIRTHTIME_IDX,
|
||||
val);
|
||||
|
@ -1384,7 +1384,7 @@ _pystat_fromstructstat(STRUCT_STAT *st)
|
|||
#endif
|
||||
#ifdef HAVE_STRUCT_STAT_ST_FLAGS
|
||||
PyStructSequence_SET_ITEM(v, ST_FLAGS_IDX,
|
||||
PyInt_FromLong((long)st->st_flags));
|
||||
PyLong_FromLong((long)st->st_flags));
|
||||
#endif
|
||||
|
||||
if (PyErr_Occurred()) {
|
||||
|
@ -2528,7 +2528,7 @@ posix_nice(PyObject *self, PyObject *args)
|
|||
if (value == -1 && errno != 0)
|
||||
/* either nice() or getpriority() returned an error */
|
||||
return posix_error();
|
||||
return PyInt_FromLong((long) value);
|
||||
return PyLong_FromLong((long) value);
|
||||
}
|
||||
#endif /* HAVE_NICE */
|
||||
|
||||
|
@ -2631,7 +2631,7 @@ posix_system(PyObject *self, PyObject *args)
|
|||
sts = system(command);
|
||||
#endif
|
||||
Py_END_ALLOW_THREADS
|
||||
return PyInt_FromLong(sts);
|
||||
return PyLong_FromLong(sts);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -2649,7 +2649,7 @@ posix_umask(PyObject *self, PyObject *args)
|
|||
i = (int)umask(i);
|
||||
if (i < 0)
|
||||
return posix_error();
|
||||
return PyInt_FromLong((long)i);
|
||||
return PyLong_FromLong((long)i);
|
||||
}
|
||||
|
||||
|
||||
|
@ -2706,7 +2706,7 @@ extract_time(PyObject *t, long* sec, long* usec)
|
|||
PyObject *intobj = Py_Type(t)->tp_as_number->nb_int(t);
|
||||
if (!intobj)
|
||||
return -1;
|
||||
intval = PyInt_AsLong(intobj);
|
||||
intval = PyLong_AsLong(intobj);
|
||||
Py_DECREF(intobj);
|
||||
if (intval == -1 && PyErr_Occurred())
|
||||
return -1;
|
||||
|
@ -2718,7 +2718,7 @@ extract_time(PyObject *t, long* sec, long* usec)
|
|||
*usec = 0;
|
||||
return 0;
|
||||
}
|
||||
intval = PyInt_AsLong(t);
|
||||
intval = PyLong_AsLong(t);
|
||||
if (intval == -1 && PyErr_Occurred())
|
||||
return -1;
|
||||
*sec = intval;
|
||||
|
@ -3617,7 +3617,7 @@ posix_fork1(PyObject *self, PyObject *noargs)
|
|||
if (pid == -1)
|
||||
return posix_error();
|
||||
PyOS_AfterFork();
|
||||
return PyInt_FromLong((long)pid);
|
||||
return PyLong_FromLong((long)pid);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -3636,7 +3636,7 @@ posix_fork(PyObject *self, PyObject *noargs)
|
|||
return posix_error();
|
||||
if (pid == 0)
|
||||
PyOS_AfterFork();
|
||||
return PyInt_FromLong((long)pid);
|
||||
return PyLong_FromLong((long)pid);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -3757,7 +3757,7 @@ Return the current process's effective group id.");
|
|||
static PyObject *
|
||||
posix_getegid(PyObject *self, PyObject *noargs)
|
||||
{
|
||||
return PyInt_FromLong((long)getegid());
|
||||
return PyLong_FromLong((long)getegid());
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -3770,7 +3770,7 @@ Return the current process's effective user id.");
|
|||
static PyObject *
|
||||
posix_geteuid(PyObject *self, PyObject *noargs)
|
||||
{
|
||||
return PyInt_FromLong((long)geteuid());
|
||||
return PyLong_FromLong((long)geteuid());
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -3783,7 +3783,7 @@ Return the current process's group id.");
|
|||
static PyObject *
|
||||
posix_getgid(PyObject *self, PyObject *noargs)
|
||||
{
|
||||
return PyInt_FromLong((long)getgid());
|
||||
return PyLong_FromLong((long)getgid());
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -3795,7 +3795,7 @@ Return the current process id");
|
|||
static PyObject *
|
||||
posix_getpid(PyObject *self, PyObject *noargs)
|
||||
{
|
||||
return PyInt_FromLong((long)getpid());
|
||||
return PyLong_FromLong((long)getpid());
|
||||
}
|
||||
|
||||
|
||||
|
@ -3826,7 +3826,7 @@ posix_getgroups(PyObject *self, PyObject *noargs)
|
|||
if (result != NULL) {
|
||||
int i;
|
||||
for (i = 0; i < n; ++i) {
|
||||
PyObject *o = PyInt_FromLong((long)grouplist[i]);
|
||||
PyObject *o = PyLong_FromLong((long)grouplist[i]);
|
||||
if (o == NULL) {
|
||||
Py_DECREF(result);
|
||||
result = NULL;
|
||||
|
@ -3855,7 +3855,7 @@ posix_getpgid(PyObject *self, PyObject *args)
|
|||
pgid = getpgid(pid);
|
||||
if (pgid < 0)
|
||||
return posix_error();
|
||||
return PyInt_FromLong((long)pgid);
|
||||
return PyLong_FromLong((long)pgid);
|
||||
}
|
||||
#endif /* HAVE_GETPGID */
|
||||
|
||||
|
@ -3869,9 +3869,9 @@ static PyObject *
|
|||
posix_getpgrp(PyObject *self, PyObject *noargs)
|
||||
{
|
||||
#ifdef GETPGRP_HAVE_ARG
|
||||
return PyInt_FromLong((long)getpgrp(0));
|
||||
return PyLong_FromLong((long)getpgrp(0));
|
||||
#else /* GETPGRP_HAVE_ARG */
|
||||
return PyInt_FromLong((long)getpgrp());
|
||||
return PyLong_FromLong((long)getpgrp());
|
||||
#endif /* GETPGRP_HAVE_ARG */
|
||||
}
|
||||
#endif /* HAVE_GETPGRP */
|
||||
|
@ -3905,7 +3905,7 @@ Return the parent's process id.");
|
|||
static PyObject *
|
||||
posix_getppid(PyObject *self, PyObject *noargs)
|
||||
{
|
||||
return PyInt_FromLong((long)getppid());
|
||||
return PyLong_FromLong((long)getppid());
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -3947,7 +3947,7 @@ Return the current process's user id.");
|
|||
static PyObject *
|
||||
posix_getuid(PyObject *self, PyObject *noargs)
|
||||
{
|
||||
return PyInt_FromLong((long)getuid());
|
||||
return PyLong_FromLong((long)getuid());
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -4237,7 +4237,7 @@ wait_helper(int pid, int status, struct rusage *ru)
|
|||
PyStructSequence_SET_ITEM(result, 1,
|
||||
PyFloat_FromDouble(doubletime(ru->ru_stime)));
|
||||
#define SET_INT(result, index, value)\
|
||||
PyStructSequence_SET_ITEM(result, index, PyInt_FromLong(value))
|
||||
PyStructSequence_SET_ITEM(result, index, PyLong_FromLong(value))
|
||||
SET_INT(result, 2, ru->ru_maxrss);
|
||||
SET_INT(result, 3, ru->ru_ixrss);
|
||||
SET_INT(result, 4, ru->ru_idrss);
|
||||
|
@ -4569,7 +4569,7 @@ posix_getsid(PyObject *self, PyObject *args)
|
|||
sid = getsid(pid);
|
||||
if (sid < 0)
|
||||
return posix_error();
|
||||
return PyInt_FromLong((long)sid);
|
||||
return PyLong_FromLong((long)sid);
|
||||
}
|
||||
#endif /* HAVE_GETSID */
|
||||
|
||||
|
@ -4622,7 +4622,7 @@ posix_tcgetpgrp(PyObject *self, PyObject *args)
|
|||
pgid = tcgetpgrp(fd);
|
||||
if (pgid < 0)
|
||||
return posix_error();
|
||||
return PyInt_FromLong((long)pgid);
|
||||
return PyLong_FromLong((long)pgid);
|
||||
}
|
||||
#endif /* HAVE_TCGETPGRP */
|
||||
|
||||
|
@ -4670,7 +4670,7 @@ posix_open(PyObject *self, PyObject *args)
|
|||
Py_END_ALLOW_THREADS
|
||||
if (fd < 0)
|
||||
return posix_error();
|
||||
return PyInt_FromLong((long)fd);
|
||||
return PyLong_FromLong((long)fd);
|
||||
}
|
||||
/* Drop the argument parsing error as narrow strings
|
||||
are also valid. */
|
||||
|
@ -4689,7 +4689,7 @@ posix_open(PyObject *self, PyObject *args)
|
|||
if (fd < 0)
|
||||
return posix_error_with_allocated_filename(file);
|
||||
PyMem_Free(file);
|
||||
return PyInt_FromLong((long)fd);
|
||||
return PyLong_FromLong((long)fd);
|
||||
}
|
||||
|
||||
|
||||
|
@ -4728,7 +4728,7 @@ posix_dup(PyObject *self, PyObject *args)
|
|||
Py_END_ALLOW_THREADS
|
||||
if (fd < 0)
|
||||
return posix_error();
|
||||
return PyInt_FromLong((long)fd);
|
||||
return PyLong_FromLong((long)fd);
|
||||
}
|
||||
|
||||
|
||||
|
@ -4778,10 +4778,10 @@ posix_lseek(PyObject *self, PyObject *args)
|
|||
#endif /* SEEK_END */
|
||||
|
||||
#if !defined(HAVE_LARGEFILE_SUPPORT)
|
||||
pos = PyInt_AsLong(posobj);
|
||||
pos = PyLong_AsLong(posobj);
|
||||
#else
|
||||
pos = PyLong_Check(posobj) ?
|
||||
PyLong_AsLongLong(posobj) : PyInt_AsLong(posobj);
|
||||
PyLong_AsLongLong(posobj) : PyLong_AsLong(posobj);
|
||||
#endif
|
||||
if (PyErr_Occurred())
|
||||
return NULL;
|
||||
|
@ -4797,7 +4797,7 @@ posix_lseek(PyObject *self, PyObject *args)
|
|||
return posix_error();
|
||||
|
||||
#if !defined(HAVE_LARGEFILE_SUPPORT)
|
||||
return PyInt_FromLong(res);
|
||||
return PyLong_FromLong(res);
|
||||
#else
|
||||
return PyLong_FromLongLong(res);
|
||||
#endif
|
||||
|
@ -4854,7 +4854,7 @@ posix_write(PyObject *self, PyObject *args)
|
|||
Py_END_ALLOW_THREADS
|
||||
if (size < 0)
|
||||
return posix_error();
|
||||
return PyInt_FromSsize_t(size);
|
||||
return PyLong_FromSsize_t(size);
|
||||
}
|
||||
|
||||
|
||||
|
@ -5014,7 +5014,7 @@ posix_major(PyObject *self, PyObject *args)
|
|||
int device;
|
||||
if (!PyArg_ParseTuple(args, "i:major", &device))
|
||||
return NULL;
|
||||
return PyInt_FromLong((long)major(device));
|
||||
return PyLong_FromLong((long)major(device));
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(posix_minor__doc__,
|
||||
|
@ -5027,7 +5027,7 @@ posix_minor(PyObject *self, PyObject *args)
|
|||
int device;
|
||||
if (!PyArg_ParseTuple(args, "i:minor", &device))
|
||||
return NULL;
|
||||
return PyInt_FromLong((long)minor(device));
|
||||
return PyLong_FromLong((long)minor(device));
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(posix_makedev__doc__,
|
||||
|
@ -5040,7 +5040,7 @@ posix_makedev(PyObject *self, PyObject *args)
|
|||
int major, minor;
|
||||
if (!PyArg_ParseTuple(args, "ii:makedev", &major, &minor))
|
||||
return NULL;
|
||||
return PyInt_FromLong((long)makedev(major, minor));
|
||||
return PyLong_FromLong((long)makedev(major, minor));
|
||||
}
|
||||
#endif /* device macros */
|
||||
|
||||
|
@ -5062,10 +5062,10 @@ posix_ftruncate(PyObject *self, PyObject *args)
|
|||
return NULL;
|
||||
|
||||
#if !defined(HAVE_LARGEFILE_SUPPORT)
|
||||
length = PyInt_AsLong(lenobj);
|
||||
length = PyLong_AsLong(lenobj);
|
||||
#else
|
||||
length = PyLong_Check(lenobj) ?
|
||||
PyLong_AsLongLong(lenobj) : PyInt_AsLong(lenobj);
|
||||
PyLong_AsLongLong(lenobj) : PyLong_AsLong(lenobj);
|
||||
#endif
|
||||
if (PyErr_Occurred())
|
||||
return NULL;
|
||||
|
@ -5401,19 +5401,19 @@ _pystatvfs_fromstructstatvfs(struct statvfs st) {
|
|||
return NULL;
|
||||
|
||||
#if !defined(HAVE_LARGEFILE_SUPPORT)
|
||||
PyStructSequence_SET_ITEM(v, 0, PyInt_FromLong((long) st.f_bsize));
|
||||
PyStructSequence_SET_ITEM(v, 1, PyInt_FromLong((long) st.f_frsize));
|
||||
PyStructSequence_SET_ITEM(v, 2, PyInt_FromLong((long) st.f_blocks));
|
||||
PyStructSequence_SET_ITEM(v, 3, PyInt_FromLong((long) st.f_bfree));
|
||||
PyStructSequence_SET_ITEM(v, 4, PyInt_FromLong((long) st.f_bavail));
|
||||
PyStructSequence_SET_ITEM(v, 5, PyInt_FromLong((long) st.f_files));
|
||||
PyStructSequence_SET_ITEM(v, 6, PyInt_FromLong((long) st.f_ffree));
|
||||
PyStructSequence_SET_ITEM(v, 7, PyInt_FromLong((long) st.f_favail));
|
||||
PyStructSequence_SET_ITEM(v, 8, PyInt_FromLong((long) st.f_flag));
|
||||
PyStructSequence_SET_ITEM(v, 9, PyInt_FromLong((long) st.f_namemax));
|
||||
PyStructSequence_SET_ITEM(v, 0, PyLong_FromLong((long) st.f_bsize));
|
||||
PyStructSequence_SET_ITEM(v, 1, PyLong_FromLong((long) st.f_frsize));
|
||||
PyStructSequence_SET_ITEM(v, 2, PyLong_FromLong((long) st.f_blocks));
|
||||
PyStructSequence_SET_ITEM(v, 3, PyLong_FromLong((long) st.f_bfree));
|
||||
PyStructSequence_SET_ITEM(v, 4, PyLong_FromLong((long) st.f_bavail));
|
||||
PyStructSequence_SET_ITEM(v, 5, PyLong_FromLong((long) st.f_files));
|
||||
PyStructSequence_SET_ITEM(v, 6, PyLong_FromLong((long) st.f_ffree));
|
||||
PyStructSequence_SET_ITEM(v, 7, PyLong_FromLong((long) st.f_favail));
|
||||
PyStructSequence_SET_ITEM(v, 8, PyLong_FromLong((long) st.f_flag));
|
||||
PyStructSequence_SET_ITEM(v, 9, PyLong_FromLong((long) st.f_namemax));
|
||||
#else
|
||||
PyStructSequence_SET_ITEM(v, 0, PyInt_FromLong((long) st.f_bsize));
|
||||
PyStructSequence_SET_ITEM(v, 1, PyInt_FromLong((long) st.f_frsize));
|
||||
PyStructSequence_SET_ITEM(v, 0, PyLong_FromLong((long) st.f_bsize));
|
||||
PyStructSequence_SET_ITEM(v, 1, PyLong_FromLong((long) st.f_frsize));
|
||||
PyStructSequence_SET_ITEM(v, 2,
|
||||
PyLong_FromLongLong((PY_LONG_LONG) st.f_blocks));
|
||||
PyStructSequence_SET_ITEM(v, 3,
|
||||
|
@ -5426,8 +5426,8 @@ _pystatvfs_fromstructstatvfs(struct statvfs st) {
|
|||
PyLong_FromLongLong((PY_LONG_LONG) st.f_ffree));
|
||||
PyStructSequence_SET_ITEM(v, 7,
|
||||
PyLong_FromLongLong((PY_LONG_LONG) st.f_favail));
|
||||
PyStructSequence_SET_ITEM(v, 8, PyInt_FromLong((long) st.f_flag));
|
||||
PyStructSequence_SET_ITEM(v, 9, PyInt_FromLong((long) st.f_namemax));
|
||||
PyStructSequence_SET_ITEM(v, 8, PyLong_FromLong((long) st.f_flag));
|
||||
PyStructSequence_SET_ITEM(v, 9, PyLong_FromLong((long) st.f_namemax));
|
||||
#endif
|
||||
|
||||
return v;
|
||||
|
@ -5501,8 +5501,8 @@ static int
|
|||
conv_confname(PyObject *arg, int *valuep, struct constdef *table,
|
||||
size_t tablesize)
|
||||
{
|
||||
if (PyInt_Check(arg)) {
|
||||
*valuep = PyInt_AS_LONG(arg);
|
||||
if (PyLong_Check(arg)) {
|
||||
*valuep = PyLong_AS_LONG(arg);
|
||||
return 1;
|
||||
}
|
||||
else {
|
||||
|
@ -5625,7 +5625,7 @@ posix_fpathconf(PyObject *self, PyObject *args)
|
|||
if (limit == -1 && errno != 0)
|
||||
posix_error();
|
||||
else
|
||||
result = PyInt_FromLong(limit);
|
||||
result = PyLong_FromLong(limit);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@ -5659,7 +5659,7 @@ posix_pathconf(PyObject *self, PyObject *args)
|
|||
posix_error_with_filename(path);
|
||||
}
|
||||
else
|
||||
result = PyInt_FromLong(limit);
|
||||
result = PyLong_FromLong(limit);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@ -6383,7 +6383,7 @@ posix_sysconf(PyObject *self, PyObject *args)
|
|||
if (value == -1 && errno != 0)
|
||||
posix_error();
|
||||
else
|
||||
result = PyInt_FromLong(value);
|
||||
result = PyLong_FromLong(value);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@ -6424,7 +6424,7 @@ setup_confname_table(struct constdef *table, size_t tablesize,
|
|||
return -1;
|
||||
|
||||
for (i=0; i < tablesize; ++i) {
|
||||
PyObject *o = PyInt_FromLong(table[i].value);
|
||||
PyObject *o = PyLong_FromLong(table[i].value);
|
||||
if (o == NULL || PyDict_SetItemString(d, table[i].name, o) == -1) {
|
||||
Py_XDECREF(o);
|
||||
Py_DECREF(d);
|
||||
|
|
|
@ -67,7 +67,7 @@ mkpwent(struct passwd *p)
|
|||
if (v == NULL)
|
||||
return NULL;
|
||||
|
||||
#define SETI(i,val) PyStructSequence_SET_ITEM(v, i, PyInt_FromLong((long) val))
|
||||
#define SETI(i,val) PyStructSequence_SET_ITEM(v, i, PyLong_FromLong((long) val))
|
||||
#define SETS(i,val) sets(v, i, val)
|
||||
|
||||
SETS(setIndex++, p->pw_name);
|
||||
|
|
|
@ -83,7 +83,7 @@ static struct HandlerInfo handler_info[64];
|
|||
static int
|
||||
set_error_attr(PyObject *err, char *name, int value)
|
||||
{
|
||||
PyObject *v = PyInt_FromLong(value);
|
||||
PyObject *v = PyLong_FromLong(value);
|
||||
|
||||
if (v == NULL || PyObject_SetAttrString(err, name, v) == -1) {
|
||||
Py_XDECREF(v);
|
||||
|
@ -583,7 +583,7 @@ my_##NAME##Handler PARAMS {\
|
|||
|
||||
#define INT_HANDLER(NAME, PARAMS, PARAM_FORMAT)\
|
||||
RC_HANDLER(int, NAME, PARAMS, int rc=0;, PARAM_FORMAT, \
|
||||
rc = PyInt_AsLong(rv);, rc, \
|
||||
rc = PyLong_AsLong(rv);, rc, \
|
||||
(xmlparseobject *)userData)
|
||||
|
||||
VOID_HANDLER(EndElement,
|
||||
|
@ -784,7 +784,7 @@ RC_HANDLER(int, ExternalEntityRef,
|
|||
("(O&NNN)",
|
||||
conv_string_to_unicode ,context, string_intern(self, base),
|
||||
string_intern(self, systemId), string_intern(self, publicId)),
|
||||
rc = PyInt_AsLong(rv);, rc,
|
||||
rc = PyLong_AsLong(rv);, rc,
|
||||
XML_GetUserData(parser))
|
||||
|
||||
/* XXX UnknownEncodingHandler */
|
||||
|
@ -813,7 +813,7 @@ get_parse_result(xmlparseobject *self, int rv)
|
|||
if (flush_character_buffer(self) < 0) {
|
||||
return NULL;
|
||||
}
|
||||
return PyInt_FromLong(rv);
|
||||
return PyLong_FromLong(rv);
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(xmlparse_Parse__doc__,
|
||||
|
@ -846,7 +846,7 @@ readinst(char *buf, int buf_size, PyObject *meth)
|
|||
int len = -1;
|
||||
char *ptr;
|
||||
|
||||
if ((bytes = PyInt_FromLong(buf_size)) == NULL)
|
||||
if ((bytes = PyLong_FromLong(buf_size)) == NULL)
|
||||
goto finally;
|
||||
|
||||
if ((arg = PyTuple_New(1)) == NULL) {
|
||||
|
@ -1103,7 +1103,7 @@ xmlparse_SetParamEntityParsing(xmlparseobject *p, PyObject* args)
|
|||
if (!PyArg_ParseTuple(args, "i", &flag))
|
||||
return NULL;
|
||||
flag = XML_SetParamEntityParsing(p->itself, flag);
|
||||
return PyInt_FromLong(flag);
|
||||
return PyLong_FromLong(flag);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1342,36 +1342,36 @@ xmlparse_getattr(xmlparseobject *self, char *name)
|
|||
}
|
||||
if (name[0] == 'E') {
|
||||
if (strcmp(name, "ErrorCode") == 0)
|
||||
return PyInt_FromLong((long)
|
||||
return PyLong_FromLong((long)
|
||||
XML_GetErrorCode(self->itself));
|
||||
if (strcmp(name, "ErrorLineNumber") == 0)
|
||||
return PyInt_FromLong((long)
|
||||
return PyLong_FromLong((long)
|
||||
XML_GetErrorLineNumber(self->itself));
|
||||
if (strcmp(name, "ErrorColumnNumber") == 0)
|
||||
return PyInt_FromLong((long)
|
||||
return PyLong_FromLong((long)
|
||||
XML_GetErrorColumnNumber(self->itself));
|
||||
if (strcmp(name, "ErrorByteIndex") == 0)
|
||||
return PyInt_FromLong((long)
|
||||
return PyLong_FromLong((long)
|
||||
XML_GetErrorByteIndex(self->itself));
|
||||
}
|
||||
if (name[0] == 'C') {
|
||||
if (strcmp(name, "CurrentLineNumber") == 0)
|
||||
return PyInt_FromLong((long)
|
||||
return PyLong_FromLong((long)
|
||||
XML_GetCurrentLineNumber(self->itself));
|
||||
if (strcmp(name, "CurrentColumnNumber") == 0)
|
||||
return PyInt_FromLong((long)
|
||||
return PyLong_FromLong((long)
|
||||
XML_GetCurrentColumnNumber(self->itself));
|
||||
if (strcmp(name, "CurrentByteIndex") == 0)
|
||||
return PyInt_FromLong((long)
|
||||
return PyLong_FromLong((long)
|
||||
XML_GetCurrentByteIndex(self->itself));
|
||||
}
|
||||
if (name[0] == 'b') {
|
||||
if (strcmp(name, "buffer_size") == 0)
|
||||
return PyInt_FromLong((long) self->buffer_size);
|
||||
return PyLong_FromLong((long) self->buffer_size);
|
||||
if (strcmp(name, "buffer_text") == 0)
|
||||
return get_pybool(self->buffer != NULL);
|
||||
if (strcmp(name, "buffer_used") == 0)
|
||||
return PyInt_FromLong((long) self->buffer_used);
|
||||
return PyLong_FromLong((long) self->buffer_used);
|
||||
}
|
||||
if (strcmp(name, "namespace_prefixes") == 0)
|
||||
return get_pybool(self->ns_prefixes);
|
||||
|
|
|
@ -154,7 +154,7 @@ history truncation.");
|
|||
static PyObject*
|
||||
get_history_length(PyObject *self, PyObject *noarg)
|
||||
{
|
||||
return PyInt_FromLong(_history_length);
|
||||
return PyLong_FromLong(_history_length);
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(get_history_length_doc,
|
||||
|
@ -271,7 +271,7 @@ static PyObject *endidx = NULL;
|
|||
static PyObject *
|
||||
get_completion_type(PyObject *self, PyObject *noarg)
|
||||
{
|
||||
return PyInt_FromLong(rl_completion_type);
|
||||
return PyLong_FromLong(rl_completion_type);
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(doc_get_completion_type,
|
||||
|
@ -490,7 +490,7 @@ get_current_history_length(PyObject *self, PyObject *noarg)
|
|||
HISTORY_STATE *hist_st;
|
||||
|
||||
hist_st = history_get_history_state();
|
||||
return PyInt_FromLong(hist_st ? (long) hist_st->length : (long) 0);
|
||||
return PyLong_FromLong(hist_st ? (long) hist_st->length : (long) 0);
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(doc_get_current_history_length,
|
||||
|
@ -628,7 +628,7 @@ on_hook(PyObject *func)
|
|||
if (r == Py_None)
|
||||
result = 0;
|
||||
else {
|
||||
result = PyInt_AsLong(r);
|
||||
result = PyLong_AsLong(r);
|
||||
if (result == -1 && PyErr_Occurred())
|
||||
goto error;
|
||||
}
|
||||
|
@ -688,7 +688,7 @@ on_completion_display_matches_hook(char **matches,
|
|||
Py_DECREF(m), m=NULL;
|
||||
|
||||
if (r == NULL ||
|
||||
(r != Py_None && PyInt_AsLong(r) == -1 && PyErr_Occurred())) {
|
||||
(r != Py_None && PyLong_AsLong(r) == -1 && PyErr_Occurred())) {
|
||||
goto error;
|
||||
}
|
||||
Py_XDECREF(r), r=NULL;
|
||||
|
@ -752,8 +752,8 @@ flex_complete(char *text, int start, int end)
|
|||
{
|
||||
Py_XDECREF(begidx);
|
||||
Py_XDECREF(endidx);
|
||||
begidx = PyInt_FromLong((long) start);
|
||||
endidx = PyInt_FromLong((long) end);
|
||||
begidx = PyLong_FromLong((long) start);
|
||||
endidx = PyLong_FromLong((long) end);
|
||||
return completion_matches(text, *on_completion);
|
||||
}
|
||||
|
||||
|
@ -796,8 +796,8 @@ setup_readline(void)
|
|||
rl_completion_append_character ='\0';
|
||||
#endif
|
||||
|
||||
begidx = PyInt_FromLong(0L);
|
||||
endidx = PyInt_FromLong(0L);
|
||||
begidx = PyLong_FromLong(0L);
|
||||
endidx = PyLong_FromLong(0L);
|
||||
/* Initialize (allows .inputrc to override)
|
||||
*
|
||||
* XXX: A bug in the readline-2.2 library causes a memory leak
|
||||
|
|
|
@ -86,20 +86,20 @@ resource_getrusage(PyObject *self, PyObject *args)
|
|||
PyFloat_FromDouble(doubletime(ru.ru_utime)));
|
||||
PyStructSequence_SET_ITEM(result, 1,
|
||||
PyFloat_FromDouble(doubletime(ru.ru_stime)));
|
||||
PyStructSequence_SET_ITEM(result, 2, PyInt_FromLong(ru.ru_maxrss));
|
||||
PyStructSequence_SET_ITEM(result, 3, PyInt_FromLong(ru.ru_ixrss));
|
||||
PyStructSequence_SET_ITEM(result, 4, PyInt_FromLong(ru.ru_idrss));
|
||||
PyStructSequence_SET_ITEM(result, 5, PyInt_FromLong(ru.ru_isrss));
|
||||
PyStructSequence_SET_ITEM(result, 6, PyInt_FromLong(ru.ru_minflt));
|
||||
PyStructSequence_SET_ITEM(result, 7, PyInt_FromLong(ru.ru_majflt));
|
||||
PyStructSequence_SET_ITEM(result, 8, PyInt_FromLong(ru.ru_nswap));
|
||||
PyStructSequence_SET_ITEM(result, 9, PyInt_FromLong(ru.ru_inblock));
|
||||
PyStructSequence_SET_ITEM(result, 10, PyInt_FromLong(ru.ru_oublock));
|
||||
PyStructSequence_SET_ITEM(result, 11, PyInt_FromLong(ru.ru_msgsnd));
|
||||
PyStructSequence_SET_ITEM(result, 12, PyInt_FromLong(ru.ru_msgrcv));
|
||||
PyStructSequence_SET_ITEM(result, 13, PyInt_FromLong(ru.ru_nsignals));
|
||||
PyStructSequence_SET_ITEM(result, 14, PyInt_FromLong(ru.ru_nvcsw));
|
||||
PyStructSequence_SET_ITEM(result, 15, PyInt_FromLong(ru.ru_nivcsw));
|
||||
PyStructSequence_SET_ITEM(result, 2, PyLong_FromLong(ru.ru_maxrss));
|
||||
PyStructSequence_SET_ITEM(result, 3, PyLong_FromLong(ru.ru_ixrss));
|
||||
PyStructSequence_SET_ITEM(result, 4, PyLong_FromLong(ru.ru_idrss));
|
||||
PyStructSequence_SET_ITEM(result, 5, PyLong_FromLong(ru.ru_isrss));
|
||||
PyStructSequence_SET_ITEM(result, 6, PyLong_FromLong(ru.ru_minflt));
|
||||
PyStructSequence_SET_ITEM(result, 7, PyLong_FromLong(ru.ru_majflt));
|
||||
PyStructSequence_SET_ITEM(result, 8, PyLong_FromLong(ru.ru_nswap));
|
||||
PyStructSequence_SET_ITEM(result, 9, PyLong_FromLong(ru.ru_inblock));
|
||||
PyStructSequence_SET_ITEM(result, 10, PyLong_FromLong(ru.ru_oublock));
|
||||
PyStructSequence_SET_ITEM(result, 11, PyLong_FromLong(ru.ru_msgsnd));
|
||||
PyStructSequence_SET_ITEM(result, 12, PyLong_FromLong(ru.ru_msgrcv));
|
||||
PyStructSequence_SET_ITEM(result, 13, PyLong_FromLong(ru.ru_nsignals));
|
||||
PyStructSequence_SET_ITEM(result, 14, PyLong_FromLong(ru.ru_nvcsw));
|
||||
PyStructSequence_SET_ITEM(result, 15, PyLong_FromLong(ru.ru_nivcsw));
|
||||
|
||||
if (PyErr_Occurred()) {
|
||||
Py_DECREF(result);
|
||||
|
@ -158,20 +158,20 @@ resource_setrlimit(PyObject *self, PyObject *args)
|
|||
}
|
||||
|
||||
#if !defined(HAVE_LARGEFILE_SUPPORT)
|
||||
rl.rlim_cur = PyInt_AsLong(curobj);
|
||||
rl.rlim_cur = PyLong_AsLong(curobj);
|
||||
if (rl.rlim_cur == -1 && PyErr_Occurred())
|
||||
return NULL;
|
||||
rl.rlim_max = PyInt_AsLong(maxobj);
|
||||
rl.rlim_max = PyLong_AsLong(maxobj);
|
||||
if (rl.rlim_max == -1 && PyErr_Occurred())
|
||||
return NULL;
|
||||
#else
|
||||
/* The limits are probably bigger than a long */
|
||||
rl.rlim_cur = PyLong_Check(curobj) ?
|
||||
PyLong_AsLongLong(curobj) : PyInt_AsLong(curobj);
|
||||
PyLong_AsLongLong(curobj) : PyLong_AsLong(curobj);
|
||||
if (rl.rlim_cur == -1 && PyErr_Occurred())
|
||||
return NULL;
|
||||
rl.rlim_max = PyLong_Check(maxobj) ?
|
||||
PyLong_AsLongLong(maxobj) : PyInt_AsLong(maxobj);
|
||||
PyLong_AsLongLong(maxobj) : PyLong_AsLong(maxobj);
|
||||
if (rl.rlim_max == -1 && PyErr_Occurred())
|
||||
return NULL;
|
||||
#endif
|
||||
|
@ -320,7 +320,7 @@ initresource(void)
|
|||
} else
|
||||
#endif
|
||||
{
|
||||
v = PyInt_FromLong((long) RLIM_INFINITY);
|
||||
v = PyLong_FromLong((long) RLIM_INFINITY);
|
||||
}
|
||||
if (v) {
|
||||
PyModule_AddObject(m, "RLIM_INFINITY", v);
|
||||
|
|
|
@ -355,8 +355,8 @@ update_ufd_array(pollObject *self)
|
|||
|
||||
i = pos = 0;
|
||||
while (PyDict_Next(self->dict, &pos, &key, &value)) {
|
||||
self->ufds[i].fd = PyInt_AsLong(key);
|
||||
self->ufds[i].events = (short)PyInt_AsLong(value);
|
||||
self->ufds[i].fd = PyLong_AsLong(key);
|
||||
self->ufds[i].events = (short)PyLong_AsLong(value);
|
||||
i++;
|
||||
}
|
||||
self->ufd_uptodate = 1;
|
||||
|
@ -386,10 +386,10 @@ poll_register(pollObject *self, PyObject *args)
|
|||
|
||||
/* Add entry to the internal dictionary: the key is the
|
||||
file descriptor, and the value is the event mask. */
|
||||
key = PyInt_FromLong(fd);
|
||||
key = PyLong_FromLong(fd);
|
||||
if (key == NULL)
|
||||
return NULL;
|
||||
value = PyInt_FromLong(events);
|
||||
value = PyLong_FromLong(events);
|
||||
if (value == NULL) {
|
||||
Py_DECREF(key);
|
||||
return NULL;
|
||||
|
@ -421,7 +421,7 @@ poll_unregister(pollObject *self, PyObject *o)
|
|||
return NULL;
|
||||
|
||||
/* Check whether the fd is already in the array */
|
||||
key = PyInt_FromLong(fd);
|
||||
key = PyLong_FromLong(fd);
|
||||
if (key == NULL)
|
||||
return NULL;
|
||||
|
||||
|
@ -467,7 +467,7 @@ poll_poll(pollObject *self, PyObject *args)
|
|||
tout = PyNumber_Int(tout);
|
||||
if (!tout)
|
||||
return NULL;
|
||||
timeout = PyInt_AsLong(tout);
|
||||
timeout = PyLong_AsLong(tout);
|
||||
Py_DECREF(tout);
|
||||
if (timeout == -1 && PyErr_Occurred())
|
||||
return NULL;
|
||||
|
@ -505,7 +505,7 @@ poll_poll(pollObject *self, PyObject *args)
|
|||
value = PyTuple_New(2);
|
||||
if (value == NULL)
|
||||
goto error;
|
||||
num = PyInt_FromLong(self->ufds[i].fd);
|
||||
num = PyLong_FromLong(self->ufds[i].fd);
|
||||
if (num == NULL) {
|
||||
Py_DECREF(value);
|
||||
goto error;
|
||||
|
@ -516,7 +516,7 @@ poll_poll(pollObject *self, PyObject *args)
|
|||
is a 16-bit short, and IBM assigned POLLNVAL
|
||||
to be 0x8000, so the conversion to int results
|
||||
in a negative number. See SF bug #923315. */
|
||||
num = PyInt_FromLong(self->ufds[i].revents & 0xffff);
|
||||
num = PyLong_FromLong(self->ufds[i].revents & 0xffff);
|
||||
if (num == NULL) {
|
||||
Py_DECREF(value);
|
||||
goto error;
|
||||
|
|
|
@ -410,7 +410,7 @@ static PyMethodDef SHA1_methods[] = {
|
|||
static PyObject *
|
||||
SHA1_get_block_size(PyObject *self, void *closure)
|
||||
{
|
||||
return PyInt_FromLong(SHA1_BLOCKSIZE);
|
||||
return PyLong_FromLong(SHA1_BLOCKSIZE);
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
|
@ -422,7 +422,7 @@ SHA1_get_name(PyObject *self, void *closure)
|
|||
static PyObject *
|
||||
sha1_get_digest_size(PyObject *self, void *closure)
|
||||
{
|
||||
return PyInt_FromLong(SHA1_DIGESTSIZE);
|
||||
return PyLong_FromLong(SHA1_DIGESTSIZE);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -503,7 +503,7 @@ static PyMethodDef SHA_methods[] = {
|
|||
static PyObject *
|
||||
SHA256_get_block_size(PyObject *self, void *closure)
|
||||
{
|
||||
return PyInt_FromLong(SHA_BLOCKSIZE);
|
||||
return PyLong_FromLong(SHA_BLOCKSIZE);
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
|
|
|
@ -569,7 +569,7 @@ static PyMethodDef SHA_methods[] = {
|
|||
static PyObject *
|
||||
SHA512_get_block_size(PyObject *self, void *closure)
|
||||
{
|
||||
return PyInt_FromLong(SHA_BLOCKSIZE);
|
||||
return PyLong_FromLong(SHA_BLOCKSIZE);
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
|
|
|
@ -149,7 +149,7 @@ signal_alarm(PyObject *self, PyObject *args)
|
|||
if (!PyArg_ParseTuple(args, "i:alarm", &t))
|
||||
return NULL;
|
||||
/* alarm() returns the number of seconds remaining */
|
||||
return PyInt_FromLong((long)alarm(t));
|
||||
return PyLong_FromLong((long)alarm(t));
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(alarm_doc,
|
||||
|
@ -331,7 +331,7 @@ initsignal(void)
|
|||
if (!x || PyDict_SetItemString(d, "SIG_IGN", x) < 0)
|
||||
goto finally;
|
||||
|
||||
x = PyInt_FromLong((long)NSIG);
|
||||
x = PyLong_FromLong((long)NSIG);
|
||||
if (!x || PyDict_SetItemString(d, "NSIG", x) < 0)
|
||||
goto finally;
|
||||
Py_DECREF(x);
|
||||
|
@ -363,192 +363,192 @@ initsignal(void)
|
|||
}
|
||||
|
||||
#ifdef SIGHUP
|
||||
x = PyInt_FromLong(SIGHUP);
|
||||
x = PyLong_FromLong(SIGHUP);
|
||||
PyDict_SetItemString(d, "SIGHUP", x);
|
||||
Py_XDECREF(x);
|
||||
#endif
|
||||
#ifdef SIGINT
|
||||
x = PyInt_FromLong(SIGINT);
|
||||
x = PyLong_FromLong(SIGINT);
|
||||
PyDict_SetItemString(d, "SIGINT", x);
|
||||
Py_XDECREF(x);
|
||||
#endif
|
||||
#ifdef SIGBREAK
|
||||
x = PyInt_FromLong(SIGBREAK);
|
||||
x = PyLong_FromLong(SIGBREAK);
|
||||
PyDict_SetItemString(d, "SIGBREAK", x);
|
||||
Py_XDECREF(x);
|
||||
#endif
|
||||
#ifdef SIGQUIT
|
||||
x = PyInt_FromLong(SIGQUIT);
|
||||
x = PyLong_FromLong(SIGQUIT);
|
||||
PyDict_SetItemString(d, "SIGQUIT", x);
|
||||
Py_XDECREF(x);
|
||||
#endif
|
||||
#ifdef SIGILL
|
||||
x = PyInt_FromLong(SIGILL);
|
||||
x = PyLong_FromLong(SIGILL);
|
||||
PyDict_SetItemString(d, "SIGILL", x);
|
||||
Py_XDECREF(x);
|
||||
#endif
|
||||
#ifdef SIGTRAP
|
||||
x = PyInt_FromLong(SIGTRAP);
|
||||
x = PyLong_FromLong(SIGTRAP);
|
||||
PyDict_SetItemString(d, "SIGTRAP", x);
|
||||
Py_XDECREF(x);
|
||||
#endif
|
||||
#ifdef SIGIOT
|
||||
x = PyInt_FromLong(SIGIOT);
|
||||
x = PyLong_FromLong(SIGIOT);
|
||||
PyDict_SetItemString(d, "SIGIOT", x);
|
||||
Py_XDECREF(x);
|
||||
#endif
|
||||
#ifdef SIGABRT
|
||||
x = PyInt_FromLong(SIGABRT);
|
||||
x = PyLong_FromLong(SIGABRT);
|
||||
PyDict_SetItemString(d, "SIGABRT", x);
|
||||
Py_XDECREF(x);
|
||||
#endif
|
||||
#ifdef SIGEMT
|
||||
x = PyInt_FromLong(SIGEMT);
|
||||
x = PyLong_FromLong(SIGEMT);
|
||||
PyDict_SetItemString(d, "SIGEMT", x);
|
||||
Py_XDECREF(x);
|
||||
#endif
|
||||
#ifdef SIGFPE
|
||||
x = PyInt_FromLong(SIGFPE);
|
||||
x = PyLong_FromLong(SIGFPE);
|
||||
PyDict_SetItemString(d, "SIGFPE", x);
|
||||
Py_XDECREF(x);
|
||||
#endif
|
||||
#ifdef SIGKILL
|
||||
x = PyInt_FromLong(SIGKILL);
|
||||
x = PyLong_FromLong(SIGKILL);
|
||||
PyDict_SetItemString(d, "SIGKILL", x);
|
||||
Py_XDECREF(x);
|
||||
#endif
|
||||
#ifdef SIGBUS
|
||||
x = PyInt_FromLong(SIGBUS);
|
||||
x = PyLong_FromLong(SIGBUS);
|
||||
PyDict_SetItemString(d, "SIGBUS", x);
|
||||
Py_XDECREF(x);
|
||||
#endif
|
||||
#ifdef SIGSEGV
|
||||
x = PyInt_FromLong(SIGSEGV);
|
||||
x = PyLong_FromLong(SIGSEGV);
|
||||
PyDict_SetItemString(d, "SIGSEGV", x);
|
||||
Py_XDECREF(x);
|
||||
#endif
|
||||
#ifdef SIGSYS
|
||||
x = PyInt_FromLong(SIGSYS);
|
||||
x = PyLong_FromLong(SIGSYS);
|
||||
PyDict_SetItemString(d, "SIGSYS", x);
|
||||
Py_XDECREF(x);
|
||||
#endif
|
||||
#ifdef SIGPIPE
|
||||
x = PyInt_FromLong(SIGPIPE);
|
||||
x = PyLong_FromLong(SIGPIPE);
|
||||
PyDict_SetItemString(d, "SIGPIPE", x);
|
||||
Py_XDECREF(x);
|
||||
#endif
|
||||
#ifdef SIGALRM
|
||||
x = PyInt_FromLong(SIGALRM);
|
||||
x = PyLong_FromLong(SIGALRM);
|
||||
PyDict_SetItemString(d, "SIGALRM", x);
|
||||
Py_XDECREF(x);
|
||||
#endif
|
||||
#ifdef SIGTERM
|
||||
x = PyInt_FromLong(SIGTERM);
|
||||
x = PyLong_FromLong(SIGTERM);
|
||||
PyDict_SetItemString(d, "SIGTERM", x);
|
||||
Py_XDECREF(x);
|
||||
#endif
|
||||
#ifdef SIGUSR1
|
||||
x = PyInt_FromLong(SIGUSR1);
|
||||
x = PyLong_FromLong(SIGUSR1);
|
||||
PyDict_SetItemString(d, "SIGUSR1", x);
|
||||
Py_XDECREF(x);
|
||||
#endif
|
||||
#ifdef SIGUSR2
|
||||
x = PyInt_FromLong(SIGUSR2);
|
||||
x = PyLong_FromLong(SIGUSR2);
|
||||
PyDict_SetItemString(d, "SIGUSR2", x);
|
||||
Py_XDECREF(x);
|
||||
#endif
|
||||
#ifdef SIGCLD
|
||||
x = PyInt_FromLong(SIGCLD);
|
||||
x = PyLong_FromLong(SIGCLD);
|
||||
PyDict_SetItemString(d, "SIGCLD", x);
|
||||
Py_XDECREF(x);
|
||||
#endif
|
||||
#ifdef SIGCHLD
|
||||
x = PyInt_FromLong(SIGCHLD);
|
||||
x = PyLong_FromLong(SIGCHLD);
|
||||
PyDict_SetItemString(d, "SIGCHLD", x);
|
||||
Py_XDECREF(x);
|
||||
#endif
|
||||
#ifdef SIGPWR
|
||||
x = PyInt_FromLong(SIGPWR);
|
||||
x = PyLong_FromLong(SIGPWR);
|
||||
PyDict_SetItemString(d, "SIGPWR", x);
|
||||
Py_XDECREF(x);
|
||||
#endif
|
||||
#ifdef SIGIO
|
||||
x = PyInt_FromLong(SIGIO);
|
||||
x = PyLong_FromLong(SIGIO);
|
||||
PyDict_SetItemString(d, "SIGIO", x);
|
||||
Py_XDECREF(x);
|
||||
#endif
|
||||
#ifdef SIGURG
|
||||
x = PyInt_FromLong(SIGURG);
|
||||
x = PyLong_FromLong(SIGURG);
|
||||
PyDict_SetItemString(d, "SIGURG", x);
|
||||
Py_XDECREF(x);
|
||||
#endif
|
||||
#ifdef SIGWINCH
|
||||
x = PyInt_FromLong(SIGWINCH);
|
||||
x = PyLong_FromLong(SIGWINCH);
|
||||
PyDict_SetItemString(d, "SIGWINCH", x);
|
||||
Py_XDECREF(x);
|
||||
#endif
|
||||
#ifdef SIGPOLL
|
||||
x = PyInt_FromLong(SIGPOLL);
|
||||
x = PyLong_FromLong(SIGPOLL);
|
||||
PyDict_SetItemString(d, "SIGPOLL", x);
|
||||
Py_XDECREF(x);
|
||||
#endif
|
||||
#ifdef SIGSTOP
|
||||
x = PyInt_FromLong(SIGSTOP);
|
||||
x = PyLong_FromLong(SIGSTOP);
|
||||
PyDict_SetItemString(d, "SIGSTOP", x);
|
||||
Py_XDECREF(x);
|
||||
#endif
|
||||
#ifdef SIGTSTP
|
||||
x = PyInt_FromLong(SIGTSTP);
|
||||
x = PyLong_FromLong(SIGTSTP);
|
||||
PyDict_SetItemString(d, "SIGTSTP", x);
|
||||
Py_XDECREF(x);
|
||||
#endif
|
||||
#ifdef SIGCONT
|
||||
x = PyInt_FromLong(SIGCONT);
|
||||
x = PyLong_FromLong(SIGCONT);
|
||||
PyDict_SetItemString(d, "SIGCONT", x);
|
||||
Py_XDECREF(x);
|
||||
#endif
|
||||
#ifdef SIGTTIN
|
||||
x = PyInt_FromLong(SIGTTIN);
|
||||
x = PyLong_FromLong(SIGTTIN);
|
||||
PyDict_SetItemString(d, "SIGTTIN", x);
|
||||
Py_XDECREF(x);
|
||||
#endif
|
||||
#ifdef SIGTTOU
|
||||
x = PyInt_FromLong(SIGTTOU);
|
||||
x = PyLong_FromLong(SIGTTOU);
|
||||
PyDict_SetItemString(d, "SIGTTOU", x);
|
||||
Py_XDECREF(x);
|
||||
#endif
|
||||
#ifdef SIGVTALRM
|
||||
x = PyInt_FromLong(SIGVTALRM);
|
||||
x = PyLong_FromLong(SIGVTALRM);
|
||||
PyDict_SetItemString(d, "SIGVTALRM", x);
|
||||
Py_XDECREF(x);
|
||||
#endif
|
||||
#ifdef SIGPROF
|
||||
x = PyInt_FromLong(SIGPROF);
|
||||
x = PyLong_FromLong(SIGPROF);
|
||||
PyDict_SetItemString(d, "SIGPROF", x);
|
||||
Py_XDECREF(x);
|
||||
#endif
|
||||
#ifdef SIGXCPU
|
||||
x = PyInt_FromLong(SIGXCPU);
|
||||
x = PyLong_FromLong(SIGXCPU);
|
||||
PyDict_SetItemString(d, "SIGXCPU", x);
|
||||
Py_XDECREF(x);
|
||||
#endif
|
||||
#ifdef SIGXFSZ
|
||||
x = PyInt_FromLong(SIGXFSZ);
|
||||
x = PyLong_FromLong(SIGXFSZ);
|
||||
PyDict_SetItemString(d, "SIGXFSZ", x);
|
||||
Py_XDECREF(x);
|
||||
#endif
|
||||
#ifdef SIGRTMIN
|
||||
x = PyInt_FromLong(SIGRTMIN);
|
||||
x = PyLong_FromLong(SIGRTMIN);
|
||||
PyDict_SetItemString(d, "SIGRTMIN", x);
|
||||
Py_XDECREF(x);
|
||||
#endif
|
||||
#ifdef SIGRTMAX
|
||||
x = PyInt_FromLong(SIGRTMAX);
|
||||
x = PyLong_FromLong(SIGRTMAX);
|
||||
PyDict_SetItemString(d, "SIGRTMAX", x);
|
||||
Py_XDECREF(x);
|
||||
#endif
|
||||
#ifdef SIGINFO
|
||||
x = PyInt_FromLong(SIGINFO);
|
||||
x = PyLong_FromLong(SIGINFO);
|
||||
PyDict_SetItemString(d, "SIGINFO", x);
|
||||
Py_XDECREF(x);
|
||||
#endif
|
||||
|
|
|
@ -1508,7 +1508,7 @@ sock_setblocking(PySocketSockObject *s, PyObject *arg)
|
|||
{
|
||||
int block;
|
||||
|
||||
block = PyInt_AsLong(arg);
|
||||
block = PyLong_AsLong(arg);
|
||||
if (block == -1 && PyErr_Occurred())
|
||||
return NULL;
|
||||
|
||||
|
@ -1649,7 +1649,7 @@ sock_getsockopt(PySocketSockObject *s, PyObject *args)
|
|||
(void *)&flag, &flagsize);
|
||||
if (res < 0)
|
||||
return s->errorhandler();
|
||||
return PyInt_FromLong(flag);
|
||||
return PyLong_FromLong(flag);
|
||||
}
|
||||
#ifdef __VMS
|
||||
/* socklen_t is unsigned so no negative test is needed,
|
||||
|
@ -1874,7 +1874,7 @@ sock_connect_ex(PySocketSockObject *s, PyObject *addro)
|
|||
return NULL;
|
||||
#endif
|
||||
|
||||
return PyInt_FromLong((long) res);
|
||||
return PyLong_FromLong((long) res);
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(connect_ex_doc,
|
||||
|
@ -1965,7 +1965,7 @@ sock_listen(PySocketSockObject *s, PyObject *arg)
|
|||
int backlog;
|
||||
int res;
|
||||
|
||||
backlog = PyInt_AsLong(arg);
|
||||
backlog = PyLong_AsLong(arg);
|
||||
if (backlog == -1 && PyErr_Occurred())
|
||||
return NULL;
|
||||
Py_BEGIN_ALLOW_THREADS
|
||||
|
@ -2167,7 +2167,7 @@ sock_recv_into(PySocketSockObject *s, PyObject *args, PyObject *kwds)
|
|||
|
||||
/* Return the number of bytes read. Note that we do not do anything
|
||||
special here in the case that readlen < recvlen. */
|
||||
return PyInt_FromSsize_t(readlen);
|
||||
return PyLong_FromSsize_t(readlen);
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(recv_into_doc,
|
||||
|
@ -2375,7 +2375,7 @@ sock_send(PySocketSockObject *s, PyObject *args)
|
|||
}
|
||||
if (n < 0)
|
||||
return s->errorhandler();
|
||||
return PyInt_FromLong((long)n);
|
||||
return PyLong_FromLong((long)n);
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(send_doc,
|
||||
|
@ -2474,7 +2474,7 @@ sock_sendto(PySocketSockObject *s, PyObject *args)
|
|||
}
|
||||
if (n < 0)
|
||||
return s->errorhandler();
|
||||
return PyInt_FromLong((long)n);
|
||||
return PyLong_FromLong((long)n);
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(sendto_doc,
|
||||
|
@ -2492,7 +2492,7 @@ sock_shutdown(PySocketSockObject *s, PyObject *arg)
|
|||
int how;
|
||||
int res;
|
||||
|
||||
how = PyInt_AsLong(arg);
|
||||
how = PyLong_AsLong(arg);
|
||||
if (how == -1 && PyErr_Occurred())
|
||||
return NULL;
|
||||
Py_BEGIN_ALLOW_THREADS
|
||||
|
@ -3071,7 +3071,7 @@ socket_getservbyname(PyObject *self, PyObject *args)
|
|||
PyErr_SetString(socket_error, "service/proto not found");
|
||||
return NULL;
|
||||
}
|
||||
return PyInt_FromLong((long) ntohs(sp->s_port));
|
||||
return PyLong_FromLong((long) ntohs(sp->s_port));
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(getservbyname_doc,
|
||||
|
@ -3131,7 +3131,7 @@ socket_getprotobyname(PyObject *self, PyObject *args)
|
|||
PyErr_SetString(socket_error, "protocol not found");
|
||||
return NULL;
|
||||
}
|
||||
return PyInt_FromLong((long) sp->p_proto);
|
||||
return PyLong_FromLong((long) sp->p_proto);
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(getprotobyname_doc,
|
||||
|
@ -3242,7 +3242,7 @@ socket_ntohs(PyObject *self, PyObject *args)
|
|||
return NULL;
|
||||
}
|
||||
x2 = (unsigned int)ntohs((unsigned short)x1);
|
||||
return PyInt_FromLong(x2);
|
||||
return PyLong_FromLong(x2);
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(ntohs_doc,
|
||||
|
@ -3301,7 +3301,7 @@ socket_htons(PyObject *self, PyObject *args)
|
|||
return NULL;
|
||||
}
|
||||
x2 = (unsigned int)htons((unsigned short)x1);
|
||||
return PyInt_FromLong(x2);
|
||||
return PyLong_FromLong(x2);
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(htons_doc,
|
||||
|
@ -3596,7 +3596,7 @@ socket_getaddrinfo(PyObject *self, PyObject *args)
|
|||
return NULL;
|
||||
}
|
||||
if (PyInt_CheckExact(pobj)) {
|
||||
PyOS_snprintf(pbuf, sizeof(pbuf), "%ld", PyInt_AsLong(pobj));
|
||||
PyOS_snprintf(pbuf, sizeof(pbuf), "%ld", PyLong_AsLong(pobj));
|
||||
pptr = pbuf;
|
||||
} else if (PyUnicode_Check(pobj)) {
|
||||
pptr = PyUnicode_AsString(pobj);
|
||||
|
|
|
@ -74,7 +74,7 @@ static PyObject *mkspent(struct spwd *p)
|
|||
if (v == NULL)
|
||||
return NULL;
|
||||
|
||||
#define SETI(i,val) PyStructSequence_SET_ITEM(v, i, PyInt_FromLong((long) val))
|
||||
#define SETI(i,val) PyStructSequence_SET_ITEM(v, i, PyLong_FromLong((long) val))
|
||||
#define SETS(i,val) sets(v, i, val)
|
||||
|
||||
SETS(setIndex++, p->sp_namp);
|
||||
|
|
|
@ -123,7 +123,7 @@ syslog_setlogmask(PyObject *self, PyObject *args)
|
|||
if (!PyArg_ParseTuple(args, "l;mask for priority", &maskpri))
|
||||
return NULL;
|
||||
omaskpri = setlogmask(maskpri);
|
||||
return PyInt_FromLong(omaskpri);
|
||||
return PyLong_FromLong(omaskpri);
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
|
@ -134,7 +134,7 @@ syslog_log_mask(PyObject *self, PyObject *args)
|
|||
if (!PyArg_ParseTuple(args, "l:LOG_MASK", &pri))
|
||||
return NULL;
|
||||
mask = LOG_MASK(pri);
|
||||
return PyInt_FromLong(mask);
|
||||
return PyLong_FromLong(mask);
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
|
@ -145,7 +145,7 @@ syslog_log_upto(PyObject *self, PyObject *args)
|
|||
if (!PyArg_ParseTuple(args, "l:LOG_UPTO", &pri))
|
||||
return NULL;
|
||||
mask = LOG_UPTO(pri);
|
||||
return PyInt_FromLong(mask);
|
||||
return PyLong_FromLong(mask);
|
||||
}
|
||||
|
||||
/* List of functions defined in the module */
|
||||
|
|
|
@ -101,11 +101,11 @@ termios_tcgetattr(PyObject *self, PyObject *args)
|
|||
MIN and TIME slots are the same as the EOF and EOL slots. So we
|
||||
only do this in noncanonical input mode. */
|
||||
if ((mode.c_lflag & ICANON) == 0) {
|
||||
v = PyInt_FromLong((long)mode.c_cc[VMIN]);
|
||||
v = PyLong_FromLong((long)mode.c_cc[VMIN]);
|
||||
if (v == NULL)
|
||||
goto err;
|
||||
PyList_SetItem(cc, VMIN, v);
|
||||
v = PyInt_FromLong((long)mode.c_cc[VTIME]);
|
||||
v = PyLong_FromLong((long)mode.c_cc[VTIME]);
|
||||
if (v == NULL)
|
||||
goto err;
|
||||
PyList_SetItem(cc, VTIME, v);
|
||||
|
@ -114,12 +114,12 @@ termios_tcgetattr(PyObject *self, PyObject *args)
|
|||
if (!(v = PyList_New(7)))
|
||||
goto err;
|
||||
|
||||
PyList_SetItem(v, 0, PyInt_FromLong((long)mode.c_iflag));
|
||||
PyList_SetItem(v, 1, PyInt_FromLong((long)mode.c_oflag));
|
||||
PyList_SetItem(v, 2, PyInt_FromLong((long)mode.c_cflag));
|
||||
PyList_SetItem(v, 3, PyInt_FromLong((long)mode.c_lflag));
|
||||
PyList_SetItem(v, 4, PyInt_FromLong((long)ispeed));
|
||||
PyList_SetItem(v, 5, PyInt_FromLong((long)ospeed));
|
||||
PyList_SetItem(v, 0, PyLong_FromLong((long)mode.c_iflag));
|
||||
PyList_SetItem(v, 1, PyLong_FromLong((long)mode.c_oflag));
|
||||
PyList_SetItem(v, 2, PyLong_FromLong((long)mode.c_cflag));
|
||||
PyList_SetItem(v, 3, PyLong_FromLong((long)mode.c_lflag));
|
||||
PyList_SetItem(v, 4, PyLong_FromLong((long)ispeed));
|
||||
PyList_SetItem(v, 5, PyLong_FromLong((long)ospeed));
|
||||
PyList_SetItem(v, 6, cc);
|
||||
if (PyErr_Occurred()){
|
||||
Py_DECREF(v);
|
||||
|
@ -163,12 +163,12 @@ termios_tcsetattr(PyObject *self, PyObject *args)
|
|||
/* Get the old mode, in case there are any hidden fields... */
|
||||
if (tcgetattr(fd, &mode) == -1)
|
||||
return PyErr_SetFromErrno(TermiosError);
|
||||
mode.c_iflag = (tcflag_t) PyInt_AsLong(PyList_GetItem(term, 0));
|
||||
mode.c_oflag = (tcflag_t) PyInt_AsLong(PyList_GetItem(term, 1));
|
||||
mode.c_cflag = (tcflag_t) PyInt_AsLong(PyList_GetItem(term, 2));
|
||||
mode.c_lflag = (tcflag_t) PyInt_AsLong(PyList_GetItem(term, 3));
|
||||
ispeed = (speed_t) PyInt_AsLong(PyList_GetItem(term, 4));
|
||||
ospeed = (speed_t) PyInt_AsLong(PyList_GetItem(term, 5));
|
||||
mode.c_iflag = (tcflag_t) PyLong_AsLong(PyList_GetItem(term, 0));
|
||||
mode.c_oflag = (tcflag_t) PyLong_AsLong(PyList_GetItem(term, 1));
|
||||
mode.c_cflag = (tcflag_t) PyLong_AsLong(PyList_GetItem(term, 2));
|
||||
mode.c_lflag = (tcflag_t) PyLong_AsLong(PyList_GetItem(term, 3));
|
||||
ispeed = (speed_t) PyLong_AsLong(PyList_GetItem(term, 4));
|
||||
ospeed = (speed_t) PyLong_AsLong(PyList_GetItem(term, 5));
|
||||
cc = PyList_GetItem(term, 6);
|
||||
if (PyErr_Occurred())
|
||||
return NULL;
|
||||
|
@ -185,8 +185,8 @@ termios_tcsetattr(PyObject *self, PyObject *args)
|
|||
|
||||
if (PyString_Check(v) && PyString_Size(v) == 1)
|
||||
mode.c_cc[i] = (cc_t) * PyString_AsString(v);
|
||||
else if (PyInt_Check(v))
|
||||
mode.c_cc[i] = (cc_t) PyInt_AsLong(v);
|
||||
else if (PyLong_Check(v))
|
||||
mode.c_cc[i] = (cc_t) PyLong_AsLong(v);
|
||||
else {
|
||||
PyErr_SetString(PyExc_TypeError,
|
||||
"tcsetattr: elements of attributes must be characters or integers");
|
||||
|
|
|
@ -493,7 +493,7 @@ thread_PyThread_start_new_thread(PyObject *self, PyObject *fargs)
|
|||
PyMem_DEL(boot);
|
||||
return NULL;
|
||||
}
|
||||
return PyInt_FromLong(ident);
|
||||
return PyLong_FromLong(ident);
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(start_new_doc,
|
||||
|
@ -571,7 +571,7 @@ thread_get_ident(PyObject *self)
|
|||
PyErr_SetString(ThreadError, "no current thread ident");
|
||||
return NULL;
|
||||
}
|
||||
return PyInt_FromLong(ident);
|
||||
return PyLong_FromLong(ident);
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(get_ident_doc,
|
||||
|
@ -616,7 +616,7 @@ thread_stack_size(PyObject *self, PyObject *args)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
return PyInt_FromSsize_t((Py_ssize_t) old_size);
|
||||
return PyLong_FromSsize_t((Py_ssize_t) old_size);
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(stack_size_doc,
|
||||
|
|
|
@ -237,7 +237,7 @@ tmtotuple(struct tm *p)
|
|||
if (v == NULL)
|
||||
return NULL;
|
||||
|
||||
#define SET(i,val) PyStructSequence_SET_ITEM(v, i, PyInt_FromLong((long) val))
|
||||
#define SET(i,val) PyStructSequence_SET_ITEM(v, i, PyLong_FromLong((long) val))
|
||||
|
||||
SET(0, p->tm_year + 1900);
|
||||
SET(1, p->tm_mon + 1); /* Want January == 1 */
|
||||
|
@ -393,7 +393,7 @@ gettmarg(PyObject *args, struct tm *p)
|
|||
PyObject *accept = PyDict_GetItemString(moddict,
|
||||
"accept2dyear");
|
||||
if (accept == NULL || !PyInt_CheckExact(accept) ||
|
||||
PyInt_AsLong(accept) == 0) {
|
||||
PyLong_AsLong(accept) == 0) {
|
||||
PyErr_SetString(PyExc_ValueError,
|
||||
"year >= 1900 required");
|
||||
return 0;
|
||||
|
|
|
@ -143,7 +143,7 @@ unicodedata_decimal(PyObject *self, PyObject *args)
|
|||
return defobj;
|
||||
}
|
||||
}
|
||||
return PyInt_FromLong(rc);
|
||||
return PyLong_FromLong(rc);
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(unicodedata_digit__doc__,
|
||||
|
@ -178,7 +178,7 @@ unicodedata_digit(PyObject *self, PyObject *args)
|
|||
return defobj;
|
||||
}
|
||||
}
|
||||
return PyInt_FromLong(rc);
|
||||
return PyLong_FromLong(rc);
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(unicodedata_numeric__doc__,
|
||||
|
@ -320,7 +320,7 @@ unicodedata_combining(PyObject *self, PyObject *args)
|
|||
if (old->category_changed == 0)
|
||||
index = 0; /* unassigned */
|
||||
}
|
||||
return PyInt_FromLong(index);
|
||||
return PyLong_FromLong(index);
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(unicodedata_mirrored__doc__,
|
||||
|
@ -350,7 +350,7 @@ unicodedata_mirrored(PyObject *self, PyObject *args)
|
|||
if (old->category_changed == 0)
|
||||
index = 0; /* unassigned */
|
||||
}
|
||||
return PyInt_FromLong(index);
|
||||
return PyLong_FromLong(index);
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(unicodedata_east_asian_width__doc__,
|
||||
|
|
|
@ -156,7 +156,7 @@ xx_foo(PyObject *self, PyObject *args)
|
|||
if (!PyArg_ParseTuple(args, "ll:foo", &i, &j))
|
||||
return NULL;
|
||||
res = i+j; /* XXX Do something here */
|
||||
return PyInt_FromLong(res);
|
||||
return PyLong_FromLong(res);
|
||||
}
|
||||
|
||||
|
||||
|
@ -187,7 +187,7 @@ xx_bug(PyObject *self, PyObject *args)
|
|||
|
||||
item = PyList_GetItem(list, 0);
|
||||
/* Py_INCREF(item); */
|
||||
PyList_SetItem(list, 1, PyInt_FromLong(0L));
|
||||
PyList_SetItem(list, 1, PyLong_FromLong(0L));
|
||||
PyObject_Print(item, stdout, 0);
|
||||
printf("\n");
|
||||
/* Py_DECREF(item); */
|
||||
|
|
|
@ -28,7 +28,7 @@ spamlist_getstate(spamlistobject *self, PyObject *args)
|
|||
{
|
||||
if (!PyArg_ParseTuple(args, ":getstate"))
|
||||
return NULL;
|
||||
return PyInt_FromLong(self->state);
|
||||
return PyLong_FromLong(self->state);
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
|
@ -91,7 +91,7 @@ spamlist_init(spamlistobject *self, PyObject *args, PyObject *kwds)
|
|||
static PyObject *
|
||||
spamlist_state_get(spamlistobject *self)
|
||||
{
|
||||
return PyInt_FromLong(self->state);
|
||||
return PyLong_FromLong(self->state);
|
||||
}
|
||||
|
||||
static PyGetSetDef spamlist_getsets[] = {
|
||||
|
@ -153,7 +153,7 @@ spamdict_getstate(spamdictobject *self, PyObject *args)
|
|||
{
|
||||
if (!PyArg_ParseTuple(args, ":getstate"))
|
||||
return NULL;
|
||||
return PyInt_FromLong(self->state);
|
||||
return PyLong_FromLong(self->state);
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
|
|
|
@ -1028,8 +1028,8 @@ get_mtime_of_source(ZipImporter *self, char *path)
|
|||
/* fetch the time stamp of the .py file for comparison
|
||||
with an embedded pyc time stamp */
|
||||
int time, date;
|
||||
time = PyInt_AsLong(PyTuple_GetItem(toc_entry, 5));
|
||||
date = PyInt_AsLong(PyTuple_GetItem(toc_entry, 6));
|
||||
time = PyLong_AsLong(PyTuple_GetItem(toc_entry, 5));
|
||||
date = PyLong_AsLong(PyTuple_GetItem(toc_entry, 6));
|
||||
mtime = parse_dostime(time, date);
|
||||
}
|
||||
path[lastchar] = savechar;
|
||||
|
|
|
@ -922,7 +922,7 @@ PyZlib_adler32(PyObject *self, PyObject *args)
|
|||
if (!PyArg_ParseTuple(args, "s#|k:adler32", &buf, &len, &adler32val))
|
||||
return NULL;
|
||||
adler32val = adler32(adler32val, buf, len);
|
||||
return PyInt_FromLong(adler32val);
|
||||
return PyLong_FromLong(adler32val);
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(crc32__doc__,
|
||||
|
@ -940,7 +940,7 @@ PyZlib_crc32(PyObject *self, PyObject *args)
|
|||
if (!PyArg_ParseTuple(args, "s#|k:crc32", &buf, &len, &crc32val))
|
||||
return NULL;
|
||||
crc32val = crc32(crc32val, buf, len);
|
||||
return PyInt_FromLong(crc32val);
|
||||
return PyLong_FromLong(crc32val);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -93,7 +93,7 @@ _PyObject_LengthHint(PyObject *o)
|
|||
PyErr_Fetch(&err_type, &err_value, &err_tb);
|
||||
ro = PyObject_CallMethod(o, "__length_hint__", NULL);
|
||||
if (ro != NULL) {
|
||||
rv = PyInt_AsLong(ro);
|
||||
rv = PyLong_AsLong(ro);
|
||||
Py_DECREF(ro);
|
||||
Py_XDECREF(err_type);
|
||||
Py_XDECREF(err_value);
|
||||
|
@ -1188,8 +1188,8 @@ PyNumber_AsSsize_t(PyObject *item, PyObject *err)
|
|||
if (value == NULL)
|
||||
return -1;
|
||||
|
||||
/* We're done if PyInt_AsSsize_t() returns without error. */
|
||||
result = PyInt_AsSsize_t(value);
|
||||
/* We're done if PyLong_AsSsize_t() returns without error. */
|
||||
result = PyLong_AsSsize_t(value);
|
||||
if (result != -1 || !(runerr = PyErr_Occurred()))
|
||||
goto finish;
|
||||
|
||||
|
@ -1413,7 +1413,7 @@ PySequence_Repeat(PyObject *o, Py_ssize_t count)
|
|||
to nb_multiply if o appears to be a sequence. */
|
||||
if (PySequence_Check(o)) {
|
||||
PyObject *n, *result;
|
||||
n = PyInt_FromSsize_t(count);
|
||||
n = PyLong_FromSsize_t(count);
|
||||
if (n == NULL)
|
||||
return NULL;
|
||||
result = binary_op1(o, n, NB_SLOT(nb_multiply));
|
||||
|
@ -1465,7 +1465,7 @@ PySequence_InPlaceRepeat(PyObject *o, Py_ssize_t count)
|
|||
|
||||
if (PySequence_Check(o)) {
|
||||
PyObject *n, *result;
|
||||
n = PyInt_FromSsize_t(count);
|
||||
n = PyLong_FromSsize_t(count);
|
||||
if (n == NULL)
|
||||
return NULL;
|
||||
result = binary_iop1(o, n, NB_SLOT(nb_inplace_multiply),
|
||||
|
|
|
@ -34,8 +34,8 @@ _getbytevalue(PyObject* arg, int *value)
|
|||
{
|
||||
long face_value;
|
||||
|
||||
if (PyInt_Check(arg)) {
|
||||
face_value = PyInt_AsLong(arg);
|
||||
if (PyLong_Check(arg)) {
|
||||
face_value = PyLong_AsLong(arg);
|
||||
if (face_value < 0 || face_value >= 256) {
|
||||
PyErr_SetString(PyExc_ValueError, "byte must be in range(0, 256)");
|
||||
return 0;
|
||||
|
@ -350,7 +350,7 @@ bytes_getitem(PyBytesObject *self, Py_ssize_t i)
|
|||
PyErr_SetString(PyExc_IndexError, "bytearray index out of range");
|
||||
return NULL;
|
||||
}
|
||||
return PyInt_FromLong((unsigned char)(self->ob_bytes[i]));
|
||||
return PyLong_FromLong((unsigned char)(self->ob_bytes[i]));
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
|
@ -369,7 +369,7 @@ bytes_subscript(PyBytesObject *self, PyObject *item)
|
|||
PyErr_SetString(PyExc_IndexError, "bytearray index out of range");
|
||||
return NULL;
|
||||
}
|
||||
return PyInt_FromLong((unsigned char)(self->ob_bytes[i]));
|
||||
return PyLong_FromLong((unsigned char)(self->ob_bytes[i]));
|
||||
}
|
||||
else if (PySlice_Check(item)) {
|
||||
Py_ssize_t start, stop, step, slicelength, cur, i;
|
||||
|
@ -1091,7 +1091,7 @@ bytes_find(PyBytesObject *self, PyObject *args)
|
|||
Py_ssize_t result = bytes_find_internal(self, args, +1);
|
||||
if (result == -2)
|
||||
return NULL;
|
||||
return PyInt_FromSsize_t(result);
|
||||
return PyLong_FromSsize_t(result);
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(count__doc__,
|
||||
|
@ -1119,7 +1119,7 @@ bytes_count(PyBytesObject *self, PyObject *args)
|
|||
|
||||
_adjust_indices(&start, &end, PyBytes_GET_SIZE(self));
|
||||
|
||||
count_obj = PyInt_FromSsize_t(
|
||||
count_obj = PyLong_FromSsize_t(
|
||||
stringlib_count(str + start, end - start, vsub.buf, vsub.len)
|
||||
);
|
||||
PyObject_ReleaseBuffer(sub_obj, &vsub);
|
||||
|
@ -1143,7 +1143,7 @@ bytes_index(PyBytesObject *self, PyObject *args)
|
|||
"subsection not found");
|
||||
return NULL;
|
||||
}
|
||||
return PyInt_FromSsize_t(result);
|
||||
return PyLong_FromSsize_t(result);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1162,7 +1162,7 @@ bytes_rfind(PyBytesObject *self, PyObject *args)
|
|||
Py_ssize_t result = bytes_find_internal(self, args, -1);
|
||||
if (result == -2)
|
||||
return NULL;
|
||||
return PyInt_FromSsize_t(result);
|
||||
return PyLong_FromSsize_t(result);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1182,7 +1182,7 @@ bytes_rindex(PyBytesObject *self, PyObject *args)
|
|||
"subsection not found");
|
||||
return NULL;
|
||||
}
|
||||
return PyInt_FromSsize_t(result);
|
||||
return PyLong_FromSsize_t(result);
|
||||
}
|
||||
|
||||
|
||||
|
@ -2622,7 +2622,7 @@ bytes_pop(PyBytesObject *self, PyObject *args)
|
|||
if (PyBytes_Resize((PyObject *)self, n - 1) < 0)
|
||||
return NULL;
|
||||
|
||||
return PyInt_FromLong(value);
|
||||
return PyLong_FromLong(value);
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(remove__doc__,
|
||||
|
@ -2809,7 +2809,7 @@ Returns the number of bytes actually allocated.");
|
|||
static PyObject *
|
||||
bytes_alloc(PyBytesObject *self)
|
||||
{
|
||||
return PyInt_FromSsize_t(self->ob_alloc);
|
||||
return PyLong_FromSsize_t(self->ob_alloc);
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(join_doc,
|
||||
|
@ -3161,7 +3161,7 @@ bytesiter_next(bytesiterobject *it)
|
|||
assert(PyBytes_Check(seq));
|
||||
|
||||
if (it->it_index < PyBytes_GET_SIZE(seq)) {
|
||||
item = PyInt_FromLong(
|
||||
item = PyLong_FromLong(
|
||||
(unsigned char)seq->ob_bytes[it->it_index]);
|
||||
if (item != NULL)
|
||||
++it->it_index;
|
||||
|
@ -3179,7 +3179,7 @@ bytesiter_length_hint(bytesiterobject *it)
|
|||
Py_ssize_t len = 0;
|
||||
if (it->it_seq)
|
||||
len = PyBytes_GET_SIZE(it->it_seq) - it->it_index;
|
||||
return PyInt_FromSsize_t(len);
|
||||
return PyLong_FromSsize_t(len);
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(length_hint_doc,
|
||||
|
|
|
@ -2094,7 +2094,7 @@ dictiter_len(dictiterobject *di)
|
|||
Py_ssize_t len = 0;
|
||||
if (di->di_dict != NULL && di->di_used == di->di_dict->ma_used)
|
||||
len = di->len;
|
||||
return PyInt_FromSize_t(len);
|
||||
return PyLong_FromSize_t(len);
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(length_hint_doc,
|
||||
|
|
|
@ -67,12 +67,12 @@ enum_next_long(enumobject *en, PyObject* next_item)
|
|||
PyObject *stepped_up;
|
||||
|
||||
if (en->en_longindex == NULL) {
|
||||
en->en_longindex = PyInt_FromLong(LONG_MAX);
|
||||
en->en_longindex = PyLong_FromLong(LONG_MAX);
|
||||
if (en->en_longindex == NULL)
|
||||
return NULL;
|
||||
}
|
||||
if (one == NULL) {
|
||||
one = PyInt_FromLong(1);
|
||||
one = PyLong_FromLong(1);
|
||||
if (one == NULL)
|
||||
return NULL;
|
||||
}
|
||||
|
@ -115,7 +115,7 @@ enum_next(enumobject *en)
|
|||
if (en->en_index == LONG_MAX)
|
||||
return enum_next_long(en, next_item);
|
||||
|
||||
next_index = PyInt_FromLong(en->en_index);
|
||||
next_index = PyLong_FromLong(en->en_index);
|
||||
if (next_index == NULL) {
|
||||
Py_DECREF(next_item);
|
||||
return NULL;
|
||||
|
@ -279,12 +279,12 @@ reversed_len(reversedobject *ro)
|
|||
Py_ssize_t position, seqsize;
|
||||
|
||||
if (ro->seq == NULL)
|
||||
return PyInt_FromLong(0);
|
||||
return PyLong_FromLong(0);
|
||||
seqsize = PySequence_Size(ro->seq);
|
||||
if (seqsize == -1)
|
||||
return NULL;
|
||||
position = ro->index + 1;
|
||||
return PyInt_FromSsize_t((seqsize < position) ? 0 : position);
|
||||
return PyLong_FromSsize_t((seqsize < position) ? 0 : position);
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(length_hint_doc, "Private method returning an estimate of len(list(it)).");
|
||||
|
|
|
@ -720,7 +720,7 @@ WindowsError_init(PyWindowsErrorObject *self, PyObject *args, PyObject *kwds)
|
|||
|
||||
/* Set errno to the POSIX errno, and winerror to the Win32
|
||||
error code. */
|
||||
errcode = PyInt_AsLong(self->myerrno);
|
||||
errcode = PyLong_AsLong(self->myerrno);
|
||||
if (errcode == -1 && PyErr_Occurred())
|
||||
return -1;
|
||||
posix_errno = winerror_to_errno(errcode);
|
||||
|
@ -728,7 +728,7 @@ WindowsError_init(PyWindowsErrorObject *self, PyObject *args, PyObject *kwds)
|
|||
Py_CLEAR(self->winerror);
|
||||
self->winerror = self->myerrno;
|
||||
|
||||
o_errcode = PyInt_FromLong(posix_errno);
|
||||
o_errcode = PyLong_FromLong(posix_errno);
|
||||
if (!o_errcode)
|
||||
return -1;
|
||||
|
||||
|
@ -945,7 +945,7 @@ SyntaxError_str(PySyntaxErrorObject *self)
|
|||
return PyUnicode_FromFormat("%S (%s, line %ld)",
|
||||
self->msg ? self->msg : Py_None,
|
||||
my_basename(filename),
|
||||
PyInt_AsLong(self->lineno));
|
||||
PyLong_AsLong(self->lineno));
|
||||
else if (filename)
|
||||
return PyUnicode_FromFormat("%S (%s)",
|
||||
self->msg ? self->msg : Py_None,
|
||||
|
@ -953,7 +953,7 @@ SyntaxError_str(PySyntaxErrorObject *self)
|
|||
else /* only have_lineno */
|
||||
return PyUnicode_FromFormat("%S (line %ld)",
|
||||
self->msg ? self->msg : Py_None,
|
||||
PyInt_AsLong(self->lineno));
|
||||
PyLong_AsLong(self->lineno));
|
||||
}
|
||||
|
||||
static PyMemberDef SyntaxError_members[] = {
|
||||
|
|
|
@ -413,7 +413,7 @@ stdprinter_write(PyStdPrinter_Object *self, PyObject *args)
|
|||
static PyObject *
|
||||
stdprinter_fileno(PyStdPrinter_Object *self)
|
||||
{
|
||||
return PyInt_FromLong((long) self->fd);
|
||||
return PyLong_FromLong((long) self->fd);
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
|
|
|
@ -72,7 +72,7 @@ PyFloat_GetInfo(void)
|
|||
if (PyDict_SetItemString(d, key, tmp)) return NULL; \
|
||||
Py_DECREF(tmp)
|
||||
#define SET_INT_CONST(d, key, const) \
|
||||
tmp = PyInt_FromLong(const); \
|
||||
tmp = PyLong_FromLong(const); \
|
||||
if (tmp == NULL) return NULL; \
|
||||
if (PyDict_SetItemString(d, key, tmp)) return NULL; \
|
||||
Py_DECREF(tmp)
|
||||
|
@ -481,7 +481,7 @@ float_richcompare(PyObject *v, PyObject *w, int op)
|
|||
*/
|
||||
PyObject *temp;
|
||||
|
||||
one = PyInt_FromLong(1);
|
||||
one = PyLong_FromLong(1);
|
||||
if (one == NULL)
|
||||
goto Error;
|
||||
|
||||
|
@ -808,7 +808,7 @@ float_trunc(PyObject *v)
|
|||
*/
|
||||
if (LONG_MIN < wholepart && wholepart < LONG_MAX) {
|
||||
const long aslong = (long)wholepart;
|
||||
return PyInt_FromLong(aslong);
|
||||
return PyLong_FromLong(aslong);
|
||||
}
|
||||
return PyLong_FromDouble(wholepart);
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@ frame_getlineno(PyFrameObject *f, void *closure)
|
|||
else
|
||||
lineno = PyCode_Addr2Line(f->f_code, f->f_lasti);
|
||||
|
||||
return PyInt_FromLong(lineno);
|
||||
return PyLong_FromLong(lineno);
|
||||
}
|
||||
|
||||
/* Setter for f_lineno - you can set f_lineno from within a trace function in
|
||||
|
@ -104,7 +104,7 @@ frame_setlineno(PyFrameObject *f, PyObject* p_new_lineno)
|
|||
}
|
||||
|
||||
/* Fail if the line comes before the start of the code block. */
|
||||
new_lineno = (int) PyInt_AsLong(p_new_lineno);
|
||||
new_lineno = (int) PyLong_AsLong(p_new_lineno);
|
||||
if (new_lineno < f->f_code->co_firstlineno) {
|
||||
PyErr_Format(PyExc_ValueError,
|
||||
"line %d comes before the current code block",
|
||||
|
|
|
@ -81,9 +81,9 @@ iter_len(seqiterobject *it)
|
|||
return NULL;
|
||||
len = seqsize - it->it_index;
|
||||
if (len >= 0)
|
||||
return PyInt_FromSsize_t(len);
|
||||
return PyLong_FromSsize_t(len);
|
||||
}
|
||||
return PyInt_FromLong(0);
|
||||
return PyLong_FromLong(0);
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(length_hint_doc, "Private method returning an estimate of len(list(it)).");
|
||||
|
|
|
@ -931,7 +931,7 @@ islt(PyObject *x, PyObject *y, PyObject *compare)
|
|||
Py_DECREF(res);
|
||||
return -1;
|
||||
}
|
||||
i = PyInt_AsLong(res);
|
||||
i = PyLong_AsLong(res);
|
||||
Py_DECREF(res);
|
||||
return i < 0;
|
||||
}
|
||||
|
@ -2226,7 +2226,7 @@ listindex(PyListObject *self, PyObject *args)
|
|||
for (i = start; i < stop && i < Py_Size(self); i++) {
|
||||
int cmp = PyObject_RichCompareBool(self->ob_item[i], v, Py_EQ);
|
||||
if (cmp > 0)
|
||||
return PyInt_FromSsize_t(i);
|
||||
return PyLong_FromSsize_t(i);
|
||||
else if (cmp < 0)
|
||||
return NULL;
|
||||
}
|
||||
|
@ -2247,7 +2247,7 @@ listcount(PyListObject *self, PyObject *v)
|
|||
else if (cmp < 0)
|
||||
return NULL;
|
||||
}
|
||||
return PyInt_FromSsize_t(count);
|
||||
return PyLong_FromSsize_t(count);
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
|
@ -2823,9 +2823,9 @@ listiter_len(listiterobject *it)
|
|||
if (it->it_seq) {
|
||||
len = PyList_GET_SIZE(it->it_seq) - it->it_index;
|
||||
if (len >= 0)
|
||||
return PyInt_FromSsize_t(len);
|
||||
return PyLong_FromSsize_t(len);
|
||||
}
|
||||
return PyInt_FromLong(0);
|
||||
return PyLong_FromLong(0);
|
||||
}
|
||||
/*********************** List Reverse Iterator **************************/
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ get_small_int(int ival)
|
|||
be a small integer, so negating it must go to PyLong_FromLong */
|
||||
#define NEGATE(x) \
|
||||
do if (Py_Refcnt(x) == 1) Py_Size(x) = -Py_Size(x); \
|
||||
else { PyObject* tmp=PyInt_FromLong(-MEDIUM_VALUE(x)); \
|
||||
else { PyObject* tmp=PyLong_FromLong(-MEDIUM_VALUE(x)); \
|
||||
Py_DECREF(x); (x) = (PyLongObject*)tmp; } \
|
||||
while(0)
|
||||
/* For long multiplication, use the O(N**2) school algorithm unless
|
||||
|
@ -976,7 +976,7 @@ PyLong_FromVoidPtr(void *p)
|
|||
#endif
|
||||
/* special-case null pointer */
|
||||
if (!p)
|
||||
return PyInt_FromLong(0);
|
||||
return PyLong_FromLong(0);
|
||||
return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG)(Py_uintptr_t)p);
|
||||
|
||||
}
|
||||
|
@ -2315,7 +2315,7 @@ long_add(PyLongObject *a, PyLongObject *b)
|
|||
CHECK_BINOP(a, b);
|
||||
|
||||
if (ABS(Py_Size(a)) <= 1 && ABS(Py_Size(b)) <= 1) {
|
||||
PyObject *result = PyInt_FromLong(MEDIUM_VALUE(a) +
|
||||
PyObject *result = PyLong_FromLong(MEDIUM_VALUE(a) +
|
||||
MEDIUM_VALUE(b));
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -303,7 +303,7 @@ memory_format_get(PyMemoryViewObject *self)
|
|||
static PyObject *
|
||||
memory_itemsize_get(PyMemoryViewObject *self)
|
||||
{
|
||||
return PyInt_FromSsize_t(self->view.itemsize);
|
||||
return PyLong_FromSsize_t(self->view.itemsize);
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
|
@ -320,7 +320,7 @@ _IntTupleFromSsizet(int len, Py_ssize_t *vals)
|
|||
intTuple = PyTuple_New(len);
|
||||
if (!intTuple) return NULL;
|
||||
for(i=0; i<len; i++) {
|
||||
o = PyInt_FromSsize_t(vals[i]);
|
||||
o = PyLong_FromSsize_t(vals[i]);
|
||||
if (!o) {
|
||||
Py_DECREF(intTuple);
|
||||
return NULL;
|
||||
|
@ -351,7 +351,7 @@ memory_suboffsets_get(PyMemoryViewObject *self)
|
|||
static PyObject *
|
||||
memory_size_get(PyMemoryViewObject *self)
|
||||
{
|
||||
return PyInt_FromSsize_t(self->view.len);
|
||||
return PyLong_FromSsize_t(self->view.len);
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
|
@ -363,7 +363,7 @@ memory_readonly_get(PyMemoryViewObject *self)
|
|||
static PyObject *
|
||||
memory_ndim_get(PyMemoryViewObject *self)
|
||||
{
|
||||
return PyInt_FromLong(self->view.ndim);
|
||||
return PyLong_FromLong(self->view.ndim);
|
||||
}
|
||||
|
||||
static PyGetSetDef memory_getsetlist[] ={
|
||||
|
|
|
@ -24,7 +24,7 @@ validate_step(PyObject *step)
|
|||
{
|
||||
/* No step specified, use a step of 1. */
|
||||
if (!step)
|
||||
return PyInt_FromLong(1);
|
||||
return PyLong_FromLong(1);
|
||||
|
||||
step = PyNumber_Index(step);
|
||||
if (step) {
|
||||
|
@ -63,8 +63,8 @@ range_new(PyTypeObject *type, PyObject *args, PyObject *kw)
|
|||
stop = PyNumber_Index(stop);
|
||||
if (!stop)
|
||||
goto Fail;
|
||||
start = PyInt_FromLong(0);
|
||||
step = PyInt_FromLong(1);
|
||||
start = PyLong_FromLong(0);
|
||||
step = PyLong_FromLong(1);
|
||||
if (!start || !step)
|
||||
goto Fail;
|
||||
}
|
||||
|
@ -113,7 +113,7 @@ range_dealloc(rangeobject *r)
|
|||
/* Return number of items in range (lo, hi, step), when arguments are
|
||||
* PyInt or PyLong objects. step > 0 required. Return a value < 0 if
|
||||
* & only if the true value is too large to fit in a signed long.
|
||||
* Arguments MUST return 1 with either PyInt_Check() or
|
||||
* Arguments MUST return 1 with either PyLong_Check() or
|
||||
* PyLong_Check(). Return -1 when there is an error.
|
||||
*/
|
||||
static PyObject*
|
||||
|
@ -332,14 +332,14 @@ static PyObject *
|
|||
rangeiter_next(rangeiterobject *r)
|
||||
{
|
||||
if (r->index < r->len)
|
||||
return PyInt_FromLong(r->start + (r->index++) * r->step);
|
||||
return PyLong_FromLong(r->start + (r->index++) * r->step);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
rangeiter_len(rangeiterobject *r)
|
||||
{
|
||||
return PyInt_FromLong(r->len - r->index);
|
||||
return PyLong_FromLong(r->len - r->index);
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
|
|
|
@ -801,7 +801,7 @@ setiter_len(setiterobject *si)
|
|||
Py_ssize_t len = 0;
|
||||
if (si->si_set != NULL && si->si_used == si->si_set->used)
|
||||
len = si->len;
|
||||
return PyInt_FromLong(len);
|
||||
return PyLong_FromLong(len);
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(length_hint_doc, "Private method returning an estimate of len(list(it)).");
|
||||
|
|
|
@ -83,10 +83,10 @@ PyObject *
|
|||
_PySlice_FromIndices(Py_ssize_t istart, Py_ssize_t istop)
|
||||
{
|
||||
PyObject *start, *end, *slice;
|
||||
start = PyInt_FromSsize_t(istart);
|
||||
start = PyLong_FromSsize_t(istart);
|
||||
if (!start)
|
||||
return NULL;
|
||||
end = PyInt_FromSsize_t(istop);
|
||||
end = PyLong_FromSsize_t(istop);
|
||||
if (!end) {
|
||||
Py_DECREF(start);
|
||||
return NULL;
|
||||
|
@ -107,20 +107,20 @@ PySlice_GetIndices(PySliceObject *r, Py_ssize_t length,
|
|||
*step = 1;
|
||||
} else {
|
||||
if (!PyLong_Check(r->step)) return -1;
|
||||
*step = PyInt_AsSsize_t(r->step);
|
||||
*step = PyLong_AsSsize_t(r->step);
|
||||
}
|
||||
if (r->start == Py_None) {
|
||||
*start = *step < 0 ? length-1 : 0;
|
||||
} else {
|
||||
if (!PyInt_Check(r->start)) return -1;
|
||||
*start = PyInt_AsSsize_t(r->start);
|
||||
if (!PyLong_Check(r->start)) return -1;
|
||||
*start = PyLong_AsSsize_t(r->start);
|
||||
if (*start < 0) *start += length;
|
||||
}
|
||||
if (r->stop == Py_None) {
|
||||
*stop = *step < 0 ? -1 : length;
|
||||
} else {
|
||||
if (!PyInt_Check(r->stop)) return -1;
|
||||
*stop = PyInt_AsSsize_t(r->stop);
|
||||
if (!PyLong_Check(r->stop)) return -1;
|
||||
*stop = PyLong_AsSsize_t(r->stop);
|
||||
if (*stop < 0) *stop += length;
|
||||
}
|
||||
if (*stop > length) return -1;
|
||||
|
|
|
@ -469,7 +469,7 @@ format_long_internal(PyObject *value, const InternalFormatSpec *format)
|
|||
|
||||
/* taken from unicodeobject.c formatchar() */
|
||||
/* Integer input truncated to a character */
|
||||
x = PyInt_AsLong(value);
|
||||
x = PyLong_AsLong(value);
|
||||
if (x == -1 && PyErr_Occurred())
|
||||
goto done;
|
||||
#ifdef Py_UNICODE_WIDE
|
||||
|
|
|
@ -204,7 +204,7 @@ static PyObject *
|
|||
getitem_idx(PyObject *obj, Py_ssize_t idx)
|
||||
{
|
||||
PyObject *newobj;
|
||||
PyObject *idx_obj = PyInt_FromSsize_t(idx);
|
||||
PyObject *idx_obj = PyLong_FromSsize_t(idx);
|
||||
if (idx_obj == NULL)
|
||||
return NULL;
|
||||
newobj = PyObject_GetItem(obj, idx_obj);
|
||||
|
@ -1160,7 +1160,7 @@ fieldnameiter_next(fieldnameiterobject *it)
|
|||
|
||||
/* either an integer or a string */
|
||||
if (idx != -1)
|
||||
obj = PyInt_FromSsize_t(idx);
|
||||
obj = PyLong_FromSsize_t(idx);
|
||||
else
|
||||
obj = SubString_new_object(&name);
|
||||
if (obj == NULL)
|
||||
|
@ -1245,7 +1245,7 @@ formatter_field_name_split(PyUnicodeObject *self)
|
|||
|
||||
/* first becomes an integer, if possible; else a string */
|
||||
if (first_idx != -1)
|
||||
first_obj = PyInt_FromSsize_t(first_idx);
|
||||
first_obj = PyLong_FromSsize_t(first_idx);
|
||||
else
|
||||
/* convert "first" into a string object */
|
||||
first_obj = SubString_new_object(&first);
|
||||
|
|
|
@ -803,7 +803,7 @@ string_item(PyStringObject *a, register Py_ssize_t i)
|
|||
PyErr_SetString(PyExc_IndexError, "string index out of range");
|
||||
return NULL;
|
||||
}
|
||||
return PyInt_FromLong((unsigned char)a->ob_sval[i]);
|
||||
return PyLong_FromLong((unsigned char)a->ob_sval[i]);
|
||||
}
|
||||
|
||||
static PyObject*
|
||||
|
@ -922,7 +922,7 @@ string_subscript(PyStringObject* self, PyObject* item)
|
|||
"string index out of range");
|
||||
return NULL;
|
||||
}
|
||||
return PyInt_FromLong((unsigned char)self->ob_sval[i]);
|
||||
return PyLong_FromLong((unsigned char)self->ob_sval[i]);
|
||||
}
|
||||
else if (PySlice_Check(item)) {
|
||||
Py_ssize_t start, stop, step, slicelength, cur, i;
|
||||
|
@ -1586,7 +1586,7 @@ string_find(PyStringObject *self, PyObject *args)
|
|||
Py_ssize_t result = string_find_internal(self, args, +1);
|
||||
if (result == -2)
|
||||
return NULL;
|
||||
return PyInt_FromSsize_t(result);
|
||||
return PyLong_FromSsize_t(result);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1606,7 +1606,7 @@ string_index(PyStringObject *self, PyObject *args)
|
|||
"substring not found");
|
||||
return NULL;
|
||||
}
|
||||
return PyInt_FromSsize_t(result);
|
||||
return PyLong_FromSsize_t(result);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1625,7 +1625,7 @@ string_rfind(PyStringObject *self, PyObject *args)
|
|||
Py_ssize_t result = string_find_internal(self, args, -1);
|
||||
if (result == -2)
|
||||
return NULL;
|
||||
return PyInt_FromSsize_t(result);
|
||||
return PyLong_FromSsize_t(result);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1645,7 +1645,7 @@ string_rindex(PyStringObject *self, PyObject *args)
|
|||
"substring not found");
|
||||
return NULL;
|
||||
}
|
||||
return PyInt_FromSsize_t(result);
|
||||
return PyLong_FromSsize_t(result);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1808,7 +1808,7 @@ string_count(PyStringObject *self, PyObject *args)
|
|||
|
||||
string_adjust_indices(&start, &end, PyString_GET_SIZE(self));
|
||||
|
||||
return PyInt_FromSsize_t(
|
||||
return PyLong_FromSsize_t(
|
||||
stringlib_count(str + start, end - start, sub, sub_len)
|
||||
);
|
||||
}
|
||||
|
@ -3332,7 +3332,7 @@ striter_next(striterobject *it)
|
|||
assert(PyString_Check(seq));
|
||||
|
||||
if (it->it_index < PyString_GET_SIZE(seq)) {
|
||||
item = PyInt_FromLong(
|
||||
item = PyLong_FromLong(
|
||||
(unsigned char)seq->ob_sval[it->it_index]);
|
||||
if (item != NULL)
|
||||
++it->it_index;
|
||||
|
@ -3350,7 +3350,7 @@ striter_len(striterobject *it)
|
|||
Py_ssize_t len = 0;
|
||||
if (it->it_seq)
|
||||
len = PyString_GET_SIZE(it->it_seq) - it->it_index;
|
||||
return PyInt_FromSsize_t(len);
|
||||
return PyLong_FromSsize_t(len);
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(length_hint_doc,
|
||||
|
|
|
@ -14,14 +14,14 @@ static char unnamed_fields_key[] = "n_unnamed_fields";
|
|||
char *PyStructSequence_UnnamedField = "unnamed field";
|
||||
|
||||
#define VISIBLE_SIZE(op) Py_Size(op)
|
||||
#define VISIBLE_SIZE_TP(tp) PyInt_AsLong( \
|
||||
#define VISIBLE_SIZE_TP(tp) PyLong_AsLong( \
|
||||
PyDict_GetItemString((tp)->tp_dict, visible_length_key))
|
||||
|
||||
#define REAL_SIZE_TP(tp) PyInt_AsLong( \
|
||||
#define REAL_SIZE_TP(tp) PyLong_AsLong( \
|
||||
PyDict_GetItemString((tp)->tp_dict, real_length_key))
|
||||
#define REAL_SIZE(op) REAL_SIZE_TP(Py_Type(op))
|
||||
|
||||
#define UNNAMED_FIELDS_TP(tp) PyInt_AsLong( \
|
||||
#define UNNAMED_FIELDS_TP(tp) PyLong_AsLong( \
|
||||
PyDict_GetItemString((tp)->tp_dict, unnamed_fields_key))
|
||||
#define UNNAMED_FIELDS(op) UNNAMED_FIELDS_TP(Py_Type(op))
|
||||
|
||||
|
@ -451,9 +451,9 @@ PyStructSequence_InitType(PyTypeObject *type, PyStructSequence_Desc *desc)
|
|||
|
||||
dict = type->tp_dict;
|
||||
PyDict_SetItemString(dict, visible_length_key,
|
||||
PyInt_FromLong((long) desc->n_in_sequence));
|
||||
PyLong_FromLong((long) desc->n_in_sequence));
|
||||
PyDict_SetItemString(dict, real_length_key,
|
||||
PyInt_FromLong((long) n_members));
|
||||
PyLong_FromLong((long) n_members));
|
||||
PyDict_SetItemString(dict, unnamed_fields_key,
|
||||
PyInt_FromLong((long) n_unnamed_members));
|
||||
PyLong_FromLong((long) n_unnamed_members));
|
||||
}
|
||||
|
|
|
@ -828,7 +828,7 @@ tupleiter_len(tupleiterobject *it)
|
|||
Py_ssize_t len = 0;
|
||||
if (it->it_seq)
|
||||
len = PyTuple_GET_SIZE(it->it_seq) - it->it_index;
|
||||
return PyInt_FromSsize_t(len);
|
||||
return PyLong_FromSsize_t(len);
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(length_hint_doc, "Private method returning an estimate of len(list(it)).");
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue