summaryrefslogtreecommitdiffstats
path: root/Python/compile.c
diff options
context:
space:
mode:
authorMichael W. Hudson <mwh@python.net>2002-10-07 11:30:07 (GMT)
committerMichael W. Hudson <mwh@python.net>2002-10-07 11:30:07 (GMT)
commit51e80dfd0201df9faff34774dece3ae92550657d (patch)
tree4adabfcf70c4bd2059cef0791865bbe696d293f3 /Python/compile.c
parentc01f360a4a166afdc4f4ab67167ba41d68aed170 (diff)
downloadcpython-51e80dfd0201df9faff34774dece3ae92550657d.zip
cpython-51e80dfd0201df9faff34774dece3ae92550657d.tar.gz
cpython-51e80dfd0201df9faff34774dece3ae92550657d.tar.bz2
Backport my checkin of revision 2.264 of Python/compile.c:
Clamp code objects' tp_compare result to [-1, 1]. Bugfix candidate.
Diffstat (limited to 'Python/compile.c')
-rw-r--r--Python/compile.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/Python/compile.c b/Python/compile.c
index cdd8b1b..f3d9a20 100644
--- a/Python/compile.c
+++ b/Python/compile.c
@@ -133,11 +133,11 @@ code_compare(PyCodeObject *co, PyCodeObject *cp)
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);