Commit 4ab3f0f
committed
[mypyc] Free generator after await encounters StopIteration
Previously the awaited generator could stay alive until the generator
that performed the await was freed, delaying object reclamation. The
refcount analysis doesn't understand registers spilled to the
environment, so we need to manually clear the value.
Consider code like this:
```
async def foo() -> None:
await bar()
await zar()
```
Previously, the `bar()` generator was only freed at end of `foo()`. Now
we release it before `await zar()`, as expected.1 parent 71942c0 commit 4ab3f0f
1 file changed
+4
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
940 | 940 | | |
941 | 941 | | |
942 | 942 | | |
| 943 | + | |
| 944 | + | |
| 945 | + | |
| 946 | + | |
943 | 947 | | |
944 | 948 | | |
945 | 949 | | |
| |||
0 commit comments