8000 GH-90997: Wrap `yield from`/`await` in a virtual `try`/`except StopIteration` by brandtbucher · Pull Request #96010 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

GH-90997: Wrap yield from/await in a virtual try/except StopIteration #96010

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
Aug 19, 2022
Prev Previous commit
Next Next commit
fixup
  • Loading branch information
brandtbucher committed Aug 15, 2022
commit afdf25e52180da551eb6e42df01629f7407b76f9
2 changes: 1 addition & 1 deletion Python/ceval.c
Original file line number Diff line number Diff line change
Expand Up @@ -2751,7 +2751,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, _PyInterpreterFrame *frame, int

TARGET(LOAD_EXCEPTION_TYPE) {
assert(oparg < 2);
PyObject *value = oparg ? PyExc_StopIteration: PyExc_AssertionError;
PyObject *value = oparg ? PyExc_StopIteration : PyExc_AssertionError;
Py_INCREF(value);
PUSH(value);
DISPATCH();
Expand Down
2 changes: 1 addition & 1 deletion Python/compile.c
Original file line number Diff line number Diff line change
Expand Up @@ -1974,7 +1974,7 @@ compiler_add_yield_from(struct compiler *c, int await)
ADDOP_NAME(c, LOAD_ATTR, &_Py_ID(value), names);
ADDOP_I(c, SWAP, 3);
ADDOP(c, POP_TOP); // The thing we're yielding from.
ADDOP(c, POP_TOP); // The last sent value
ADDOP(c, POP_TOP); // The last sent value.

USE_LABEL(c, exit);
return 1;
Expand Down
0