diff options
author | Christian Heimes <christian@cheimes.de> | 2007-12-02 14:31:20 (GMT) |
---|---|---|
committer | Christian Heimes <christian@cheimes.de> | 2007-12-02 14:31:20 (GMT) |
commit | 217cfd1c86c59ed8a55ce6d6b88bbe37309e7ba2 (patch) | |
tree | 4737b4a91359c94953623ab9ee297e9a90f319e4 /Objects | |
parent | 1a3284ed69d545e4ef59869998cb8c29233a45fa (diff) | |
download | cpython-217cfd1c86c59ed8a55ce6d6b88bbe37309e7ba2.zip cpython-217cfd1c86c59ed8a55ce6d6b88bbe37309e7ba2.tar.gz cpython-217cfd1c86c59ed8a55ce6d6b88bbe37309e7ba2.tar.bz2 |
Cleanup: Replaced most PyInt_ aliases with PyLong_ and disabled the aliases in intobject.h
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/abstract.c | 10 | ||||
-rw-r--r-- | Objects/bytesobject.c | 26 | ||||
-rw-r--r-- | Objects/dictobject.c | 2 | ||||
-rw-r--r-- | Objects/enumobject.c | 10 | ||||
-rw-r--r-- | Objects/exceptions.c | 8 | ||||
-rw-r--r-- | Objects/fileobject.c | 2 | ||||
-rw-r--r-- | Objects/floatobject.c | 6 | ||||
-rw-r--r-- | Objects/frameobject.c | 4 | ||||
-rw-r--r-- | Objects/iterobject.c | 4 | ||||
-rw-r--r-- | Objects/listobject.c | 10 | ||||
-rw-r--r-- | Objects/longobject.c | 6 | ||||
-rw-r--r-- | Objects/memoryobject.c | 8 | ||||
-rw-r--r-- | Objects/rangeobject.c | 12 | ||||
-rw-r--r-- | Objects/setobject.c | 2 | ||||
-rw-r--r-- | Objects/sliceobject.c | 14 | ||||
-rw-r--r-- | Objects/stringlib/formatter.h | 2 | ||||
-rw-r--r-- | Objects/stringlib/string_format.h | 6 | ||||
-rw-r--r-- | Objects/stringobject.c | 18 | ||||
-rw-r--r-- | Objects/structseq.c | 12 | ||||
-rw-r--r-- | Objects/tupleobject.c | 2 | ||||
-rw-r--r-- | Objects/typeobject.c | 14 | ||||
-rw-r--r-- | Objects/unicodeobject.c | 68 |
22 files changed, 123 insertions, 123 deletions
diff --git a/Objects/abstract.c b/Objects/abstract.c index 01fbcbf..965d088 100644 --- a/Objects/abstract.c +++ b/Objects/abstract.c @@ -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), diff --git a/Objects/bytesobject.c b/Objects/bytesobject.c index 9409d49..fae29e2 100644 --- a/Objects/bytesobject.c +++ b/Objects/bytesobject.c @@ -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, diff --git a/Objects/dictobject.c b/Objects/dictobject.c index dad9855..ae400b6 100644 --- a/Objects/dictobject.c +++ b/Objects/dictobject.c @@ -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, diff --git a/Objects/enumobject.c b/Objects/enumobject.c index 0a3694d..6dc5a59 100644 --- a/Objects/enumobject.c +++ b/Objects/enumobject.c @@ -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))."); diff --git a/Objects/exceptions.c b/Objects/exceptions.c index 14e1bfb..4c6a122 100644 --- a/Objects/exceptions.c +++ b/Objects/exceptions.c @@ -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[] = { diff --git a/Objects/fileobject.c b/Objects/fileobject.c index 5d69911..f740977 100644 --- a/Objects/fileobject.c +++ b/Objects/fileobject.c @@ -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 * diff --git a/Objects/floatobject.c b/Objects/floatobject.c index d3b7c9e..d346ef6 100644 --- a/Objects/floatobject.c +++ b/Objects/floatobject.c @@ -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); } diff --git a/Objects/frameobject.c b/Objects/frameobject.c index cf41ddd..0e6d9f8 100644 --- a/Objects/frameobject.c +++ b/Objects/frameobject.c @@ -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", diff --git a/Objects/iterobject.c b/Objects/iterobject.c index 12b603a..e48700c 100644 --- a/Objects/iterobject.c +++ b/Objects/iterobject.c @@ -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))."); diff --git a/Objects/listobject.c b/Objects/listobject.c index 01ada08..43e8a3f 100644 --- a/Objects/listobject.c +++ b/Objects/listobject.c @@ -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 **************************/ diff --git a/Objects/longobject.c b/Objects/longobject.c index d827e7e..1e20485 100644 --- a/Objects/longobject.c +++ b/Objects/longobject.c @@ -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; } diff --git a/Objects/memoryobject.c b/Objects/memoryobject.c index 2f177c2..c60c53c 100644 --- a/Objects/memoryobject.c +++ b/Objects/memoryobject.c @@ -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[] ={ diff --git a/Objects/rangeobject.c b/Objects/rangeobject.c index 0b7be43..fa9e09b 100644 --- a/Objects/rangeobject.c +++ b/Objects/rangeobject.c @@ -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 { diff --git a/Objects/setobject.c b/Objects/setobject.c index 11ca407..f22268e 100644 --- a/Objects/setobject.c +++ b/Objects/setobject.c @@ -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))."); diff --git a/Objects/sliceobject.c b/Objects/sliceobject.c index 28b92d0..dec4d45 100644 --- a/Objects/sliceobject.c +++ b/Objects/sliceobject.c @@ -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; diff --git a/Objects/stringlib/formatter.h b/Objects/stringlib/formatter.h index ee0971d..b4f6e3c 100644 --- a/Objects/stringlib/formatter.h +++ b/Objects/stringlib/formatter.h @@ -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 diff --git a/Objects/stringlib/string_format.h b/Objects/stringlib/string_format.h index b771149..10d150f 100644 --- a/Objects/stringlib/string_format.h +++ b/Objects/stringlib/string_format.h @@ -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); diff --git a/Objects/stringobject.c b/Objects/stringobject.c index 887b28a..1c0a70d 100644 --- a/Objects/stringobject.c +++ b/Objects/stringobject.c @@ -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, diff --git a/Objects/structseq.c b/Objects/structseq.c index 1b6aafd..91cf57b 100644 --- a/Objects/structseq.c +++ b/Objects/structseq.c @@ -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)); } diff --git a/Objects/tupleobject.c b/Objects/tupleobject.c index fcfd09d..f1e8057 100644 --- a/Objects/tupleobject.c +++ b/Objects/tupleobject.c @@ -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))."); diff --git a/Objects/typeobject.c b/Objects/typeobject.c index 99ba799..55a8ec6 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -3623,7 +3623,7 @@ wrap_lenfunc(PyObject *self, PyObject *args, void *wrapped) res = (*func)(self); if (res == -1 && PyErr_Occurred()) return NULL; - return PyInt_FromLong((long)res); + return PyLong_FromLong((long)res); } static PyObject * @@ -3887,7 +3887,7 @@ wrap_cmpfunc(PyObject *self, PyObject *args, void *wrapped) res = (*func)(self, other); if (PyErr_Occurred()) return NULL; - return PyInt_FromLong((long)res); + return PyLong_FromLong((long)res); } /* Helper to check for object.__setattr__ or __delattr__ applied to a type. @@ -3958,7 +3958,7 @@ wrap_hashfunc(PyObject *self, PyObject *args, void *wrapped) res = (*func)(self); if (res == -1 && PyErr_Occurred()) return NULL; - return PyInt_FromLong(res); + return PyLong_FromLong(res); } static PyObject * @@ -4270,7 +4270,7 @@ slot_sq_length(PyObject *self) if (res == NULL) return -1; - len = PyInt_AsSsize_t(res); + len = PyLong_AsSsize_t(res); Py_DECREF(res); if (len < 0) { if (!PyErr_Occurred()) @@ -4305,7 +4305,7 @@ slot_sq_item(PyObject *self, Py_ssize_t i) return NULL; } } - ival = PyInt_FromSsize_t(i); + ival = PyLong_FromSsize_t(i); if (ival != NULL) { args = PyTuple_New(1); if (args != NULL) { @@ -4538,7 +4538,7 @@ half_compare(PyObject *self, PyObject *other) if (res != Py_NotImplemented) { if (res == NULL) return -2; - c = PyInt_AsLong(res); + c = PyLong_AsLong(res); Py_DECREF(res); if (c == -1 && PyErr_Occurred()) return -2; @@ -4639,7 +4639,7 @@ slot_tp_hash(PyObject *self) if (PyLong_Check(res)) h = PyLong_Type.tp_hash(res); else - h = PyInt_AsLong(res); + h = PyLong_AsLong(res); Py_DECREF(res); if (h == -1 && !PyErr_Occurred()) h = -2; diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c index 26349ef..6d1d069 100644 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -3980,7 +3980,7 @@ PyObject *PyUnicode_DecodeCharmap(const char *s, PyObject *w, *x; /* Get mapping (char ordinal -> integer, Unicode char or None) */ - w = PyInt_FromLong((long)ch); + w = PyLong_FromLong((long)ch); if (w == NULL) goto onError; x = PyObject_GetItem(mapping, w); @@ -3996,8 +3996,8 @@ PyObject *PyUnicode_DecodeCharmap(const char *s, } /* Apply mapping */ - if (PyInt_Check(x)) { - long value = PyInt_AS_LONG(x); + if (PyLong_Check(x)) { + long value = PyLong_AS_LONG(x); if (value < 0 || value > 65535) { PyErr_SetString(PyExc_TypeError, "character mapping must be in range(65536)"); @@ -4091,7 +4091,7 @@ static PyObject* encoding_map_size(PyObject *obj, PyObject* args) { struct encoding_map *map = (struct encoding_map*)obj; - return PyInt_FromLong(sizeof(*map) - 1 + 16*map->count2 + + return PyLong_FromLong(sizeof(*map) - 1 + 16*map->count2 + 128*map->count3); } @@ -4208,8 +4208,8 @@ PyUnicode_BuildEncodingMap(PyObject* string) return NULL; for (i = 0; i < 256; i++) { key = value = NULL; - key = PyInt_FromLong(decode[i]); - value = PyInt_FromLong(i); + key = PyLong_FromLong(decode[i]); + value = PyLong_FromLong(i); if (!key || !value) goto failed1; if (PyDict_SetItem(result, key, value) == -1) @@ -4297,7 +4297,7 @@ encoding_map_lookup(Py_UNICODE c, PyObject *mapping) error occurred). */ static PyObject *charmapencode_lookup(Py_UNICODE c, PyObject *mapping) { - PyObject *w = PyInt_FromLong((long)c); + PyObject *w = PyLong_FromLong((long)c); PyObject *x; if (w == NULL) @@ -4316,8 +4316,8 @@ static PyObject *charmapencode_lookup(Py_UNICODE c, PyObject *mapping) } else if (x == Py_None) return x; - else if (PyInt_Check(x)) { - long value = PyInt_AS_LONG(x); + else if (PyLong_Check(x)) { + long value = PyLong_AS_LONG(x); if (value < 0 || value > 255) { PyErr_SetString(PyExc_TypeError, "character mapping must be in range(256)"); @@ -4387,7 +4387,7 @@ charmapencode_result charmapencode_output(Py_UNICODE c, PyObject *mapping, Py_DECREF(rep); return enc_FAILED; } else { - if (PyInt_Check(rep)) { + if (PyLong_Check(rep)) { Py_ssize_t requiredsize = *outpos+1; if (outsize<requiredsize) if (charmapencode_resize(outobj, outpos, requiredsize)) { @@ -4395,7 +4395,7 @@ charmapencode_result charmapencode_output(Py_UNICODE c, PyObject *mapping, return enc_EXCEPTION; } outstart = PyString_AS_STRING(*outobj); - outstart[(*outpos)++] = (char)PyInt_AS_LONG(rep); + outstart[(*outpos)++] = (char)PyLong_AS_LONG(rep); } else { const char *repchars = PyString_AS_STRING(rep); @@ -4707,7 +4707,7 @@ static PyObject *unicode_translate_call_errorhandler(const char *errors, static int charmaptranslate_lookup(Py_UNICODE c, PyObject *mapping, PyObject **result) { - PyObject *w = PyInt_FromLong((long)c); + PyObject *w = PyLong_FromLong((long)c); PyObject *x; if (w == NULL) @@ -4727,8 +4727,8 @@ int charmaptranslate_lookup(Py_UNICODE c, PyObject *mapping, PyObject **result) *result = x; return 0; } - else if (PyInt_Check(x)) { - long value = PyInt_AS_LONG(x); + else if (PyLong_Check(x)) { + long value = PyLong_AS_LONG(x); long max = PyUnicode_GetMax(); if (value < 0 || value > max) { PyErr_Format(PyExc_TypeError, @@ -4790,9 +4790,9 @@ int charmaptranslate_output(const Py_UNICODE *startinp, const Py_UNICODE *curinp } else if (*res==Py_None) ; - else if (PyInt_Check(*res)) { + else if (PyLong_Check(*res)) { /* no overflow check, because we know that the space is enough */ - *(*outp)++ = (Py_UNICODE)PyInt_AS_LONG(*res); + *(*outp)++ = (Py_UNICODE)PyLong_AS_LONG(*res); } else if (PyUnicode_Check(*res)) { Py_ssize_t repsize = PyUnicode_GET_SIZE(*res); @@ -6469,7 +6469,7 @@ unicode_count(PyUnicodeObject *self, PyObject *args) FIX_START_END(self); - result = PyInt_FromSsize_t( + result = PyLong_FromSsize_t( stringlib_count(self->str + start, end - start, substring->str, substring->length) ); @@ -6622,7 +6622,7 @@ unicode_find(PyUnicodeObject *self, PyObject *args) Py_DECREF(substring); - return PyInt_FromSsize_t(result); + return PyLong_FromSsize_t(result); } static PyObject * @@ -6688,7 +6688,7 @@ unicode_index(PyUnicodeObject *self, PyObject *args) return NULL; } - return PyInt_FromSsize_t(result); + return PyLong_FromSsize_t(result); } PyDoc_STRVAR(islower__doc__, @@ -7514,7 +7514,7 @@ unicode_rfind(PyUnicodeObject *self, PyObject *args) Py_DECREF(substring); - return PyInt_FromSsize_t(result); + return PyLong_FromSsize_t(result); } PyDoc_STRVAR(rindex__doc__, @@ -7545,7 +7545,7 @@ unicode_rindex(PyUnicodeObject *self, PyObject *args) PyErr_SetString(PyExc_ValueError, "substring not found"); return NULL; } - return PyInt_FromSsize_t(result); + return PyLong_FromSsize_t(result); } PyDoc_STRVAR(rjust__doc__, @@ -7833,8 +7833,8 @@ unicode_maketrans(PyUnicodeObject *null, PyObject *args) } /* create entries for translating chars in x to those in y */ for (i = 0; i < PyUnicode_GET_SIZE(x); i++) { - key = PyInt_FromLong(PyUnicode_AS_UNICODE(x)[i]); - value = PyInt_FromLong(PyUnicode_AS_UNICODE(y)[i]); + key = PyLong_FromLong(PyUnicode_AS_UNICODE(x)[i]); + value = PyLong_FromLong(PyUnicode_AS_UNICODE(y)[i]); if (!key || !value) goto err; res = PyDict_SetItem(new, key, value); @@ -7846,7 +7846,7 @@ unicode_maketrans(PyUnicodeObject *null, PyObject *args) /* create entries for deleting chars in z */ if (z != NULL) { for (i = 0; i < PyUnicode_GET_SIZE(z); i++) { - key = PyInt_FromLong(PyUnicode_AS_UNICODE(z)[i]); + key = PyLong_FromLong(PyUnicode_AS_UNICODE(z)[i]); if (!key) goto err; res = PyDict_SetItem(new, key, Py_None); @@ -7872,14 +7872,14 @@ unicode_maketrans(PyUnicodeObject *null, PyObject *args) "table must be of length 1"); goto err; } - newkey = PyInt_FromLong(PyUnicode_AS_UNICODE(key)[0]); + newkey = PyLong_FromLong(PyUnicode_AS_UNICODE(key)[0]); if (!newkey) goto err; res = PyDict_SetItem(new, newkey, value); Py_DECREF(newkey); if (res < 0) goto err; - } else if (PyInt_Check(key)) { + } else if (PyLong_Check(key)) { /* just keep integer keys */ if (PyDict_SetItem(new, key, value) < 0) goto err; @@ -7970,7 +7970,7 @@ unicode_zfill(PyUnicodeObject *self, PyObject *args) static PyObject* unicode_freelistsize(PyUnicodeObject *self) { - return PyInt_FromLong(unicode_freelist_size); + return PyLong_FromLong(unicode_freelist_size); } #endif @@ -8368,7 +8368,7 @@ formatint(Py_UNICODE *buf, char *sign; long x; - x = PyInt_AsLong(v); + x = PyLong_AsLong(v); if (x == -1 && PyErr_Occurred()) return -1; if (x < 0 && type == 'u') { @@ -8441,7 +8441,7 @@ formatchar(Py_UNICODE *buf, else { /* Integer input truncated to a character */ long x; - x = PyInt_AsLong(v); + x = PyLong_AsLong(v); if (x == -1 && PyErr_Occurred()) goto onError; #ifdef Py_UNICODE_WIDE @@ -8613,12 +8613,12 @@ PyObject *PyUnicode_Format(PyObject *format, v = getnextarg(args, arglen, &argidx); if (v == NULL) goto onError; - if (!PyInt_Check(v)) { + if (!PyLong_Check(v)) { PyErr_SetString(PyExc_TypeError, "* wants int"); goto onError; } - width = PyInt_AsLong(v); + width = PyLong_AsLong(v); if (width == -1 && PyErr_Occurred()) goto onError; if (width < 0) { @@ -8650,12 +8650,12 @@ PyObject *PyUnicode_Format(PyObject *format, v = getnextarg(args, arglen, &argidx); if (v == NULL) goto onError; - if (!PyInt_Check(v)) { + if (!PyLong_Check(v)) { PyErr_SetString(PyExc_TypeError, "* wants int"); goto onError; } - prec = PyInt_AsLong(v); + prec = PyLong_AsLong(v); if (prec == -1 && PyErr_Occurred()) goto onError; if (prec < 0) @@ -9250,7 +9250,7 @@ unicodeiter_len(unicodeiterobject *it) Py_ssize_t len = 0; if (it->it_seq) len = PyUnicode_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))."); |