diff options
author | Guido van Rossum <guido@python.org> | 2006-05-02 19:47:52 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2006-05-02 19:47:52 (GMT) |
commit | da5b701aeef755f2317a41e36cc950cfdc0c95cb (patch) | |
tree | 11a37e4e8714ffbccce921aa0ef1878b7dc779b2 /Python/compile.c | |
parent | 8f6cbe150228f175b57b7a774d0a630febe72244 (diff) | |
download | cpython-da5b701aeef755f2317a41e36cc950cfdc0c95cb.zip cpython-da5b701aeef755f2317a41e36cc950cfdc0c95cb.tar.gz cpython-da5b701aeef755f2317a41e36cc950cfdc0c95cb.tar.bz2 |
Get rid of __context__, per the latest changes to PEP 343 and python-dev
discussion.
There are two places of documentation that still mention __context__:
Doc/lib/libstdtypes.tex -- I wasn't quite sure how to rewrite that without
spending a whole lot of time thinking about it; and whatsnew, which Andrew
usually likes to change himself.
Diffstat (limited to 'Python/compile.c')
-rw-r--r-- | Python/compile.c | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/Python/compile.c b/Python/compile.c index 8b6f2f1..15e7e15 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -3371,7 +3371,7 @@ expr_constant(expr_ty e) It is implemented roughly as: - context = (EXPR).__context__() + context = EXPR exit = context.__exit__ # not calling it value = context.__enter__() try: @@ -3387,17 +3387,12 @@ expr_constant(expr_ty e) static int compiler_with(struct compiler *c, stmt_ty s) { - static identifier context_attr, enter_attr, exit_attr; + static identifier enter_attr, exit_attr; basicblock *block, *finally; identifier tmpexit, tmpvalue = NULL; assert(s->kind == With_kind); - if (!context_attr) { - context_attr = PyString_InternFromString("__context__"); - if (!context_attr) - return 0; - } if (!enter_attr) { enter_attr = PyString_InternFromString("__enter__"); if (!enter_attr) @@ -3436,10 +3431,8 @@ compiler_with(struct compiler *c, stmt_ty s) PyArena_AddPyObject(c->c_arena, tmpvalue); } - /* Evaluate (EXPR).__context__() */ + /* Evaluate EXPR */ VISIT(c, expr, s->v.With.context_expr); - ADDOP_O(c, LOAD_ATTR, context_attr, names); - ADDOP_I(c, CALL_FUNCTION, 0); /* Squirrel away context.__exit__ */ ADDOP(c, DUP_TOP); |