gh-130080: do not fold match case constants in unoptimized AST (#131577)

This commit is contained in:
Irit Katriel 2025-03-23 13:50:14 +00:00 committed by GitHub
parent fd459b1153
commit 64906bb223
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 15 additions and 0 deletions

View file

@ -824,6 +824,9 @@ astfold_withitem(withitem_ty node_, PyArena *ctx_, _PyASTOptimizeState *state)
static int
fold_const_match_patterns(expr_ty node, PyArena *ctx_, _PyASTOptimizeState *state)
{
if (state->syntax_check_only) {
return 1;
}
switch (node->kind)
{
case UnaryOp_kind: