diff options
author | Georg Brandl <georg@python.org> | 2006-09-06 07:06:08 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2006-09-06 07:06:08 (GMT) |
commit | 52318d6215f9f9626d38a9b81b52d411dbbdb36a (patch) | |
tree | 72563f6321f9265fb9d77702ee729e68048bdd07 /Python/compile.c | |
parent | 7cae87ca7b0a3a7ce497cbd335c8ec82fe680476 (diff) | |
download | cpython-52318d6215f9f9626d38a9b81b52d411dbbdb36a.zip cpython-52318d6215f9f9626d38a9b81b52d411dbbdb36a.tar.gz cpython-52318d6215f9f9626d38a9b81b52d411dbbdb36a.tar.bz2 |
Patch #1550786: ellipsis literal.
Diffstat (limited to 'Python/compile.c')
-rw-r--r-- | Python/compile.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/Python/compile.c b/Python/compile.c index ac82b84..40ac2d7 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -2746,6 +2746,8 @@ static int 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 @@ compiler_visit_expr(struct compiler *c, expr_ty e) 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 @@ compiler_visit_nested_slice(struct compiler *c, slice_ty s, 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 @@ compiler_visit_slice(struct compiler *c, slice_ty s, expr_context_ty ctx) 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) |