This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author mark.dickinson
Recipients akitada, belopolsky, christian.heimes, josm, loewis, mark.dickinson, rhettinger, robertwb, zanella
Date 2010-05-01.20:21:13
SpamBayes Score 0.026961194
Marked as misclassified No
Message-id <1272745275.02.0.869946146863.issue1533@psf.upfronthosting.co.za>
In-reply-to
Content
Alexander, I think it should be as simple as replacing the if (!PyInt_Check(ilow) && ...) block with something like this:

	if (!PyInt_Check(ilow) && !PyLong_Check(ilow)) {
		PyNumberMethods *nb = Py_TYPE(ilow)->tp_as_number;
		PyObject *temp;
		if (PyFloat_Check(ilow) || nb == NULL || nb->nb_int == NULL) {
			PyErr_Format(PyExc_TypeError,
				     "range() integer start argument expected, got %s.",
				     ilow->ob_type->tp_name);
			goto Fail;
		}
		temp = (*nb->nb_int)(ilow);
		Py_DECREF(ilow);
		ilow = temp;
		if (temp == NULL)
			goto Fail;
	}

and then doing the same for the ihigh and istep blocks.  But I haven't tested this.

Mark
History
Date User Action Args
2010-05-01 20:21:15mark.dickinsonsetrecipients: + mark.dickinson, loewis, rhettinger, belopolsky, christian.heimes, josm, robertwb, zanella, akitada
2010-05-01 20:21:15mark.dickinsonsetmessageid: <1272745275.02.0.869946146863.issue1533@psf.upfronthosting.co.za>
2010-05-01 20:21:13mark.dickinsonlinkissue1533 messages
2010-05-01 20:21:13mark.dickinsoncreate