diff Python/compile.c @ 39783:7a0ad110e91e

Patch #1550786: ellipsis literal.
author Georg Brandl <georg@python.org>
date Wed, 06 Sep 2006 07:06:08 +0000
parents c94f37054f19
children 1cce0526d9b0
line wrap: on
line diff
--- a/Python/compile.c	Wed Sep 06 06:51:57 2006 +0000
+++ b/Python/compile.c	Wed Sep 06 07:06:08 2006 +0000
@@ -2746,6 +2746,8 @@
 expr_constant(expr_ty e)
 {
 	switch (e->kind) {
+	case Ellipsis_kind:
+		return 1;
 	case Num_kind:
 		return PyObject_IsTrue(e->v.Num.n);
 	case Str_kind:
@@ -2977,6 +2979,9 @@
 	case Str_kind:
 		ADDOP_O(c, LOAD_CONST, e->v.Str.s, consts);
 		break;
+	case Ellipsis_kind:
+		ADDOP_O(c, LOAD_CONST, Py_Ellipsis, consts);
+		break;
 	/* The following exprs can be assignment targets. */
 	case Attribute_kind:
 		if (e->v.Attribute.ctx != AugStore)
@@ -3255,9 +3260,6 @@
 			    expr_context_ty ctx)
 {
 	switch (s->kind) {
-	case Ellipsis_kind:
-		ADDOP_O(c, LOAD_CONST, Py_Ellipsis, consts);
-		break;
 	case Slice_kind:
 		return compiler_slice(c, s, ctx);
 	case Index_kind:
@@ -3284,12 +3286,6 @@
 			VISIT(c, expr, s->v.Index.value);
 		}
 		break;
-	case Ellipsis_kind:
-		kindname = "ellipsis";
-		if (ctx != AugStore) {
-			ADDOP_O(c, LOAD_CONST, Py_Ellipsis, consts);
-		}
-		break;
 	case Slice_kind:
 		kindname = "slice";
 		if (!s->v.Slice.step)