LoLBench / cpython_9 /tests /private /omitted.patch
lolbench26's picture
Publish LoLBench Harbor tasks from artifact branch (part 11)
5a9e79d verified
Raw History Blame Contribute Delete
2.53 kB
diff --git a/Doc/library/dis.rst b/Doc/library/dis.rst
index 296d8a9c66..248743b8fa 100644
--- a/Doc/library/dis.rst
+++ b/Doc/library/dis.rst
@@ -1196,6 +1196,14 @@ iterations of the loop.
.. versionadded:: 3.12
+.. opcode:: LOAD_FAST_AND_CLEAR (var_num)
+
+ Pushes a reference to the local ``co_varnames[var_num]`` onto the stack (or
+ pushes ``NULL`` onto the stack if the local variable has not been
+ initialized) and sets ``co_varnames[var_num]`` to ``NULL``.
+
+ .. versionadded:: 3.12
+
.. opcode:: STORE_FAST (var_num)
Stores ``STACK.pop()`` into the local ``co_varnames[var_num]``.
diff --git a/Doc/whatsnew/3.12.rst b/Doc/whatsnew/3.12.rst
index 12d357f117..eb13d4bf03 100644
--- a/Doc/whatsnew/3.12.rst
+++ b/Doc/whatsnew/3.12.rst
@@ -153,6 +153,30 @@ New Features
In Python 3.14, the default will switch to ``'data'``.
(Contributed by Petr Viktorin in :pep:`706`.)
+.. _whatsnew312-pep709:
+
+PEP 709: Comprehension inlining
+-------------------------------
+
+Dictionary, list, and set comprehensions are now inlined, rather than creating a
+new single-use function object for each execution of the comprehension. This
+speeds up execution of a comprehension by up to 2x.
+
+Comprehension iteration variables remain isolated; they don't overwrite a
+variable of the same name in the outer scope, nor are they visible after the
+comprehension. This isolation is now maintained via stack/locals manipulation,
+not via separate function scope.
+
+Inlining does result in a few visible behavior changes:
+
+* There is no longer a separate frame for the comprehension in tracebacks,
+ and tracing/profiling no longer shows the comprehension as a function call.
+* Calling :func:`locals` inside a comprehension now includes variables
+ from outside the comprehension, and no longer includes the synthetic ``.0``
+ variable for the comprehension "argument".
+
+Contributed by Carl Meyer and Vladimir Matveev in :pep:`709`.
+
PEP 688: Making the buffer protocol accessible in Python
--------------------------------------------------------
diff --git a/Misc/NEWS.d/next/Core and Builtins/2023-01-30-15-40-29.gh-issue-97933.nUlp3r.rst b/Misc/NEWS.d/next/Core and Builtins/2023-01-30-15-40-29.gh-issue-97933.nUlp3r.rst
new file mode 100644
index 0000000000..2eec05cb3a
--- /dev/null
+++ b/Misc/NEWS.d/next/Core and Builtins/2023-01-30-15-40-29.gh-issue-97933.nUlp3r.rst
@@ -0,0 +1,2 @@
+:pep:`709`: inline list, dict and set comprehensions to improve performance
+and reduce bytecode size.