summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
Diffstat (limited to 'Python')
-rw-r--r--Python/bltinmodule.c2
-rw-r--r--Python/ceval.c2
-rw-r--r--Python/getargs.c4
-rw-r--r--Python/marshal.c43
-rw-r--r--Python/pythonrun.c8
-rw-r--r--Python/traceback.c2
6 files changed, 32 insertions, 29 deletions
diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c
index 3e6d237..93e6058 100644
--- a/Python/bltinmodule.c
+++ b/Python/bltinmodule.c
@@ -2124,7 +2124,7 @@ _PyBuiltin_Init(void)
SETBUILTIN("float", &PyFloat_Type);
SETBUILTIN("frozenset", &PyFrozenSet_Type);
SETBUILTIN("property", &PyProperty_Type);
- SETBUILTIN("int", &PyInt_Type);
+ SETBUILTIN("int", &PyLong_Type);
SETBUILTIN("list", &PyList_Type);
SETBUILTIN("long", &PyLong_Type);
SETBUILTIN("object", &PyBaseObject_Type);
diff --git a/Python/ceval.c b/Python/ceval.c
index 978ff61..1f18545 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -3900,7 +3900,7 @@ _PyEval_SliceIndex(PyObject *v, Py_ssize_t *pi)
{
if (v != NULL) {
Py_ssize_t x;
- if (PyInt_Check(v)) {
+ if (PyInt_CheckExact(v)) {
/* XXX(nnorwitz): I think PyInt_AS_LONG is correct,
however, it looks like it should be AsSsize_t.
There should be a comment here explaining why.
diff --git a/Python/getargs.c b/Python/getargs.c
index f6ddfaa..91d9b47 100644
--- a/Python/getargs.c
+++ b/Python/getargs.c
@@ -720,9 +720,7 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags,
case 'K': { /* long long sized bitfield */
unsigned PY_LONG_LONG *p = va_arg(*p_va, unsigned PY_LONG_LONG *);
unsigned PY_LONG_LONG ival;
- if (PyInt_Check(arg))
- ival = PyInt_AsUnsignedLongMask(arg);
- else if (PyLong_Check(arg))
+ if (PyLong_Check(arg))
ival = PyLong_AsUnsignedLongLongMask(arg);
else
return converterr("integer<K>", arg, msgbuf, bufsize);
diff --git a/Python/marshal.c b/Python/marshal.c
index 1819eac..fd1bd72 100644
--- a/Python/marshal.c
+++ b/Python/marshal.c
@@ -144,31 +144,34 @@ w_object(PyObject *v, WFILE *p)
else if (v == Py_True) {
w_byte(TYPE_TRUE, p);
}
- else if (PyInt_Check(v)) {
- long x = PyInt_AS_LONG((PyIntObject *)v);
+ else if (PyLong_Check(v)) {
+ long x = PyLong_AsLong(v);
+ if ((x == -1) && PyErr_Occurred()) {
+ PyLongObject *ob = (PyLongObject *)v;
+ PyErr_Clear();
+ w_byte(TYPE_LONG, p);
+ n = ob->ob_size;
+ w_long((long)n, p);
+ if (n < 0)
+ n = -n;
+ for (i = 0; i < n; i++)
+ w_short(ob->ob_digit[i], p);
+ }
+ else {
#if SIZEOF_LONG > 4
- long y = Py_ARITHMETIC_RIGHT_SHIFT(long, x, 31);
- if (y && y != -1) {
- w_byte(TYPE_INT64, p);
- w_long64(x, p);
- }
- else
+ long y = Py_ARITHMETIC_RIGHT_SHIFT(long, x, 31);
+ if (y && y != -1) {
+ w_byte(TYPE_INT64, p);
+ w_long64(x, p);
+ }
+ else
#endif
{
- w_byte(TYPE_INT, p);
- w_long(x, p);
+ w_byte(TYPE_INT, p);
+ w_long(x, p);
+ }
}
}
- else if (PyLong_Check(v)) {
- PyLongObject *ob = (PyLongObject *)v;
- w_byte(TYPE_LONG, p);
- n = ob->ob_size;
- w_long((long)n, p);
- if (n < 0)
- n = -n;
- for (i = 0; i < n; i++)
- w_short(ob->ob_digit[i], p);
- }
else if (PyFloat_Check(v)) {
if (p->version > 1) {
unsigned char buf[8];
diff --git a/Python/pythonrun.c b/Python/pythonrun.c
index 15fad81..ad6c44f 100644
--- a/Python/pythonrun.c
+++ b/Python/pythonrun.c
@@ -60,6 +60,8 @@ static void call_sys_exitfunc(void);
static void call_ll_exitfuncs(void);
extern void _PyUnicode_Init(void);
extern void _PyUnicode_Fini(void);
+extern int _PyLong_Init(void);
+extern void PyLong_Fini(void);
#ifdef WITH_THREAD
extern void _PyGILState_Init(PyInterpreterState *, PyThreadState *);
@@ -181,8 +183,8 @@ Py_InitializeEx(int install_sigs)
if (!_PyFrame_Init())
Py_FatalError("Py_Initialize: can't init frames");
- if (!_PyInt_Init())
- Py_FatalError("Py_Initialize: can't init ints");
+ if (!_PyLong_Init())
+ Py_FatalError("Py_Initialize: can't init longs");
_PyFloat_Init();
@@ -453,7 +455,7 @@ Py_Finalize(void)
PyList_Fini();
PySet_Fini();
PyString_Fini();
- PyInt_Fini();
+ PyLong_Fini();
PyFloat_Fini();
#ifdef Py_USING_UNICODE
diff --git a/Python/traceback.c b/Python/traceback.c
index cfbd833..04078b9 100644
--- a/Python/traceback.c
+++ b/Python/traceback.c
@@ -250,7 +250,7 @@ PyTraceBack_Print(PyObject *v, PyObject *f)
return -1;
}
limitv = PySys_GetObject("tracebacklimit");
- if (limitv && PyInt_Check(limitv)) {
+ if (limitv && PyInt_CheckExact(limitv)) {
limit = PyInt_AsLong(limitv);
if (limit <= 0)
return 0;