[3.12] gh-109889: fix compiler's redundant NOP detection to look past NOPs with no lineno when looking for the next instruction's lineno (GH-109987) (#110048)

gh-109889: fix compiler's redundant NOP detection to look past NOPs with no lineno when looking for the next instruction's lineno (GH-109987)
(cherry picked from commit f580edcc6a)

Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
This commit is contained in:
Miss Islington (bot) 2023-10-02 08:43:16 -07:00 committed by GitHub
parent c794103417
commit 2b96102f29
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 1 deletions

View file

@ -1269,6 +1269,11 @@ class TestSpecifics(unittest.TestCase):
while x:
0 if 1 else 0
def test_remove_redundant_nop_edge_case(self):
# See gh-109889
def f():
a if (1 if b else c) else d
@requires_debug_ranges()
class TestSourcePositions(unittest.TestCase):
# Ensure that compiled code snippets have correct line and column numbers