File tree 1 file changed +6
-0
lines changed 1 file changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -253,6 +253,12 @@ Inlining does result in a few visible behavior changes:
253
253
* Calling :func: `locals ` inside a comprehension now includes variables
254
254
from outside the comprehension, and no longer includes the synthetic ``.0 ``
255
255
variable for the comprehension "argument".
256
+ * A comprehension iterating directly over ``locals() `` (e.g. ``[k for k in
257
+ locals()] ``) may see "RuntimeError: dictionary changed size during iteration"
258
+ when run under tracing (e.g. code coverage measurement). This is the same
259
+ behavior already seen in e.g. ``for k in locals(): ``. To avoid the error, first
260
+ create a list of keys to iterate over: ``keys = list(locals()); [k for k in
261
+ keys] ``.
256
262
257
263
Contributed by Carl Meyer and Vladimir Matveev in :pep: `709 `.
258
264
You can’t perform that action at this time.
0 commit comments