summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorNeal Norwitz <nnorwitz@gmail.com>2007-08-31 04:32:55 (GMT)
committerNeal Norwitz <nnorwitz@gmail.com>2007-08-31 04:32:55 (GMT)
commit1fe5f388529dcdf674d53f7d67abc16c9c6ca5e5 (patch)
treeb35d6a88c4ded09687f9916e4d4c0b03bafde580 /Modules
parent538d17aa233e99a0652d0c6d482845e8e909b6e0 (diff)
downloadcpython-1fe5f388529dcdf674d53f7d67abc16c9c6ca5e5.zip
cpython-1fe5f388529dcdf674d53f7d67abc16c9c6ca5e5.tar.gz
cpython-1fe5f388529dcdf674d53f7d67abc16c9c6ca5e5.tar.bz2
Remove checking redundantly for checks of PyInt and PyLong.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_randommodule.c4
-rw-r--r--Modules/_sre.c2
-rw-r--r--Modules/datetimemodule.c10
3 files changed, 8 insertions, 8 deletions
diff --git a/Modules/_randommodule.c b/Modules/_randommodule.c
index 95b7ade..bd4d17e 100644
--- a/Modules/_randommodule.c
+++ b/Modules/_randommodule.c
@@ -231,7 +231,7 @@ random_seed(RandomObject *self, PyObject *args)
/* If the arg is an int or long, use its absolute value; else use
* the absolute value of its hash code.
*/
- if (PyInt_Check(arg) || PyLong_Check(arg))
+ if (PyLong_Check(arg))
n = PyNumber_Absolute(arg);
else {
long hash = PyObject_Hash(arg);
@@ -401,7 +401,7 @@ random_jumpahead(RandomObject *self, PyObject *n)
PyObject *remobj;
unsigned long *mt, tmp;
- if (!PyInt_Check(n) && !PyLong_Check(n)) {
+ if (!PyLong_Check(n)) {
PyErr_Format(PyExc_TypeError, "jumpahead requires an "
"integer, not '%s'",
Py_Type(n)->tp_name);
diff --git a/Modules/_sre.c b/Modules/_sre.c
index 20f98ca..03067cb 100644
--- a/Modules/_sre.c
+++ b/Modules/_sre.c
@@ -2764,7 +2764,7 @@ match_getindex(MatchObject* self, PyObject* index)
if (self->pattern->groupindex) {
index = PyObject_GetItem(self->pattern->groupindex, index);
if (index) {
- if (PyInt_Check(index) || PyLong_Check(index))
+ if (PyLong_Check(index))
i = PyInt_AsSsize_t(index);
Py_DECREF(index);
} else
diff --git a/Modules/datetimemodule.c b/Modules/datetimemodule.c
index 046354c..14990a3 100644
--- a/Modules/datetimemodule.c
+++ b/Modules/datetimemodule.c
@@ -1758,11 +1758,11 @@ delta_multiply(PyObject *left, PyObject *right)
if (PyDelta_Check(left)) {
/* delta * ??? */
- if (PyInt_Check(right) || PyLong_Check(right))
+ if (PyLong_Check(right))
result = multiply_int_timedelta(right,
(PyDateTime_Delta *) left);
}
- else if (PyInt_Check(left) || PyLong_Check(left))
+ else if (PyLong_Check(left))
result = multiply_int_timedelta(left,
(PyDateTime_Delta *) right);
@@ -1778,7 +1778,7 @@ delta_divide(PyObject *left, PyObject *right)
if (PyDelta_Check(left)) {
/* delta * ??? */
- if (PyInt_Check(right) || PyLong_Check(right))
+ if (PyLong_Check(right))
result = divide_timedelta_int(
(PyDateTime_Delta *)left,
right);
@@ -1807,7 +1807,7 @@ accum(const char* tag, PyObject *sofar, PyObject *num, PyObject *factor,
assert(num != NULL);
- if (PyInt_Check(num) || PyLong_Check(num)) {
+ if (PyLong_Check(num)) {
prod = PyNumber_Multiply(num, factor);
if (prod == NULL)
return NULL;
@@ -1855,7 +1855,7 @@ accum(const char* tag, PyObject *sofar, PyObject *num, PyObject *factor,
* fractional part requires float arithmetic, and may
* lose a little info.
*/
- assert(PyInt_Check(factor) || PyLong_Check(factor));
+ assert(PyLong_Check(factor));
dnum = PyLong_AsDouble(factor);
dnum *= fracpart;