@@ -153,6 +153,30 @@ New Features
153153 In Python 3.14, the default will switch to ``'data' ``.
154154 (Contributed by Petr Viktorin in :pep: `706 `.)
155155
156+ .. _whatsnew312-pep709 :
157+
158+ PEP 709: Comprehension inlining
159+ -------------------------------
160+
161+ Dictionary, list, and set comprehensions are now inlined, rather than creating a
162+ new single-use function object for each execution of the comprehension. This
163+ speeds up execution of a comprehension by up to 2x.
164+
165+ Comprehension iteration variables remain isolated; they don't overwrite a
166+ variable of the same name in the outer scope, nor are they visible after the
167+ comprehension. This isolation is now maintained via stack/locals manipulation,
168+ not via separate function scope.
169+
170+ Inlining does result in a few visible behavior changes:
171+
172+ * There is no longer a separate frame for the comprehension in tracebacks,
173+ and tracing/profiling no longer shows the comprehension as a function call.
174+ * Calling :func: `locals ` inside a comprehension now includes variables
175+ from outside the comprehension, and no longer includes the synthetic ``.0 ``
176+ variable for the comprehension "argument".
177+
178+ Contributed by Carl Meyer and Vladimir Matveev in :pep: `709 `.
179+
156180PEP 688: Making the buffer protocol accessible in Python
157181--------------------------------------------------------
158182
@@ -282,6 +306,11 @@ asyncio
282306 writing to sockets and uses :meth: `~socket.socket.sendmsg ` if the platform
283307 supports it. (Contributed by Kumar Aditya in :gh: `91166 `.)
284308
309+ * Added :func: `asyncio.eager_task_factory ` and :func: `asyncio.create_eager_task_factory `
310+ functions to allow opting an event loop in to eager task execution,
311+ making some use-cases 2x to 5x faster.
312+ (Contributed by Jacob Bower & Itamar O in :gh: `102853 `, :gh: `104140 `, and :gh: `104138 `)
313+
285314* On Linux, :mod: `asyncio ` uses :class: `~asyncio.PidfdChildWatcher ` by default
286315 if :func: `os.pidfd_open ` is available and functional instead of
287316 :class: `~asyncio.ThreadedChildWatcher `.
@@ -644,11 +673,6 @@ Optimizations
644673* Speed up :class: `asyncio.Task ` creation by deferring expensive string formatting.
645674 (Contributed by Itamar O in :gh: `103793 `.)
646675
647- * Added :func: `asyncio.eager_task_factory ` and :func: `asyncio.create_eager_task_factory `
648- functions to allow opting an event loop in to eager task execution,
649- speeding up some use-cases by up to 50%.
650- (Contributed by Jacob Bower & Itamar O in :gh: `102853 `)
651-
652676
653677CPython bytecode changes
654678========================
0 commit comments