diff Python/ceval.c @ 21609:3ba0f1b20320 legacy-trunk

Patch #494783: Rename cmp_op enumerators.
author Martin v. Löwis <martin@v.loewis.de>
date Tue, 01 Jan 2002 19:59:11 +0000
parents ca27d82ac89b
children e20d12b5dad1
line wrap: on
line diff
--- a/Python/ceval.c	Tue Jan 01 19:11:13 2002 +0000
+++ b/Python/ceval.c	Tue Jan 01 19:59:11 2002 +0000
@@ -1785,14 +1785,14 @@
 				a = PyInt_AS_LONG(v);
 				b = PyInt_AS_LONG(w);
 				switch (oparg) {
-				case LT: res = a <  b; break;
-				case LE: res = a <= b; break;
-				case EQ: res = a == b; break;
-				case NE: res = a != b; break;
-				case GT: res = a >  b; break;
-				case GE: res = a >= b; break;
-				case IS: res = v == w; break;
-				case IS_NOT: res = v != w; break;
+				case PyCmp_LT: res = a <  b; break;
+				case PyCmp_LE: res = a <= b; break;
+				case PyCmp_EQ: res = a == b; break;
+				case PyCmp_NE: res = a != b; break;
+				case PyCmp_GT: res = a >  b; break;
+				case PyCmp_GE: res = a >= b; break;
+				case PyCmp_IS: res = v == w; break;
+				case PyCmp_IS_NOT: res = v != w; break;
 				default: goto slow_compare;
 				}
 				x = res ? Py_True : Py_False;
@@ -2986,6 +2986,10 @@
 			result = 1;
 			cf->cf_flags |= compilerflags;
 		}
+		if (codeflags & CO_GENERATOR_ALLOWED) {
+			result = 1;
+			cf->cf_flags |= CO_GENERATOR_ALLOWED;
+		}
 	}
 	return result;
 }
@@ -3470,21 +3474,21 @@
 {
 	int res = 0;
 	switch (op) {
-	case IS:
-	case IS_NOT:
+	case PyCmp_IS:
+	case PyCmp_IS_NOT:
 		res = (v == w);
-		if (op == (int) IS_NOT)
+		if (op == (int) PyCmp_IS_NOT)
 			res = !res;
 		break;
-	case IN:
-	case NOT_IN:
+	case PyCmp_IN:
+	case PyCmp_NOT_IN:
 		res = PySequence_Contains(w, v);
 		if (res < 0)
 			return NULL;
-		if (op == (int) NOT_IN)
+		if (op == (int) PyCmp_NOT_IN)
 			res = !res;
 		break;
-	case EXC_MATCH:
+	case PyCmp_EXC_MATCH:
 		res = PyErr_GivenExceptionMatches(v, w);
 		break;
 	default: