Cleanup: Replaced most PyInt_ aliases with PyLong_ and disabled the aliases in intobject.h
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 @@
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 @@
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 @@
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 @@
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 @@
{
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 @@
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 @@
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 @@
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 @@
_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 @@
"subsection not found");
return NULL;
}
- return PyInt_FromSsize_t(result);
+ return PyLong_FromSsize_t(result);
}
@@ -1162,7 +1162,7 @@
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 @@
"subsection not found");
return NULL;
}
- return PyInt_FromSsize_t(result);
+ return PyLong_FromSsize_t(result);
}
@@ -2622,7 +2622,7 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
/* 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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
*/
PyObject *temp;
- one = PyInt_FromLong(1);
+ one = PyLong_FromLong(1);
if (one == NULL)
goto Error;
@@ -808,7 +808,7 @@
*/
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 @@
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 @@
}
/* 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 @@
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 @@
Py_DECREF(res);
return -1;
}
- i = PyInt_AsLong(res);
+ i = PyLong_AsLong(res);
Py_DECREF(res);
return i < 0;
}
@@ -2226,7 +2226,7 @@
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 @@
else if (cmp < 0)
return NULL;
}
- return PyInt_FromSsize_t(count);
+ return PyLong_FromSsize_t(count);
}
static PyObject *
@@ -2823,9 +2823,9 @@
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 @@
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 @@
#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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
{
/* 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 @@
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 @@
/* 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 @@
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 @@
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 @@
_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 @@
*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 @@
/* 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 @@
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 @@
/* 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 @@
/* 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 @@
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 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 @@
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 @@
"substring not found");
return NULL;
}
- return PyInt_FromSsize_t(result);
+ return PyLong_FromSsize_t(result);
}
@@ -1625,7 +1625,7 @@
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 @@
"substring not found");
return NULL;
}
- return PyInt_FromSsize_t(result);
+ return PyLong_FromSsize_t(result);
}
@@ -1808,7 +1808,7 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
res = (*func)(self);
if (res == -1 && PyErr_Occurred())
return NULL;
- return PyInt_FromLong(res);
+ return PyLong_FromLong(res);
}
static PyObject *
@@ -4270,7 +4270,7 @@
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 @@
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 @@
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 @@
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 *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 @@
}
/* 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 @@
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 @@
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 @@
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 @@
}
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 @@
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 @@
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
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 @@
*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 @@
}
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 @@
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 @@
Py_DECREF(substring);
- return PyInt_FromSsize_t(result);
+ return PyLong_FromSsize_t(result);
}
static PyObject *
@@ -6688,7 +6688,7 @@
return NULL;
}
- return PyInt_FromSsize_t(result);
+ return PyLong_FromSsize_t(result);
}
PyDoc_STRVAR(islower__doc__,
@@ -7514,7 +7514,7 @@
Py_DECREF(substring);
- return PyInt_FromSsize_t(result);
+ return PyLong_FromSsize_t(result);
}
PyDoc_STRVAR(rindex__doc__,
@@ -7545,7 +7545,7 @@
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 @@
}
/* 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 @@
/* 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 @@
"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 @@
static PyObject*
unicode_freelistsize(PyUnicodeObject *self)
{
- return PyInt_FromLong(unicode_freelist_size);
+ return PyLong_FromLong(unicode_freelist_size);
}
#endif
@@ -8368,7 +8368,7 @@
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 @@
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 @@
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 @@
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 @@
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)).");