From cbad048abfb3c9dafaa34af5f29bb2317e43cb0a Mon Sep 17 00:00:00 2001 From: Carl Meyer Date: Fri, 27 Sep 2024 16:26:43 -0700 Subject: [PATCH] update tests --- Lib/test/test_listcomps.py | 18 ++++++++++-------- Python/flowgraph.c | 2 +- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/Lib/test/test_listcomps.py b/Lib/test/test_listcomps.py index 1a88e8cc1a5cc9..1e1e9e32dc2f76 100644 --- a/Lib/test/test_listcomps.py +++ b/Lib/test/test_listcomps.py @@ -754,25 +754,27 @@ def test_freevar_through_scope_containing_comprehension(self): code = """ x = 1 def f(): - [x for x in [1]] + for z in [x for x in [2]]: + pass def g(): return x - return g() - y = f() + return g(), z + y, z = f() """ - self._check_in_scopes(code, {"x": 1, "y": 1}, scopes=["module", "function"]) + self._check_in_scopes(code, {"x": 1, "y": 1, "z": 2}, scopes=["module", "function"]) def test_freevar_through_scope_containing_comprehension_with_cell(self): code = """ x = 1 def f(): - [lambda: x for x in [1]] + for l in [lambda: x for x in [2]]: + z = l() def g(): return x - return g() - y = f() + return g(), z + y, z = f() """ - self._check_in_scopes(code, {"x": 1, "y": 1}, scopes=["function"]) + self._check_in_scopes(code, {"x": 1, "y": 1, "z": 2}, scopes=["function"]) __test__ = {'doctests' : doctests} diff --git a/Python/flowgraph.c b/Python/flowgraph.c index 69d7e0a872aa48..eb037b54aacc0d 100644 --- a/Python/flowgraph.c +++ b/Python/flowgraph.c @@ -2700,7 +2700,7 @@ insert_prefix_instructions(_PyCompile_CodeUnitMetadata *umd, basicblock *entrybl } cfg_instr make_cell = { .i_opcode = MAKE_CELL, - // This will get fixed in offset_derefs(). + // This will get fixed in fix_cell_offsets(). .i_oparg = oldindex, .i_loc = NO_LOCATION, .i_target = NULL,