Skip to content

Support yield and await nested in expressions #693

@msullivan

Description

@msullivan

We currently don't support code like x = foo() + await bar(), since the result of calling foo() will be stored in a temporary that is not spilled to the environment.

I think that the best approach to solve this is to add another compiler pass that detects values that live across yields (which may just be the values that are live on function entry?) and spills them to the environment.

I think that scheme would also let us get rid of the manual spilling we do of compiler-induced temporaries in a bunch of situations (exception handling, with, etc). With some care it could maybe also subsume a bunch of the spill handling for nested functions too?

Metadata

Metadata

Assignees

Labels

featureSupporting previously unsupported Python, new native types, new features, etc.priority-1-normalpython compatMypyc doesn't match CPython or documented semantics.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions