Skip to content

Compilation for async for comprehensions is not yet implemented #2510

Closed

Description

@coolreader18

i.e. [x async for y in z]. There's an unimplemnted!("async for comprehensions") in compiler/src/compile.rs, which is where an implementation could start out. Take a look at how normal compile_for works for async and how compile_for's non-async implementation is structured somewhat similarly to compile_comprehension.

Activity

  1. aaronclong commented on Mar 4, 2021

    @aaronclong
    Contributor

    @coolreader18 I'm looking into this, not committing to when I can implement it. However, I was wondering if there was a good guide for the Instruction enum? I can generally get an idea for each operation. However, I have never really worked on a programming language, so a guide, definition, or something would be amazing.

  2. coolreader18 commented on Mar 4, 2021

    @coolreader18
    MemberAuthor

    @aaronclong ah, we don't really have that, the closest thing would be doc comments on the enum variants but there aren't many. That's definitely something to improve. However, you can check the CPython docs for the dis module, we share many of the same instructions (although renamed to CamelCase, obviously) and you can usually check how CPython compiles things using dis.dis() for inspiration for how to do it in our compiler

  3. linked a pull request that will close this issueWIP: 2510 Async list Comprehension #2513on Mar 9, 2021
  4. HyeockJinKim commented on Aug 7, 2021

    @HyeockJinKim
    Contributor

    If no one is working on this issue, can I take this issue?

  5. DimitrisJim commented on Aug 7, 2021

    @DimitrisJim
    Member

    @aaronclong are you available to finish this up?

  6. youknowone commented on Apr 25, 2024

    @youknowone
    Member

    #5276 adds basic async for comprehension support. but still missing lots of features.
    Including compile error (test_asyncgen.test_async_gen_expression_02) and runtime error (test_asyncgen.test_async_gen_expression_01)

  7. youknowone commented on Dec 25, 2025

    @youknowone
    Member

    now it is supported

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions