Mercurial > cpython-lru_cache-weakref
diff Python/compile.c @ 25538:2c0e0f0dca6f legacy-trunk
Clamp code objects' tp_compare result to [-1, 1].
Bugfix candidate.
| author | Michael W. Hudson <mwh@python.net> |
|---|---|
| date | Thu, 03 Oct 2002 09:50:47 +0000 |
| parents | be2868a63ed5 |
| children | 90e9a3ecda44 |
line wrap: on
line diff
--- a/Python/compile.c Thu Oct 03 09:42:01 2002 +0000 +++ b/Python/compile.c Thu Oct 03 09:50:47 2002 +0000 @@ -196,11 +196,11 @@ cmp = PyObject_Compare(co->co_name, cp->co_name); if (cmp) return cmp; cmp = co->co_argcount - cp->co_argcount; - if (cmp) return cmp; + if (cmp) return (cmp<0)?-1:1; cmp = co->co_nlocals - cp->co_nlocals; - if (cmp) return cmp; + if (cmp) return (cmp<0)?-1:1; cmp = co->co_flags - cp->co_flags; - if (cmp) return cmp; + if (cmp) return (cmp<0)?-1:1; cmp = PyObject_Compare(co->co_code, cp->co_code); if (cmp) return cmp; cmp = PyObject_Compare(co->co_consts, cp->co_consts);
