diff options
author | AlexSm <alex@ydb.tech> | 2024-05-06 18:27:11 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-06 18:27:11 +0200 |
commit | 068e8291de67631f063304b76dda3c1fd6601c12 (patch) | |
tree | f9058c69ef88f04c55ff9c92949dffa8cd6b83a5 /contrib/tools/python3/Objects/genobject.c | |
parent | 653a427438ab0fa69068180c34233b015af0d405 (diff) | |
parent | 41f0129e44731de1ba129fbae27008f8a4048fdc (diff) | |
download | ydb-068e8291de67631f063304b76dda3c1fd6601c12.tar.gz |
Merge pull request #4325 from ydb-platform/mergelibs-240506-1255
Library import 240506-1255
Diffstat (limited to 'contrib/tools/python3/Objects/genobject.c')
-rw-r--r-- | contrib/tools/python3/Objects/genobject.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/contrib/tools/python3/Objects/genobject.c b/contrib/tools/python3/Objects/genobject.c index 3b9e4a6036..bc58409c18 100644 --- a/contrib/tools/python3/Objects/genobject.c +++ b/contrib/tools/python3/Objects/genobject.c @@ -374,7 +374,6 @@ static PyObject * gen_close(PyGenObject *gen, PyObject *args) { PyObject *retval; - PyObject *yf = _PyGen_yf(gen); int err = 0; if (gen->gi_frame_state == FRAME_CREATED) { @@ -384,6 +383,7 @@ gen_close(PyGenObject *gen, PyObject *args) if (gen->gi_frame_state >= FRAME_COMPLETED) { Py_RETURN_NONE; } + PyObject *yf = _PyGen_yf(gen); if (yf) { PyFrameState state = gen->gi_frame_state; gen->gi_frame_state = FRAME_EXECUTING; @@ -396,12 +396,13 @@ gen_close(PyGenObject *gen, PyObject *args) * YIELD_VALUE if the debugger has changed the lineno. */ if (err == 0 && is_yield(frame->prev_instr)) { assert(is_resume(frame->prev_instr + 1)); - int exception_handler_depth = frame->prev_instr[0].op.code; + int exception_handler_depth = frame->prev_instr[0].op.arg; assert(exception_handler_depth > 0); /* We can safely ignore the outermost try block * as it automatically generated to handle * StopIteration. */ if (exception_handler_depth == 1) { + gen->gi_frame_state = FRAME_COMPLETED; Py_RETURN_NONE; } } |