[Patches] code_compare

Guido van Rossum guido@python.org
Sat, 08 Apr 2000 11:41:45 -0400


> *** Python/compile.c-orig	Sat Apr  8 11:39:23 2000
> --- Python/compile.c	Sat Apr  8 11:39:28 2000
> ***************
> *** 153,158 ****
> --- 153,160 ----
>   	cmp = PyObject_Compare(co->co_names, cp->co_names);
>   	if (cmp) return cmp;
>   	cmp = PyObject_Compare(co->co_varnames, cp->co_varnames);
> + 	if (cmp) return cmp;
> + 	cmp = PyObject_Compare(co->co_name, cp->co_name);
>   	return cmp;
>   }

If you compare the name first, sorting a list of code objects would
sort them by name first -- whgich is kind of nice.

Also, strictly speaking, the hash function should be updated.

--Guido van Rossum (home page: http://www.python.org/~guido/)