Django: Async Iterator Cleanup and Distinct Alias Fix
Django merged a reliability fix to deterministically close async iterators across auth, queries, pagination and streaming responses, documented for 6.2, while a separate open proposal fixes distinct with field names to resolve annotation aliases containing double underscores. The two changes form no single pattern, with the async cleanup carrying the highest impact.
Duration: PT2M12S
Episode overview
This episode is a short developer briefing from Django.
It explains recent repository work in plain language.
- Show: Django
- Published: 2026-09-28T13:09:29Z
- Audio duration: PT2M12S
Transcript excerpt
This excerpt keeps the crawler page concise. Listen to the episode or use the RSS feed for the full update.
Good morning, it's September 28th, 2026, and this is your Django briefing.
The headline is reliability for async code: Django is now closing async iterators deterministically instead of leaving cleanup to Python's async generator finalizer.
These two items do not share a broader theme, and the async work is the highest-impact change. That change landed as merged PR 22025, building on commit 9e06baf for ticket 37066, and it applies a consistent rule everywhere Django consumes an async iterator it did not create itself. That includes authentication…
The fix wraps consumption in async closing contexts, so the iterator's close method runs as soon as the consumer exits. For caller-supplied iterators that may only implement iteration and next, without a close method, there is a new maybe async closing helper that uses a no-operation context instead. For developers,…
Separately, open PR 22044 for ticket 37350 proposes a focused query compiler fix. Today, distinct with field names splits each name on double underscores before checking if it is an annotation alias, which breaks aliases that themselves contain double underscores. The proposal resolves the full name as an alias…
What's next:…
Nearby episodes from Django
- Weekly Recap - Async Safety and Speed Plus ORM Reliability
- Unnamed URL Translation Fix and Query Cleanup
- Null Query Fix, Template Tokens, and Signing Validation
- Defensive Fixes for SQLite, Hashers and Headers
- ASGI Middleware Fix and Async Cleanup
- Model Edge Cases and Driver Docs
- File Move Race Fix and Sitemap Docs
- GIS Cleanup and Stricter Model Checks