[Python-checkins] python/dist/src/Python compile.c,2.234.4.4,2.234.4.5

mwh@users.sourceforge.net mwh@users.sourceforge.net
Mon, 07 Oct 2002 04:30:09 -0700


Update of /cvsroot/python/python/dist/src/Python
In directory usw-pr-cvs1:/tmp/cvs-serv29524

Modified Files:
      Tag: release22-maint
	compile.c 
Log Message:
Backport my checkin of revision 2.264 of Python/compile.c:

Clamp code objects' tp_compare result to [-1, 1].

Bugfix candidate.


Index: compile.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/compile.c,v
retrieving revision 2.234.4.4
retrieving revision 2.234.4.5
diff -C2 -d -r2.234.4.4 -r2.234.4.5
*** compile.c	11 Aug 2002 15:40:35 -0000	2.234.4.4
--- compile.c	7 Oct 2002 11:30:07 -0000	2.234.4.5
***************
*** 134,142 ****
  	if (cmp) return cmp;
  	cmp = co->co_argcount - cp->co_argcount;
! 	if (cmp) return cmp;
  	cmp = co->co_nlocals - cp->co_nlocals;
! 	if (cmp) return cmp;
  	cmp = co->co_flags - cp->co_flags;
! 	if (cmp) return cmp;
  	cmp = PyObject_Compare(co->co_code, cp->co_code);
  	if (cmp) return cmp;
--- 134,142 ----
  	if (cmp) return cmp;
  	cmp = co->co_argcount - cp->co_argcount;
! 	if (cmp) return (cmp<0)?-1:1;
  	cmp = co->co_nlocals - cp->co_nlocals;
! 	if (cmp) return (cmp<0)?-1:1;
  	cmp = co->co_flags - cp->co_flags;
! 	if (cmp) return (cmp<0)?-1:1;
  	cmp = PyObject_Compare(co->co_code, cp->co_code);
  	if (cmp) return cmp;