summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorda-woods <dw-git@d-woods.co.uk>2022-07-16 09:48:45 +0100
committerda-woods <dw-git@d-woods.co.uk>2022-07-16 09:48:45 +0100
commitcbbce17dfb1faa53ac0cc687a1117d9cbc1b6d21 (patch)
treef7c0d01df91e7bb8025120ebf61c3b06028e0fe7
parent0d6c4cf70a37101c3dcb720c6cae53b7fd2b46cf (diff)
parentc6bda31bcb957027acea36a5c72e57b404713b72 (diff)
downloadcython-cbbce17dfb1faa53ac0cc687a1117d9cbc1b6d21.tar.gz
Merge branch 'basic_match' into guards
-rw-r--r--Cython/Compiler/MatchCaseNodes.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/Cython/Compiler/MatchCaseNodes.py b/Cython/Compiler/MatchCaseNodes.py
index a13bc4114..f0ed9a5dd 100644
--- a/Cython/Compiler/MatchCaseNodes.py
+++ b/Cython/Compiler/MatchCaseNodes.py
@@ -412,7 +412,12 @@ class OrPatternNode(PatternNode):
a.validate_irrefutable()
def is_simple_value_comparison(self):
- return all(a.is_simple_value_comparison() for a in self.alternatives)
+ return all(
+ # it turns out to be hard to generate correct assignment code
+ # for or patterns with targets
+ a.is_simple_value_comparison() and not a.get_targets()
+ for a in self.alternatives
+ )
def get_simple_comparison_node(self, subject_node):
assert self.is_simple_value_comparison()