diff options
author | Matthias Bussonnier <bussonniermatthias@gmail.com> | 2019-05-28 07:10:59 (GMT) |
---|---|---|
committer | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2019-05-28 07:10:59 (GMT) |
commit | 3880f263d2994fb1eba25835dddccb0cf696fdf0 (patch) | |
tree | 0c40e3b7cab9b3aa59600cec290548709d7c7dc4 /Python/ceval.c | |
parent | 436c2b0d67da68465e709a96daac7340af3a5238 (diff) | |
download | cpython-3880f263d2994fb1eba25835dddccb0cf696fdf0.zip cpython-3880f263d2994fb1eba25835dddccb0cf696fdf0.tar.gz cpython-3880f263d2994fb1eba25835dddccb0cf696fdf0.tar.bz2 |
bpo-36933: Remove sys.set_coroutine_wrapper (marked for removal in 3.8) (GH-13577)
It has been documented as deprecated and to be removed in 3.8;
From a comment on another thread – which I can't find ; leave get_coro_wrapper() for now, but always return `None`.
https://bugs.python.org/issue36933
Diffstat (limited to 'Python/ceval.c')
-rw-r--r-- | Python/ceval.c | 39 |
1 files changed, 0 insertions, 39 deletions
diff --git a/Python/ceval.c b/Python/ceval.c index cb5a4be..9263df9 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -4143,19 +4143,8 @@ _PyEval_EvalCodeWithName(PyObject *_co, PyObject *globals, PyObject *locals, /* Handle generator/coroutine/asynchronous generator */ if (co->co_flags & (CO_GENERATOR | CO_COROUTINE | CO_ASYNC_GENERATOR)) { PyObject *gen; - PyObject *coro_wrapper = tstate->coroutine_wrapper; int is_coro = co->co_flags & CO_COROUTINE; - if (is_coro && tstate->in_coroutine_wrapper) { - assert(coro_wrapper != NULL); - _PyErr_Format(tstate, PyExc_RuntimeError, - "coroutine wrapper %.200R attempted " - "to recursively wrap %.200R", - coro_wrapper, - co); - goto fail; - } - /* Don't need to keep the reference to f_back, it will be set * when the generator is resumed. */ Py_CLEAR(f->f_back); @@ -4175,14 +4164,6 @@ _PyEval_EvalCodeWithName(PyObject *_co, PyObject *globals, PyObject *locals, _PyObject_GC_TRACK(f); - if (is_coro && coro_wrapper != NULL) { - PyObject *wrapped; - tstate->in_coroutine_wrapper = 1; - wrapped = PyObject_CallFunction(coro_wrapper, "N", gen); - tstate->in_coroutine_wrapper = 0; - return wrapped; - } - return gen; } @@ -4634,26 +4615,6 @@ _PyEval_GetCoroutineOriginTrackingDepth(void) } void -_PyEval_SetCoroutineWrapper(PyObject *wrapper) -{ - PyThreadState *tstate = _PyThreadState_GET(); - - if (PySys_Audit("sys.set_coroutine_wrapper", NULL) < 0) { - return; - } - - Py_XINCREF(wrapper); - Py_XSETREF(tstate->coroutine_wrapper, wrapper); -} - -PyObject * -_PyEval_GetCoroutineWrapper(void) -{ - PyThreadState *tstate = _PyThreadState_GET(); - return tstate->coroutine_wrapper; -} - -void _PyEval_SetAsyncGenFirstiter(PyObject *firstiter) { PyThreadState *tstate = _PyThreadState_GET(); |