diff options
author | Mark Shannon <mark@hotpy.org> | 2025-01-06 17:54:47 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-01-06 17:54:47 +0000 |
commit | f826beca0cedb8e4b92896544c75fd0d9dcb0446 (patch) | |
tree | 87630b6e28e141a0e687e04d2f66d8e4cde21b99 /Python/executor_cases.c.h | |
parent | b9c693dcca01537eee1ef716ffebc632be37594b (diff) | |
download | cpython-f826beca0cedb8e4b92896544c75fd0d9dcb0446.tar.gz cpython-f826beca0cedb8e4b92896544c75fd0d9dcb0446.zip |
GH-128375: Better instrument for `FOR_ITER` (GH-128445)
Diffstat (limited to 'Python/executor_cases.c.h')
-rw-r--r-- | Python/executor_cases.c.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/Python/executor_cases.c.h b/Python/executor_cases.c.h index f7374d52705..ac2f69b7e98 100644 --- a/Python/executor_cases.c.h +++ b/Python/executor_cases.c.h @@ -411,6 +411,20 @@ break; } + case _END_FOR: { + _PyStackRef value; + value = stack_pointer[-1]; + /* Don't update instr_ptr, so that POP_ITER sees + * the FOR_ITER as the previous instruction. + * This has the benign side effect that if value is + * finalized it will see the location as the FOR_ITER's. + */ + PyStackRef_CLOSE(value); + stack_pointer += -1; + assert(WITHIN_STACK_BOUNDS()); + break; + } + case _END_SEND: { _PyStackRef value; _PyStackRef receiver; |