Skip to content

Commit 43b5f02

Browse files
DinoVfacebook-github-bot
authored andcommitted
Fix location for popping pattern
Summary: We have the wrong location for the POP_TOP of a pattern. It also impacts 3.12 so this is an easy fix. Reviewed By: mpage Differential Revision: D82077054 fbshipit-source-id: 5c764a324a550b5e89483aa348bcd5ecc81b6660
1 parent b09dfc2 commit 43b5f02

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

cinderx/PythonLib/cinderx/compiler/pycodegen.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5867,7 +5867,7 @@ def emit_finish_match_class(self, node: ast.MatchClass, pc: PatternContext) -> N
58675867
else:
58685868
pattern = kwd_patterns[i - nargs]
58695869
if self._wildcard_check(pattern):
5870-
self.emit("POP_TOP")
5870+
self.graph.emit_with_loc("POP_TOP", 0, node)
58715871
continue
58725872

58735873
self._visit_subpattern(pattern, pc)
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# pyre-ignore-all-errors
2+
def f(x):
3+
match item:
4+
case C(a, _, b, c):
5+
pass

0 commit comments

Comments
 (0)