Skip to content

Commit 6ca92bc

Browse files
committed
resolve zpoint#46
1 parent 8c48f42 commit 6ca92bc

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

Interpreter/frame/example3.png

-192 KB
Loading

Interpreter/frame/frame.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,9 @@ the opcode `34 GET_YIELD_FROM_ITER` makes sure the stack's top is an iterable ob
202202

203203
```
204204

205-
field **f_lasti** is 36, indicate that it's before the `38 YIELD_FROM`
205+
field **f_lasti** is 36, indicate that it's after `38 YIELD_FROM`
206+
207+
in the end of `YIELD_FROM` the following code `f->f_lasti -= sizeof(_Py_CODEUNIT);` reset the `f_lasti` to the beginning of `YIELD_FROM` [Thanks to @RyanHe123](https://github.com/zpoint/CPython-Internals/issues/46)
206208

207209
![example3](./example3.png)
208210

Interpreter/frame/frame_cn.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,9 @@ opcode `18 LOAD_FAST 2 (c)` 把 **f_localsplus** 位置下标为
202202

203203
```
204204

205-
字段 **f_lasti** 现在值是 36, 表明他在 `38 YIELD_FROM` 之前
205+
字段 **f_lasti** 现在值是 36, 表明他在 `38 YIELD_FROM` 之后
206+
207+
`YIELD_FROM` 的末尾这一行代码 `f->f_lasti -= sizeof(_Py_CODEUNIT);` 会把 `f_lasti` 重置为刚进入 `YIELD_FROM` 的位置 [感谢 @RyanHe123 指正](https://github.com/zpoint/CPython-Internals/issues/46)
206208

207209
![example3](./example3.png)
208210

0 commit comments

Comments
 (0)