[Python-checkins] python/dist/src/Objects listobject.c, 2.182,
2.183
Neal Norwitz
neal at metaslash.com
Wed Feb 18 21:24:41 EST 2004
On Tue, Feb 17, 2004 at 03:36:19AM -0800, rhettinger at users.sourceforge.net wrote:
> {
> ! PyObject *v;
> ! if (!PyArg_ParseTuple(args, "|i:pop", &i))
> return NULL;
> --- 773,788 ----
> {
> ! PyObject *v, *arg = NULL;
> !
> ! if (!PyArg_UnpackTuple(args, "pop", 0, 1, &arg))
> return NULL;
> + if (arg != NULL) {
> + if (PyInt_Check(arg))
> + i = (int)(PyInt_AS_LONG((PyIntObject*) arg));
> + else {
> + PyErr_SetString(PyExc_TypeError, "an integer is required");
> + return NULL;
> + }
> + }
This is a change in behaviour. This used to work:
>>> x = [1,2,3]
>>> x.pop(1L)
Traceback (most recent call last):
File "<stdin>", line 1, in ?
TypeError: an integer is required
More information about the Python-checkins
mailing list