[Python-Dev] RE: [Python-checkins] python/dist/src/Modules heapqmodule.c, 1.1, 1.2

Tim Peters tim.one at comcast.net
Sat Nov 15 07:41:44 EST 2003


> Modified Files:
> 	heapqmodule.c
> Log Message:
> Verify heappop argument is a list.
>
> Index: heapqmodule.c
> ===================================================================
> RCS file: /cvsroot/python/python/dist/src/Modules/heapqmodule.c,v
> retrieving revision 1.1
> retrieving revision 1.2
> diff -C2 -d -r1.1 -r1.2
> *** heapqmodule.c	8 Nov 2003 10:24:38 -0000	1.1
> --- heapqmodule.c	15 Nov 2003 12:33:01 -0000	1.2
> ***************
> *** 120,123 ****
> --- 120,128 ----
>   	int n;
>
> + 	if (!PyList_Check(heap)) {
> + 		PyErr_SetString(PyExc_ValueError, "heap argument must be a list");
> + 		return NULL;
> + 	}

Now *that's* controversial:  the complaint is about the type of the argument
so should raise TypeError instead.  Curiously, the Python version of this
module raised a pretty mysterious AttributeError.




More information about the Python-Dev mailing list