From 217cfd1c86c59ed8a55ce6d6b88bbe37309e7ba2 Mon Sep 17 00:00:00 2001 From: Christian Heimes Date: Sun, 2 Dec 2007 14:31:20 +0000 Subject: Cleanup: Replaced most PyInt_ aliases with PyLong_ and disabled the aliases in intobject.h --- Python/Python-ast.c | 2 +- Python/ast.c | 4 ++-- Python/bltinmodule.c | 30 ++++++++++++++--------------- Python/ceval.c | 50 ++++++++++++++++++++++++------------------------- Python/compile.c | 20 ++++++++++---------- Python/errors.c | 2 +- Python/getargs.c | 16 ++++++++-------- Python/import.c | 4 ++-- Python/mactoolboxglue.c | 6 +++--- Python/marshal.c | 4 ++-- Python/modsupport.c | 14 +++++++------- Python/pystate.c | 2 +- Python/pythonrun.c | 8 ++++---- Python/structmember.c | 24 ++++++++++++------------ Python/symtable.c | 44 +++++++++++++++++++++---------------------- Python/sysmodule.c | 20 ++++++++++---------- Python/traceback.c | 2 +- 17 files changed, 126 insertions(+), 126 deletions(-) (limited to 'Python') diff --git a/Python/Python-ast.c b/Python/Python-ast.c index 0ccf489d45..c46176cb6a 100644 --- a/Python/Python-ast.c +++ b/Python/Python-ast.c @@ -464,7 +464,7 @@ static PyObject* ast2obj_object(void *o) static PyObject* ast2obj_int(long b) { - return PyInt_FromLong(b); + return PyLong_FromLong(b); } static int init_types(void) diff --git a/Python/ast.c b/Python/ast.c index da75975e4c..6ad43dd798 100644 --- a/Python/ast.c +++ b/Python/ast.c @@ -110,7 +110,7 @@ ast_error_finish(const char *filename) if (!errstr) return; Py_INCREF(errstr); - lineno = PyInt_AsLong(PyTuple_GetItem(value, 1)); + lineno = PyLong_AsLong(PyTuple_GetItem(value, 1)); if (lineno == -1) { Py_DECREF(errstr); return; @@ -3074,7 +3074,7 @@ parsenumber(const char *s) if (*end == '\0') { if (errno != 0) return PyLong_FromString((char *)s, (char **)0, 0); - return PyInt_FromLong(x); + return PyLong_FromLong(x); } /* XXX Huge floats may silently fail */ #ifndef WITHOUT_COMPLEX diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c index 053e083a4b..b57083b455 100644 --- a/Python/bltinmodule.c +++ b/Python/bltinmodule.c @@ -378,7 +378,7 @@ builtin_cmp(PyObject *self, PyObject *args) return NULL; if (PyObject_Cmp(a, b, &c) < 0) return NULL; - return PyInt_FromLong((long)c); + return PyLong_FromLong((long)c); } PyDoc_STRVAR(cmp_doc, @@ -890,7 +890,7 @@ builtin_hash(PyObject *self, PyObject *v) x = PyObject_Hash(v); if (x == -1) return NULL; - return PyInt_FromLong(x); + return PyLong_FromLong(x); } PyDoc_STRVAR(hash_doc, @@ -946,7 +946,7 @@ builtin_len(PyObject *self, PyObject *v) res = PyObject_Size(v); if (res < 0 && PyErr_Occurred()) return NULL; - return PyInt_FromSsize_t(res); + return PyLong_FromSsize_t(res); } PyDoc_STRVAR(len_doc, @@ -1105,14 +1105,14 @@ builtin_ord(PyObject *self, PyObject* obj) size = PyString_GET_SIZE(obj); if (size == 1) { ord = (long)((unsigned char)*PyString_AS_STRING(obj)); - return PyInt_FromLong(ord); + return PyLong_FromLong(ord); } } else if (PyUnicode_Check(obj)) { size = PyUnicode_GET_SIZE(obj); if (size == 1) { ord = (long)*PyUnicode_AS_UNICODE(obj); - return PyInt_FromLong(ord); + return PyLong_FromLong(ord); } #ifndef Py_UNICODE_WIDE if (size == 2) { @@ -1123,7 +1123,7 @@ builtin_ord(PyObject *self, PyObject* obj) 0xDC00 <= c1 && c1 <= 0xDFFF) { ord = ((((c0 & 0x03FF) << 10) | (c1 & 0x03FF)) + 0x00010000); - return PyInt_FromLong(ord); + return PyLong_FromLong(ord); } } #endif @@ -1133,7 +1133,7 @@ builtin_ord(PyObject *self, PyObject* obj) size = PyBytes_GET_SIZE(obj); if (size == 1) { ord = (long)((unsigned char)*PyBytes_AS_STRING(obj)); - return PyInt_FromLong(ord); + return PyLong_FromLong(ord); } } else { @@ -1300,7 +1300,7 @@ builtin_input(PyObject *self, PyObject *args) tty = 0; } else { - fd = PyInt_AsLong(tmp); + fd = PyLong_AsLong(tmp); Py_DECREF(tmp); if (fd < 0 && PyErr_Occurred()) return NULL; @@ -1311,7 +1311,7 @@ builtin_input(PyObject *self, PyObject *args) if (tmp == NULL) PyErr_Clear(); else { - fd = PyInt_AsLong(tmp); + fd = PyLong_AsLong(tmp); Py_DECREF(tmp); if (fd < 0 && PyErr_Occurred()) return NULL; @@ -1595,7 +1595,7 @@ builtin_sum(PyObject *self, PyObject *args) return NULL; if (result == NULL) { - result = PyInt_FromLong(0); + result = PyLong_FromLong(0); if (result == NULL) { Py_DECREF(iter); return NULL; @@ -1624,7 +1624,7 @@ builtin_sum(PyObject *self, PyObject *args) to the more general routine. */ if (PyInt_CheckExact(result)) { - long i_result = PyInt_AS_LONG(result); + long i_result = PyLong_AS_LONG(result); Py_DECREF(result); result = NULL; while(result == NULL) { @@ -1633,10 +1633,10 @@ builtin_sum(PyObject *self, PyObject *args) Py_DECREF(iter); if (PyErr_Occurred()) return NULL; - return PyInt_FromLong(i_result); + return PyLong_FromLong(i_result); } if (PyInt_CheckExact(item)) { - long b = PyInt_AS_LONG(item); + long b = PyLong_AS_LONG(item); long x = i_result + b; if ((x^i_result) >= 0 || (x^b) >= 0) { i_result = x; @@ -1645,7 +1645,7 @@ builtin_sum(PyObject *self, PyObject *args) } } /* Either overflowed or is not an int. Restore real objects and process normally */ - result = PyInt_FromLong(i_result); + result = PyLong_FromLong(i_result); temp = PyNumber_Add(result, item); Py_DECREF(result); Py_DECREF(item); @@ -1678,7 +1678,7 @@ builtin_sum(PyObject *self, PyObject *args) } if (PyInt_CheckExact(item)) { PyFPE_START_PROTECT("add", return 0) - f_result += (double)PyInt_AS_LONG(item); + f_result += (double)PyLong_AS_LONG(item); PyFPE_END_PROTECT(f_result) Py_DECREF(item); continue; diff --git a/Python/ceval.c b/Python/ceval.c index b4efa33e74..d223f5e72d 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -1121,12 +1121,12 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag) if (PyInt_CheckExact(v) && PyInt_CheckExact(w)) { /* INLINE: int + int */ register long a, b, i; - a = PyInt_AS_LONG(v); - b = PyInt_AS_LONG(w); + a = PyLong_AS_LONG(v); + b = PyLong_AS_LONG(w); i = a + b; if ((i^a) < 0 && (i^b) < 0) goto slow_add; - x = PyInt_FromLong(i); + x = PyLong_FromLong(i); } else if (PyUnicode_CheckExact(v) && PyUnicode_CheckExact(w)) { @@ -1151,12 +1151,12 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag) if (PyInt_CheckExact(v) && PyInt_CheckExact(w)) { /* INLINE: int - int */ register long a, b, i; - a = PyInt_AS_LONG(v); - b = PyInt_AS_LONG(w); + a = PyLong_AS_LONG(v); + b = PyLong_AS_LONG(w); i = a - b; if ((i^a) < 0 && (i^~b) < 0) goto slow_sub; - x = PyInt_FromLong(i); + x = PyLong_FromLong(i); } else { slow_sub: @@ -1173,7 +1173,7 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag) v = TOP(); if (PyList_CheckExact(v) && PyInt_CheckExact(w)) { /* INLINE: list[int] */ - Py_ssize_t i = PyInt_AsSsize_t(w); + Py_ssize_t i = PyLong_AsSsize_t(w); if (i < 0) i += PyList_GET_SIZE(v); if (i >= 0 && i < PyList_GET_SIZE(v)) { @@ -1322,12 +1322,12 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag) if (PyInt_CheckExact(v) && PyInt_CheckExact(w)) { /* INLINE: int + int */ register long a, b, i; - a = PyInt_AS_LONG(v); - b = PyInt_AS_LONG(w); + a = PyLong_AS_LONG(v); + b = PyLong_AS_LONG(w); i = a + b; if ((i^a) < 0 && (i^b) < 0) goto slow_iadd; - x = PyInt_FromLong(i); + x = PyLong_FromLong(i); } else if (PyUnicode_CheckExact(v) && PyUnicode_CheckExact(w)) { @@ -1352,12 +1352,12 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag) if (PyInt_CheckExact(v) && PyInt_CheckExact(w)) { /* INLINE: int - int */ register long a, b, i; - a = PyInt_AS_LONG(v); - b = PyInt_AS_LONG(w); + a = PyLong_AS_LONG(v); + b = PyLong_AS_LONG(w); i = a - b; if ((i^a) < 0 && (i^~b) < 0) goto slow_isub; - x = PyInt_FromLong(i); + x = PyLong_FromLong(i); } else { slow_isub: @@ -1518,8 +1518,8 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag) case END_FINALLY: v = POP(); - if (PyInt_Check(v)) { - why = (enum why_code) PyInt_AS_LONG(v); + if (PyLong_Check(v)) { + why = (enum why_code) PyLong_AS_LONG(v); assert(why != WHY_YIELD); if (why == WHY_RETURN || why == WHY_CONTINUE) @@ -1869,8 +1869,8 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag) /* INLINE: cmp(int, int) */ register long a, b; register int res; - a = PyInt_AS_LONG(v); - b = PyInt_AS_LONG(w); + a = PyLong_AS_LONG(v); + b = PyLong_AS_LONG(w); switch (oparg) { case PyCmp_LT: res = a < b; break; case PyCmp_LE: res = a <= b; break; @@ -1907,7 +1907,7 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag) } v = POP(); u = TOP(); - if (PyInt_AsLong(u) != -1 || PyErr_Occurred()) + if (PyLong_AsLong(u) != -1 || PyErr_Occurred()) w = PyTuple_Pack(5, w, f->f_globals, @@ -2066,7 +2066,7 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag) goto fast_block_end; case CONTINUE_LOOP: - retval = PyInt_FromLong(oparg); + retval = PyLong_FromLong(oparg); if (!retval) { x = NULL; break; @@ -2109,7 +2109,7 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag) x = TOP(); u = SECOND(); - if (PyInt_Check(u) || u == Py_None) { + if (PyLong_Check(u) || u == Py_None) { u = v = w = Py_None; } else { @@ -2392,7 +2392,7 @@ fast_block_end: PyFrame_BlockSetup(f, b->b_type, b->b_handler, b->b_level); why = WHY_NOT; - JUMPTO(PyInt_AS_LONG(retval)); + JUMPTO(PyLong_AS_LONG(retval)); Py_DECREF(retval); break; } @@ -2438,7 +2438,7 @@ fast_block_end: else { if (why & (WHY_RETURN | WHY_CONTINUE)) PUSH(retval); - v = PyInt_FromLong((long)why); + v = PyLong_FromLong((long)why); PUSH(v); } why = WHY_NOT; @@ -3797,11 +3797,11 @@ _PyEval_SliceIndex(PyObject *v, Py_ssize_t *pi) if (v != NULL) { Py_ssize_t x; if (PyInt_CheckExact(v)) { - /* XXX(nnorwitz): I think PyInt_AS_LONG is correct, + /* XXX(nnorwitz): I think PyLong_AS_LONG is correct, however, it looks like it should be AsSsize_t. There should be a comment here explaining why. */ - x = PyInt_AS_LONG(v); + x = PyLong_AS_LONG(v); } else if (PyIndex_Check(v)) { x = PyNumber_AsSsize_t(v, NULL); @@ -4051,7 +4051,7 @@ getarray(long a[256]) PyObject *l = PyList_New(256); if (l == NULL) return NULL; for (i = 0; i < 256; i++) { - PyObject *x = PyInt_FromLong(a[i]); + PyObject *x = PyLong_FromLong(a[i]); if (x == NULL) { Py_DECREF(l); return NULL; diff --git a/Python/compile.c b/Python/compile.c index 80c97eba6a..8951331053 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -335,7 +335,7 @@ list2dict(PyObject *list) n = PyList_Size(list); for (i = 0; i < n; i++) { - v = PyInt_FromLong(i); + v = PyLong_FromLong(i); if (!v) { Py_DECREF(dict); return NULL; @@ -375,12 +375,12 @@ dictbytype(PyObject *src, int scope_type, int flag, int offset) while (PyDict_Next(src, &pos, &k, &v)) { /* XXX this should probably be a macro in symtable.h */ long vi; - assert(PyInt_Check(v)); - vi = PyInt_AS_LONG(v); + assert(PyLong_Check(v)); + vi = PyLong_AS_LONG(v); scope = (vi >> SCOPE_OFFSET) & SCOPE_MASK; if (scope == scope_type || vi & flag) { - PyObject *tuple, *item = PyInt_FromLong(i); + PyObject *tuple, *item = PyLong_FromLong(i); if (item == NULL) { Py_DECREF(dest); return NULL; @@ -907,7 +907,7 @@ compiler_add_o(struct compiler *c, PyObject *dict, PyObject *o) if (PyErr_Occurred()) return -1; arg = PyDict_Size(dict); - v = PyInt_FromLong(arg); + v = PyLong_FromLong(arg); if (!v) { Py_DECREF(t); return -1; @@ -920,7 +920,7 @@ compiler_add_o(struct compiler *c, PyObject *dict, PyObject *o) Py_DECREF(v); } else - arg = PyInt_AsLong(v); + arg = PyLong_AsLong(v); Py_DECREF(t); return arg; } @@ -1208,7 +1208,7 @@ compiler_lookup_arg(PyObject *dict, PyObject *name) Py_DECREF(k); if (v == NULL) return -1; - return PyInt_AS_LONG(v); + return PyLong_AS_LONG(v); } static int @@ -2065,7 +2065,7 @@ compiler_import(struct compiler *c, stmt_ty s) int r; PyObject *level; - level = PyInt_FromLong(0); + level = PyLong_FromLong(0); if (level == NULL) return 0; @@ -2108,7 +2108,7 @@ compiler_from_import(struct compiler *c, stmt_ty s) if (!names) return 0; - level = PyInt_FromLong(s->v.ImportFrom.level); + level = PyLong_FromLong(s->v.ImportFrom.level); if (!level) { Py_DECREF(names); return 0; @@ -3916,7 +3916,7 @@ dict_keys_inorder(PyObject *dict, int offset) if (tuple == NULL) return NULL; while (PyDict_Next(dict, &pos, &k, &v)) { - i = PyInt_AS_LONG(v); + i = PyLong_AS_LONG(v); k = PyTuple_GET_ITEM(k, 0); Py_INCREF(k); assert((i - offset) < size); diff --git a/Python/errors.c b/Python/errors.c index 063187bf51..79f711dd83 100644 --- a/Python/errors.c +++ b/Python/errors.c @@ -752,7 +752,7 @@ PyErr_SyntaxLocation(const char *filename, int lineno) PyErr_NormalizeException(&exc, &v, &tb); /* XXX check that it is, indeed, a syntax error. It might not * be, though. */ - tmp = PyInt_FromLong(lineno); + tmp = PyLong_FromLong(lineno); if (tmp == NULL) PyErr_Clear(); else { diff --git a/Python/getargs.c b/Python/getargs.c index f6cdd7c0f4..aeeb04cee3 100644 --- a/Python/getargs.c +++ b/Python/getargs.c @@ -556,7 +556,7 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags, long ival; if (float_argument_error(arg)) return converterr("integer", arg, msgbuf, bufsize); - ival = PyInt_AsLong(arg); + ival = PyLong_AsLong(arg); if (ival == -1 && PyErr_Occurred()) return converterr("integer", arg, msgbuf, bufsize); else if (ival < 0) { @@ -580,7 +580,7 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags, long ival; if (float_argument_error(arg)) return converterr("integer", arg, msgbuf, bufsize); - ival = PyInt_AsUnsignedLongMask(arg); + ival = PyLong_AsUnsignedLongMask(arg); if (ival == -1 && PyErr_Occurred()) return converterr("integer", arg, msgbuf, bufsize); else @@ -593,7 +593,7 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags, long ival; if (float_argument_error(arg)) return converterr("integer", arg, msgbuf, bufsize); - ival = PyInt_AsLong(arg); + ival = PyLong_AsLong(arg); if (ival == -1 && PyErr_Occurred()) return converterr("integer", arg, msgbuf, bufsize); else if (ival < SHRT_MIN) { @@ -617,7 +617,7 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags, long ival; if (float_argument_error(arg)) return converterr("integer", arg, msgbuf, bufsize); - ival = PyInt_AsUnsignedLongMask(arg); + ival = PyLong_AsUnsignedLongMask(arg); if (ival == -1 && PyErr_Occurred()) return converterr("integer", arg, msgbuf, bufsize); else @@ -630,7 +630,7 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags, long ival; if (float_argument_error(arg)) return converterr("integer", arg, msgbuf, bufsize); - ival = PyInt_AsLong(arg); + ival = PyLong_AsLong(arg); if (ival == -1 && PyErr_Occurred()) return converterr("integer", arg, msgbuf, bufsize); else if (ival > INT_MAX) { @@ -654,7 +654,7 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags, unsigned int ival; if (float_argument_error(arg)) return converterr("integer", arg, msgbuf, bufsize); - ival = (unsigned int)PyInt_AsUnsignedLongMask(arg); + ival = (unsigned int)PyLong_AsUnsignedLongMask(arg); if (ival == (unsigned int)-1 && PyErr_Occurred()) return converterr("integer", arg, msgbuf, bufsize); else @@ -672,7 +672,7 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags, return converterr("integer", arg, msgbuf, bufsize); iobj = PyNumber_Index(arg); if (iobj != NULL) - ival = PyInt_AsSsize_t(arg); + ival = PyLong_AsSsize_t(arg); if (ival == -1 && PyErr_Occurred()) return converterr("integer", arg, msgbuf, bufsize); *p = ival; @@ -685,7 +685,7 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags, long ival; if (float_argument_error(arg)) return converterr("integer", arg, msgbuf, bufsize); - ival = PyInt_AsLong(arg); + ival = PyLong_AsLong(arg); if (ival == -1 && PyErr_Occurred()) return converterr("integer", arg, msgbuf, bufsize); else diff --git a/Python/import.c b/Python/import.c index 419f3e9043..221c2dd2d2 100644 --- a/Python/import.c +++ b/Python/import.c @@ -2687,7 +2687,7 @@ imp_is_builtin(PyObject *self, PyObject *args) char *name; if (!PyArg_ParseTuple(args, "s:is_builtin", &name)) return NULL; - return PyInt_FromLong(is_builtin(name)); + return PyLong_FromLong(is_builtin(name)); } static PyObject * @@ -2921,7 +2921,7 @@ setint(PyObject *d, char *name, int value) PyObject *v; int err; - v = PyInt_FromLong((long)value); + v = PyLong_FromLong((long)value); err = PyDict_SetItemString(d, name, v); Py_XDECREF(v); return err; diff --git a/Python/mactoolboxglue.c b/Python/mactoolboxglue.c index 454553ef6d..6688b02459 100644 --- a/Python/mactoolboxglue.c +++ b/Python/mactoolboxglue.c @@ -348,9 +348,9 @@ PyMac_BuildFixed(Fixed f) int PyMac_Getwide(PyObject *v, wide *rv) { - if (PyInt_Check(v)) { + if (PyLong_Check(v)) { rv->hi = 0; - rv->lo = PyInt_AsLong(v); + rv->lo = PyLong_AsLong(v); if( rv->lo & 0x80000000 ) rv->hi = -1; return 1; @@ -364,7 +364,7 @@ PyMac_Buildwide(wide *w) { if ( (w->hi == 0 && (w->lo & 0x80000000) == 0) || (w->hi == -1 && (w->lo & 0x80000000) ) ) - return PyInt_FromLong(w->lo); + return PyLong_FromLong(w->lo); return Py_BuildValue("(ll)", w->hi, w->lo); } diff --git a/Python/marshal.c b/Python/marshal.c index 3e106c21d4..c06ef8bb26 100644 --- a/Python/marshal.c +++ b/Python/marshal.c @@ -460,7 +460,7 @@ r_long64(RFILE *p) long hi4 = r_long(p); #if SIZEOF_LONG > 4 long x = (hi4 << 32) | (lo4 & 0xFFFFFFFFL); - return PyInt_FromLong(x); + return PyLong_FromLong(x); #else unsigned char buf[8]; int one = 1; @@ -533,7 +533,7 @@ r_object(RFILE *p) break; case TYPE_INT: - retval = PyInt_FromLong(r_long(p)); + retval = PyLong_FromLong(r_long(p)); break; case TYPE_INT64: diff --git a/Python/modsupport.c b/Python/modsupport.c index 144fb4f2d8..aca57a4b00 100644 --- a/Python/modsupport.c +++ b/Python/modsupport.c @@ -307,10 +307,10 @@ do_mkvalue(const char **p_format, va_list *p_va, int flags) case 'B': case 'h': case 'i': - return PyInt_FromLong((long)va_arg(*p_va, int)); + return PyLong_FromLong((long)va_arg(*p_va, int)); case 'H': - return PyInt_FromLong((long)va_arg(*p_va, unsigned int)); + return PyLong_FromLong((long)va_arg(*p_va, unsigned int)); case 'I': { @@ -319,16 +319,16 @@ do_mkvalue(const char **p_format, va_list *p_va, int flags) if (n > (unsigned long)PyInt_GetMax()) return PyLong_FromUnsignedLong((unsigned long)n); else - return PyInt_FromLong(n); + return PyLong_FromLong(n); } case 'n': #if SIZEOF_SIZE_T!=SIZEOF_LONG - return PyInt_FromSsize_t(va_arg(*p_va, Py_ssize_t)); + return PyLong_FromSsize_t(va_arg(*p_va, Py_ssize_t)); #endif /* Fall through from 'n' to 'l' if Py_ssize_t is long */ case 'l': - return PyInt_FromLong(va_arg(*p_va, long)); + return PyLong_FromLong(va_arg(*p_va, long)); case 'k': { @@ -337,7 +337,7 @@ do_mkvalue(const char **p_format, va_list *p_va, int flags) if (n > (unsigned long)PyInt_GetMax()) return PyLong_FromUnsignedLong(n); else - return PyInt_FromLong(n); + return PyLong_FromLong(n); } #ifdef HAVE_LONG_LONG @@ -702,7 +702,7 @@ PyModule_AddObject(PyObject *m, const char *name, PyObject *o) int PyModule_AddIntConstant(PyObject *m, const char *name, long value) { - return PyModule_AddObject(m, name, PyInt_FromLong(value)); + return PyModule_AddObject(m, name, PyLong_FromLong(value)); } int diff --git a/Python/pystate.c b/Python/pystate.c index 1914ba8e14..030138d84e 100644 --- a/Python/pystate.c +++ b/Python/pystate.c @@ -445,7 +445,7 @@ _PyThread_CurrentFrames(void) struct _frame *frame = t->frame; if (frame == NULL) continue; - id = PyInt_FromLong(t->thread_id); + id = PyLong_FromLong(t->thread_id); if (id == NULL) goto Fail; stat = PyDict_SetItem(result, id, (PyObject *)frame); diff --git a/Python/pythonrun.c b/Python/pythonrun.c index d1a062b950..f46b90e8ac 100644 --- a/Python/pythonrun.c +++ b/Python/pythonrun.c @@ -1109,7 +1109,7 @@ parse_syntax_error(PyObject *err, PyObject **message, const char **filename, Py_DECREF(v); if (!(v = PyObject_GetAttrString(err, "lineno"))) goto finally; - hold = PyInt_AsLong(v); + hold = PyLong_AsLong(v); Py_DECREF(v); v = NULL; if (hold < 0 && PyErr_Occurred()) @@ -1123,7 +1123,7 @@ parse_syntax_error(PyObject *err, PyObject **message, const char **filename, Py_DECREF(v); v = NULL; } else { - hold = PyInt_AsLong(v); + hold = PyLong_AsLong(v); Py_DECREF(v); v = NULL; if (hold < 0 && PyErr_Occurred()) @@ -1213,8 +1213,8 @@ handle_system_exit(void) /* If we failed to dig out the 'code' attribute, just let the else clause below print the error. */ } - if (PyInt_Check(value)) - exitcode = (int)PyInt_AsLong(value); + if (PyLong_Check(value)) + exitcode = (int)PyLong_AsLong(value); else { PyObject_Print(value, stderr, Py_PRINT_RAW); PySys_WriteStderr("\n"); diff --git a/Python/structmember.c b/Python/structmember.c index c4b7d80873..f8588ccf81 100644 --- a/Python/structmember.c +++ b/Python/structmember.c @@ -13,31 +13,31 @@ PyMember_GetOne(const char *addr, PyMemberDef *l) addr += l->offset; switch (l->type) { case T_BYTE: - v = PyInt_FromLong(*(char*)addr); + v = PyLong_FromLong(*(char*)addr); break; case T_UBYTE: v = PyLong_FromUnsignedLong(*(unsigned char*)addr); break; case T_SHORT: - v = PyInt_FromLong(*(short*)addr); + v = PyLong_FromLong(*(short*)addr); break; case T_USHORT: v = PyLong_FromUnsignedLong(*(unsigned short*)addr); break; case T_INT: - v = PyInt_FromLong(*(int*)addr); + v = PyLong_FromLong(*(int*)addr); break; case T_UINT: v = PyLong_FromUnsignedLong(*(unsigned int*)addr); break; case T_LONG: - v = PyInt_FromLong(*(long*)addr); + v = PyLong_FromLong(*(long*)addr); break; case T_ULONG: v = PyLong_FromUnsignedLong(*(unsigned long*)addr); break; case T_PYSSIZET: - v = PyInt_FromSsize_t(*(Py_ssize_t*)addr); + v = PyLong_FromSsize_t(*(Py_ssize_t*)addr); break; case T_FLOAT: v = PyFloat_FromDouble((double)*(float*)addr); @@ -114,7 +114,7 @@ PyMember_SetOne(char *addr, PyMemberDef *l, PyObject *v) addr += l->offset; switch (l->type) { case T_BYTE:{ - long long_val = PyInt_AsLong(v); + long long_val = PyLong_AsLong(v); if ((long_val == -1) && PyErr_Occurred()) return -1; *(char*)addr = (char)long_val; @@ -125,7 +125,7 @@ PyMember_SetOne(char *addr, PyMemberDef *l, PyObject *v) break; } case T_UBYTE:{ - long long_val = PyInt_AsLong(v); + long long_val = PyLong_AsLong(v); if ((long_val == -1) && PyErr_Occurred()) return -1; *(unsigned char*)addr = (unsigned char)long_val; @@ -134,7 +134,7 @@ PyMember_SetOne(char *addr, PyMemberDef *l, PyObject *v) break; } case T_SHORT:{ - long long_val = PyInt_AsLong(v); + long long_val = PyLong_AsLong(v); if ((long_val == -1) && PyErr_Occurred()) return -1; *(short*)addr = (short)long_val; @@ -143,7 +143,7 @@ PyMember_SetOne(char *addr, PyMemberDef *l, PyObject *v) break; } case T_USHORT:{ - long long_val = PyInt_AsLong(v); + long long_val = PyLong_AsLong(v); if ((long_val == -1) && PyErr_Occurred()) return -1; *(unsigned short*)addr = (unsigned short)long_val; @@ -152,7 +152,7 @@ PyMember_SetOne(char *addr, PyMemberDef *l, PyObject *v) break; } case T_INT:{ - long long_val = PyInt_AsLong(v); + long long_val = PyLong_AsLong(v); if ((long_val == -1) && PyErr_Occurred()) return -1; *(int *)addr = (int)long_val; @@ -199,7 +199,7 @@ PyMember_SetOne(char *addr, PyMemberDef *l, PyObject *v) break; } case T_PYSSIZET:{ - *(Py_ssize_t*)addr = PyInt_AsSsize_t(v); + *(Py_ssize_t*)addr = PyLong_AsSsize_t(v); if ((*(Py_ssize_t*)addr == (Py_ssize_t)-1) && PyErr_Occurred()) return -1; @@ -248,7 +248,7 @@ PyMember_SetOne(char *addr, PyMemberDef *l, PyObject *v) if (PyLong_Check(v)) *(unsigned PY_LONG_LONG*)addr = value = PyLong_AsUnsignedLongLong(v); else - *(unsigned PY_LONG_LONG*)addr = value = PyInt_AsLong(v); + *(unsigned PY_LONG_LONG*)addr = value = PyLong_AsLong(v); if ((value == (unsigned PY_LONG_LONG)-1) && PyErr_Occurred()) return -1; break; diff --git a/Python/symtable.c b/Python/symtable.c index 968fe2522e..84d0067b68 100644 --- a/Python/symtable.c +++ b/Python/symtable.c @@ -90,7 +90,7 @@ ste_repr(PySTEntryObject *ste) { return PyUnicode_FromFormat("", ste->ste_name, - PyInt_AS_LONG(ste->ste_id), ste->ste_lineno); + PyLong_AS_LONG(ste->ste_id), ste->ste_lineno); } static void @@ -310,8 +310,8 @@ PyST_GetScope(PySTEntryObject *ste, PyObject *name) PyObject *v = PyDict_GetItem(ste->ste_symbols, name); if (!v) return 0; - assert(PyInt_Check(v)); - return (PyInt_AS_LONG(v) >> SCOPE_OFFSET) & SCOPE_MASK; + assert(PyLong_Check(v)); + return (PyLong_AS_LONG(v) >> SCOPE_OFFSET) & SCOPE_MASK; } @@ -361,7 +361,7 @@ PyST_GetScope(PySTEntryObject *ste, PyObject *name) */ #define SET_SCOPE(DICT, NAME, I) { \ - PyObject *o = PyInt_FromLong(I); \ + PyObject *o = PyLong_FromLong(I); \ if (!o) \ return 0; \ if (PyDict_SetItem((DICT), (NAME), o) < 0) { \ @@ -476,13 +476,13 @@ analyze_cells(PyObject *scopes, PyObject *free, const char *restricted) int success = 0; Py_ssize_t pos = 0; - v_cell = PyInt_FromLong(CELL); + v_cell = PyLong_FromLong(CELL); if (!v_cell) return 0; while (PyDict_Next(scopes, &pos, &name, &v)) { long scope; - assert(PyInt_Check(v)); - scope = PyInt_AS_LONG(v); + assert(PyLong_Check(v)); + scope = PyLong_AS_LONG(v); if (scope != LOCAL) continue; if (!PySet_Contains(free, name)) @@ -548,13 +548,13 @@ update_symbols(PyObject *symbols, PyObject *scopes, /* Update scope information for all symbols in this scope */ while (PyDict_Next(symbols, &pos, &name, &v)) { long scope, flags; - assert(PyInt_Check(v)); - flags = PyInt_AS_LONG(v); + assert(PyLong_Check(v)); + flags = PyLong_AS_LONG(v); v_scope = PyDict_GetItem(scopes, name); - assert(v_scope && PyInt_Check(v_scope)); - scope = PyInt_AS_LONG(v_scope); + assert(v_scope && PyLong_Check(v_scope)); + scope = PyLong_AS_LONG(v_scope); flags |= (scope << SCOPE_OFFSET); - v_new = PyInt_FromLong(flags); + v_new = PyLong_FromLong(flags); if (!v_new) return 0; if (PyDict_SetItem(symbols, name, v_new) < 0) { @@ -565,7 +565,7 @@ update_symbols(PyObject *symbols, PyObject *scopes, } /* Record not yet resolved free variables from children (if any) */ - v_free = PyInt_FromLong(FREE << SCOPE_OFFSET); + v_free = PyLong_FromLong(FREE << SCOPE_OFFSET); if (!v_free) return 0; @@ -583,9 +583,9 @@ update_symbols(PyObject *symbols, PyObject *scopes, or global in the class scope. */ if (classflag && - PyInt_AS_LONG(v) & (DEF_BOUND | DEF_GLOBAL)) { - long flags = PyInt_AS_LONG(v) | DEF_FREE_CLASS; - v_new = PyInt_FromLong(flags); + PyLong_AS_LONG(v) & (DEF_BOUND | DEF_GLOBAL)) { + long flags = PyLong_AS_LONG(v) | DEF_FREE_CLASS; + v_new = PyLong_FromLong(flags); if (!v_new) { goto error; } @@ -675,7 +675,7 @@ analyze_block(PySTEntryObject *ste, PyObject *bound, PyObject *free, assert(PySTEntry_Check(ste)); assert(PyDict_Check(ste->ste_symbols)); while (PyDict_Next(ste->ste_symbols, &pos, &name, &v)) { - long flags = PyInt_AS_LONG(v); + long flags = PyLong_AS_LONG(v); if (!analyze_name(ste, scopes, name, flags, bound, local, free, global)) goto error; @@ -849,7 +849,7 @@ symtable_lookup(struct symtable *st, PyObject *name) Py_DECREF(mangled); if (!o) return 0; - return PyInt_AsLong(o); + return PyLong_AsLong(o); } static int @@ -865,7 +865,7 @@ symtable_add_def(struct symtable *st, PyObject *name, int flag) return 0; dict = st->st_cur->ste_symbols; if ((o = PyDict_GetItem(dict, mangled))) { - val = PyInt_AS_LONG(o); + val = PyLong_AS_LONG(o); if ((flag & DEF_PARAM) && (val & DEF_PARAM)) { /* Is it better to use 'mangled' or 'name' here? */ PyErr_Format(PyExc_SyntaxError, DUPLICATE_ARGUMENT, name); @@ -876,7 +876,7 @@ symtable_add_def(struct symtable *st, PyObject *name, int flag) val |= flag; } else val = flag; - o = PyInt_FromLong(val); + o = PyLong_FromLong(val); if (o == NULL) goto error; if (PyDict_SetItem(dict, mangled, o) < 0) { @@ -893,9 +893,9 @@ symtable_add_def(struct symtable *st, PyObject *name, int flag) perhaps only DEF_FREE_GLOBAL */ val = flag; if ((o = PyDict_GetItem(st->st_global, mangled))) { - val |= PyInt_AS_LONG(o); + val |= PyLong_AS_LONG(o); } - o = PyInt_FromLong(val); + o = PyLong_FromLong(val); if (o == NULL) goto error; if (PyDict_SetItem(st->st_global, mangled, o) < 0) { diff --git a/Python/sysmodule.c b/Python/sysmodule.c index e793707d38..e77b1f6805 100644 --- a/Python/sysmodule.c +++ b/Python/sysmodule.c @@ -411,7 +411,7 @@ n instructions. This also affects how often thread switches occur." static PyObject * sys_getcheckinterval(PyObject *self, PyObject *args) { - return PyInt_FromLong(_Py_CheckInterval); + return PyLong_FromLong(_Py_CheckInterval); } PyDoc_STRVAR(getcheckinterval_doc, @@ -473,7 +473,7 @@ dependent." static PyObject * sys_getrecursionlimit(PyObject *self) { - return PyInt_FromLong(Py_GetRecursionLimit()); + return PyLong_FromLong(Py_GetRecursionLimit()); } PyDoc_STRVAR(getrecursionlimit_doc, @@ -543,7 +543,7 @@ sys_getdlopenflags(PyObject *self, PyObject *args) PyThreadState *tstate = PyThreadState_GET(); if (!tstate) return NULL; - return PyInt_FromLong(tstate->interp->dlopenflags); + return PyLong_FromLong(tstate->interp->dlopenflags); } PyDoc_STRVAR(getdlopenflags_doc, @@ -573,14 +573,14 @@ sys_mdebug(PyObject *self, PyObject *args) static PyObject * sys_getrefcount(PyObject *self, PyObject *arg) { - return PyInt_FromSsize_t(arg->ob_refcnt); + return PyLong_FromSsize_t(arg->ob_refcnt); } #ifdef Py_REF_DEBUG static PyObject * sys_gettotalrefcount(PyObject *self) { - return PyInt_FromSsize_t(_Py_GetRefTotal()); + return PyLong_FromSsize_t(_Py_GetRefTotal()); } #endif /* Py_REF_DEBUG */ @@ -1034,7 +1034,7 @@ _PySys_Init(void) v = PyUnicode_FromString(Py_GetVersion())); Py_XDECREF(v); PyDict_SetItemString(sysdict, "hexversion", - v = PyInt_FromLong(PY_VERSION_HEX)); + v = PyLong_FromLong(PY_VERSION_HEX)); Py_XDECREF(v); svnversion_init(); v = Py_BuildValue("(UUU)", "CPython", branch, svn_revision); @@ -1066,7 +1066,7 @@ _PySys_Init(void) PY_MICRO_VERSION, s, PY_RELEASE_SERIAL)); SET_SYS_FROM_STRING("api_version", - PyInt_FromLong(PYTHON_API_VERSION)); + PyLong_FromLong(PYTHON_API_VERSION)); SET_SYS_FROM_STRING("copyright", PyUnicode_FromString(Py_GetCopyright())); SET_SYS_FROM_STRING("platform", @@ -1079,13 +1079,13 @@ _PySys_Init(void) SET_SYS_FROM_STRING("exec_prefix", PyUnicode_DecodeFSDefault(Py_GetExecPrefix())); SET_SYS_FROM_STRING("maxint", - PyInt_FromLong(PyInt_GetMax())); + PyLong_FromLong(PyInt_GetMax())); SET_SYS_FROM_STRING("maxsize", - PyInt_FromSsize_t(PY_SSIZE_T_MAX)); + PyLong_FromSsize_t(PY_SSIZE_T_MAX)); SET_SYS_FROM_STRING("float_info", PyFloat_GetInfo()); SET_SYS_FROM_STRING("maxunicode", - PyInt_FromLong(PyUnicode_GetMax())); + PyLong_FromLong(PyUnicode_GetMax())); SET_SYS_FROM_STRING("builtin_module_names", list_builtin_module_names()); { diff --git a/Python/traceback.c b/Python/traceback.c index 9d7a2e0b87..df2a3a302e 100644 --- a/Python/traceback.c +++ b/Python/traceback.c @@ -256,7 +256,7 @@ PyTraceBack_Print(PyObject *v, PyObject *f) } limitv = PySys_GetObject("tracebacklimit"); if (limitv && PyInt_CheckExact(limitv)) { - limit = PyInt_AsLong(limitv); + limit = PyLong_AsLong(limitv); if (limit <= 0) return 0; } -- cgit v1.2.1