Mercurial > cpython-lru_cache-weakref
diff Python/compile.c @ 25635:a94f272e600d 2.2
Backport my checkin of revision 2.264 of Python/compile.c:
Clamp code objects' tp_compare result to [-1, 1].
Bugfix candidate.
| author | Michael W. Hudson <mwh@python.net> |
|---|---|
| date | Mon, 07 Oct 2002 11:30:07 +0000 |
| parents | e756867ace81 |
| children | 3eb0376e93e8 |
line wrap: on
line diff
--- a/Python/compile.c Mon Oct 07 10:38:33 2002 +0000 +++ b/Python/compile.c Mon Oct 07 11:30:07 2002 +0000 @@ -133,11 +133,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);
