--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cgen/templates/default/setup_with Fri May 11 16:21:51 2012 -0700 @@ -0,0 +1,28 @@ + + TARGET(SETUP_WITH) + { + _Py_IDENTIFIER(__exit__); + _Py_IDENTIFIER(__enter__); + w = TOP(); + x = special_lookup(w, &PyId___exit__); + if (!x) + goto on_error; + SET_TOP(x); + u = special_lookup(w, &PyId___enter__); + Py_DECREF(w); + if (!u) { + x = NULL; + goto on_error; + } + x = PyObject_CallFunctionObjArgs(u, NULL); + Py_DECREF(u); + if (!x) + goto on_error; + /* Setup the finally block before pushing the result + of __enter__ on the stack. */ + PyFrame_BlockSetup(f, SETUP_FINALLY, INSTR_OFFSET() + oparg, + STACK_LEVEL()); + + PUSH(x); + DISPATCH(); + }