Commits

Neal Norwitz  committed 7275398

Remove checking redundantly for checks of PyInt and PyLong.

  • Participants
  • Parent commits 85a6785

Comments (0)

Files changed (7)

File Modules/_randommodule.c

 	/* 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);
 	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);

File Modules/_sre.c

     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

File Modules/datetimemodule.c

 
 	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);
 
 
 	if (PyDelta_Check(left)) {
 		/* delta * ??? */
-		if (PyInt_Check(right) || PyLong_Check(right))
+		if (PyLong_Check(right))
 			result = divide_timedelta_int(
 					(PyDateTime_Delta *)left,
 					right);
 
 	assert(num != NULL);
 
-	if (PyInt_Check(num) || PyLong_Check(num)) {
+	if (PyLong_Check(num)) {
 		prod = PyNumber_Multiply(num, factor);
 		if (prod == NULL)
 			return NULL;
 		 * 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;

File Objects/abstract.c

 	PyObject *result = NULL;
 	if (item == NULL)
 		return null_error();
-	if (PyInt_Check(item) || PyLong_Check(item)) {
+	if (PyLong_Check(item)) {
 		Py_INCREF(item);
 		return item;
 	}
 	if (PyIndex_Check(item)) {
 		result = item->ob_type->tp_as_number->nb_index(item);
-		if (result &&
-		    !PyInt_Check(result) && !PyLong_Check(result)) {
+		if (result && !PyLong_Check(result)) {
 			PyErr_Format(PyExc_TypeError,
 				     "__index__ returned non-int "
 				     "(type %.200s)",
 	}
 	if (m && m->nb_long) { /* This should include subclasses of long */
 		PyObject *res = m->nb_long(o);
-		if (res && (!PyInt_Check(res) && !PyLong_Check(res))) {
+		if (res && !PyLong_Check(res)) {
 			PyErr_Format(PyExc_TypeError,
 				     "__long__ returned non-long (type %.200s)",
 				     res->ob_type->tp_name);

File Objects/floatobject.c

 		j = PyFloat_AS_DOUBLE(w);
 
 	else if (!Py_IS_FINITE(i)) {
-		if (PyInt_Check(w) || PyLong_Check(w))
+		if (PyLong_Check(w))
 			/* If i is an infinity, its magnitude exceeds any
 			 * finite integer, so it doesn't matter which int we
 			 * compare i with.  If i is a NaN, similarly.

File Objects/sliceobject.c

 	if (r->step == Py_None) {
 		*step = 1;
 	} else {
-		if (!PyInt_Check(r->step) && !PyLong_Check(r->step)) return -1;
+		if (!PyLong_Check(r->step)) return -1;
 		*step = PyInt_AsSsize_t(r->step);
 	}
 	if (r->start == Py_None) {

File PC/_winreg.c

 		PyHKEYObject *pH = (PyHKEYObject *)ob;
 		*pHANDLE = pH->hkey;
 	}
-	else if (PyInt_Check(ob) || PyLong_Check(ob)) {
+	else if (PyLong_Check(ob)) {
 		/* We also support integers */
 		PyErr_Clear();
 		*pHANDLE = (HKEY)PyLong_AsVoidPtr(ob);