Skip to content

Commit 217cfd1

Browse files
committed
Cleanup: Replaced most PyInt_ aliases with PyLong_ and disabled the aliases in intobject.h
1 parent 1a3284e commit 217cfd1

File tree

123 files changed

+888
-885
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

123 files changed

+888
-885
lines changed

Demo/embed/demo.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ main(int argc, char **argv)
4848
static PyObject *
4949
xyzzy_foo(PyObject *self, PyObject* args)
5050
{
51-
return PyInt_FromLong(42L);
51+
return PyLong_FromLong(42L);
5252
}
5353

5454
static PyMethodDef xyzzy_methods[] = {

Doc/includes/run-func.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ main(int argc, char *argv[])
2626
if (pFunc && PyCallable_Check(pFunc)) {
2727
pArgs = PyTuple_New(argc - 3);
2828
for (i = 0; i < argc - 3; ++i) {
29-
pValue = PyInt_FromLong(atoi(argv[i + 3]));
29+
pValue = PyLong_FromLong(atoi(argv[i + 3]));
3030
if (!pValue) {
3131
Py_DECREF(pArgs);
3232
Py_DECREF(pModule);
@@ -39,7 +39,7 @@ main(int argc, char *argv[])
3939
pValue = PyObject_CallObject(pFunc, pArgs);
4040
Py_DECREF(pArgs);
4141
if (pValue != NULL) {
42-
printf("Result of call: %ld\n", PyInt_AsLong(pValue));
42+
printf("Result of call: %ld\n", PyLong_AsLong(pValue));
4343
Py_DECREF(pValue);
4444
}
4545
else {

Doc/includes/shoddy.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ static PyObject *
1010
Shoddy_increment(Shoddy *self, PyObject *unused)
1111
{
1212
self->state++;
13-
return PyInt_FromLong(self->state);
13+
return PyLong_FromLong(self->state);
1414
}
1515

1616

Include/intobject.h

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -29,23 +29,24 @@ typedef struct {
2929
PyAPI_DATA(PyTypeObject) PyInt_Type;
3030
*/
3131

32-
#define PyInt_Check(op) PyLong_Check(op)
3332
#define PyInt_CheckExact(op) (PyLong_CheckExact(op) && _PyLong_FitsInLong(op))
3433

35-
#define PyInt_FromString PyLong_FromString
36-
#define PyInt_FromUnicode PyLong_FromUnicode
37-
#define PyInt_FromLong PyLong_FromLong
38-
#define PyInt_FromSize_t PyLong_FromSize_t
39-
#define PyInt_FromSsize_t PyLong_FromSsize_t
40-
#define PyInt_AsLong PyLong_AsLong
41-
#define PyInt_AsSsize_t PyLong_AsSsize_t
42-
#define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask
43-
#define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
34+
#ifdef 0
35+
# define PyInt_Check(op) PyLong_Check(op)
36+
# define PyInt_FromString PyLong_FromString
37+
# define PyInt_FromUnicode PyLong_FromUnicode
38+
# define PyInt_FromLong PyLong_FromLong
39+
# define PyInt_FromSize_t PyLong_FromSize_t
40+
# define PyInt_FromSsize_t PyLong_FromSsize_t
41+
# define PyInt_AsLong PyLong_AsLong
42+
# define PyInt_AsSsize_t PyLong_AsSsize_t
43+
# define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask
44+
# define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
45+
# define PyInt_AS_LONG PyLong_AS_LONG
46+
#endif
4447

4548
PyAPI_FUNC(long) PyInt_GetMax(void);
4649

47-
#define PyInt_AS_LONG(op) PyLong_AsLong(op)
48-
4950
/* These aren't really part of the Int object, but they're handy; the protos
5051
* are necessary for systems that need the magic of PyAPI_FUNC.
5152
*/

Include/longobject.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ PyAPI_FUNC(size_t) PyLong_AsSize_t(PyObject *);
2626
PyAPI_FUNC(unsigned long) PyLong_AsUnsignedLong(PyObject *);
2727
PyAPI_FUNC(unsigned long) PyLong_AsUnsignedLongMask(PyObject *);
2828

29+
/* It may be useful in the future. I've added it in the PyInt -> PyLong
30+
cleanup to keep the extra information. [CH] */
31+
#define PyLong_AS_LONG(op) PyLong_AsLong(op)
32+
2933
/* Used by socketmodule.c */
3034
#if SIZEOF_SOCKET_T <= SIZEOF_LONG
3135
#define PyLong_FromSocket_t(fd) PyLong_FromLong((SOCKET_T)(fd))

Include/py_curses.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ static PyObject *PyCurses_ ## X (PyObject *self, PyObject *args) \
139139
static PyObject *PyCurses_ ## X (PyObject *self) \
140140
{ \
141141
PyCursesInitialised \
142-
return PyInt_FromLong((long) X()); }
142+
return PyLong_FromLong((long) X()); }
143143

144144

145145
#define NoArgReturnStringFunction(X) \

Include/pythonrun.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,6 @@ PyAPI_FUNC(void) _PyImport_Init(void);
125125
PyAPI_FUNC(void) _PyExc_Init(void);
126126
PyAPI_FUNC(void) _PyImportHooks_Init(void);
127127
PyAPI_FUNC(int) _PyFrame_Init(void);
128-
PyAPI_FUNC(int) _PyInt_Init(void);
129128
PyAPI_FUNC(void) _PyFloat_Init(void);
130129
PyAPI_FUNC(int) PyBytes_Init(void);
131130

@@ -140,7 +139,6 @@ PyAPI_FUNC(void) PyList_Fini(void);
140139
PyAPI_FUNC(void) PySet_Fini(void);
141140
PyAPI_FUNC(void) PyString_Fini(void);
142141
PyAPI_FUNC(void) PyBytes_Fini(void);
143-
PyAPI_FUNC(void) PyInt_Fini(void);
144142
PyAPI_FUNC(void) PyFloat_Fini(void);
145143
PyAPI_FUNC(void) PyOS_FiniInterrupts(void);
146144

Mac/Modules/MacOS.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ rf_tell(rfobject *self, PyObject *args)
195195
PyMac_Error(err);
196196
return NULL;
197197
}
198-
return PyInt_FromLong(where);
198+
return PyLong_FromLong(where);
199199
}
200200

201201
static char rf_close__doc__[] =

Mac/Modules/carbonevt/_CarbonEvtmodule.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,8 @@ myEventHandler(EventHandlerCallRef handlerRef, EventRef event, void *outPyObject
102102
} else {
103103
if (retValue == Py_None)
104104
status = noErr;
105-
else if (PyInt_Check(retValue)) {
106-
status = PyInt_AsLong(retValue);
105+
else if (PyLong_Check(retValue)) {
106+
status = PyLong_AsLong(retValue);
107107
} else
108108
status = noErr; /* wrong object type, complain? */
109109
Py_DECREF(retValue);

Mac/Modules/cf/pycfbridge.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ PyCF_CF2Python_simple(CFTypeRef src) {
114114
long l;
115115
if (!CFNumberGetValue(src, kCFNumberLongType, &l))
116116
/* XXXX Out of range! */;
117-
return PyInt_FromLong(l);
117+
return PyLong_FromLong(l);
118118
}
119119
}
120120
/* XXXX Should return as CFTypeRef, really... */
@@ -258,8 +258,8 @@ PyCF_Python2CF_simple(PyObject *src, CFTypeRef *dst) {
258258
*dst = kCFBooleanFalse;
259259
return 1;
260260
}
261-
if (PyInt_Check(src)) {
262-
long v = PyInt_AsLong(src);
261+
if (PyLong_Check(src)) {
262+
long v = PyLong_AsLong(src);
263263
*dst = CFNumberCreate(NULL, kCFNumberLongType, &v);
264264
return 1;
265265
}

0 commit comments

Comments
 (0)