Changes between Version 1 and Version 3 of Ticket #36916


Ignore:
Timestamp:
Feb 10, 2026, 10:37:28 AM (4 hours ago)
Author:
Thomas Grainger
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #36916

    • Property Owner Amar removed
    • Property Status assignednew
  • Ticket #36916 – Description

    v1 v3  
    22https://github.com/django/new-features/issues/117
    33
    4 ### Feature Description
    54
    6 see  https://forum.djangoproject.com/t/streamingresponse-driven-by-a-taskgroup/40320/4
     5=== Feature Description ===
    76
    8 I'd like to be able to write code that combines multiple streams of data:
    9 ```py
     7see https://forum.djangoproject.com/t/streamingresponse-driven-by-a-taskgroup/40320/4
     8
     9I’d like to be able to write code that combines multiple streams of data:
     10
     11
     12{{{
    1013async def news_and_weather(request: HttpRequest) -> StreamingHttpResponse:
    1114    async def gen() -> AsyncGenerator[bytes]:
     
    2427                    yield msg  # yield in async generator!! illegal inside TaskGroup!
    2528    return StreamingHttpResponse(gen())
    26 ```
     29}}}
    2730
    2831
    2932
    30 ### Problem
     33=== Problem ===
    3134
    3235however this doesn’t work because I’m using a yield inside an async generator that’s not a context manager, and calling aclosing() on that async generator is not sufficient to allow a TaskGroup to cancel itself and catch the cancel error.
    3336
    34 ```py
    3537
     38
     39{{{
    3640from useful_types import SupportsAnext
    3741
     
    6569
    6670    return StreamingAcmgrHttpResponse(acmgr_gen())
    67 ```
     71}}}
    6872
    69 ### Implementation Suggestions
     73
     74=== Implementation Suggestions ===
    7075
    7176https://github.com/django/django/pull/19364/changes
Back to Top