Mercurial > cpython-lru_cache-weakref
diff Python/ceval.c @ 35298:b2fe5f8fcfdd legacy-trunk
PEP 342 implementation. Per Guido's comments, the generator throw()
method still needs to support string exceptions, and allow None for the
third argument. Documentation updates are needed, too.
| author | Phillip J. Eby <pje@telecommunity.com> |
|---|---|
| date | Tue, 02 Aug 2005 00:46:46 +0000 |
| parents | 70681267a74a |
| children | 700f08369092 |
line wrap: on
line diff
--- a/Python/ceval.c Mon Aug 01 21:39:29 2005 +0000 +++ b/Python/ceval.c Tue Aug 02 00:46:46 2005 +0000 @@ -499,7 +499,14 @@ /* Interpreter main loop */ PyObject * -PyEval_EvalFrame(PyFrameObject *f) +PyEval_EvalFrame(PyFrameObject *f) { + /* This is for backward compatibility with extension modules that + used this API; core interpreter code should call PyEval_EvalFrameEx() */ + return PyEval_EvalFrameEx(f, 0); +} + +PyObject * +PyEval_EvalFrameEx(PyFrameObject *f, int throw) { #ifdef DXPAIRS int lastopcode = 0; @@ -747,6 +754,11 @@ x = Py_None; /* Not a reference, just anything non-NULL */ w = NULL; + if (throw) { /* support for generator.throw() */ + why = WHY_EXCEPTION; + goto on_error; + } + for (;;) { #ifdef WITH_TSC if (inst1 == 0) { @@ -2733,7 +2745,7 @@ return PyGen_New(f); } - retval = PyEval_EvalFrame(f); + retval = PyEval_EvalFrameEx(f,0); fail: /* Jump here from prelude on failure */ @@ -3636,7 +3648,7 @@ Py_INCREF(*stack); fastlocals[i] = *stack++; } - retval = PyEval_EvalFrame(f); + retval = PyEval_EvalFrameEx(f,0); assert(tstate != NULL); ++tstate->recursion_depth; Py_DECREF(f);
