[Python-checkins] CVS: python/dist/src/Python ceval.c,2.301,2.302

Tim Peters tim_one@users.sourceforge.net
Tue, 25 Dec 2001 10:49:13 -0800


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

Modified Files:
	ceval.c 
Log Message:
SF bug #496549 -Qnew and in-place division "/=".

eval_frame():  Under -Qnew, INPLACE_DIVIDE wasn't getting handed off to
INPLACE_TRUE_DIVIDE (like BINARY_DIVIDE was getting handed off to
BINARY_TRUE_DIVIDE).

Bugfix candidate.


Index: ceval.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/ceval.c,v
retrieving revision 2.301
retrieving revision 2.302
diff -C2 -d -r2.301 -r2.302
*** ceval.c	2001/12/19 04:11:07	2.301
--- ceval.c	2001/12/25 18:49:11	2.302
***************
*** 1092,1098 ****
  
  		case INPLACE_DIVIDE:
  			w = POP();
  			v = POP();
! 			x = PyNumber_InPlaceDivide(v, w);
  			Py_DECREF(v);
  			Py_DECREF(w);
--- 1092,1111 ----
  
  		case INPLACE_DIVIDE:
+ 			if (!_Py_QnewFlag) {
+ 				w = POP();
+ 				v = POP();
+ 				x = PyNumber_InPlaceDivide(v, w);
+ 				Py_DECREF(v);
+ 				Py_DECREF(w);
+ 				PUSH(x);
+ 				if (x != NULL) continue;
+ 				break;
+ 			}
+ 			/* -Qnew is in effect:  fall through to
+ 			   INPLACE_TRUE_DIVIDE */
+ 		case INPLACE_TRUE_DIVIDE:
  			w = POP();
  			v = POP();
! 			x = PyNumber_InPlaceTrueDivide(v, w);
  			Py_DECREF(v);
  			Py_DECREF(w);
***************
*** 1105,1118 ****
  			v = POP();
  			x = PyNumber_InPlaceFloorDivide(v, w);
- 			Py_DECREF(v);
- 			Py_DECREF(w);
- 			PUSH(x);
- 			if (x != NULL) continue;
- 			break;
- 
- 		case INPLACE_TRUE_DIVIDE:
- 			w = POP();
- 			v = POP();
- 			x = PyNumber_InPlaceTrueDivide(v, w);
  			Py_DECREF(v);
  			Py_DECREF(w);
--- 1118,1121 ----