Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Error handling bugs in ast.c #104482

Closed
Labels
interpreter-core(Objects, Python, Grammar, and Parser dirs)type-bugAn unexpected behavior, bug, or error
@iritkatriel

Description

@iritkatriel

in validate_pattern, there are two places where in case of error we break out of a loop, but we also need to break out of the switch.

--- a/Python/ast.c+++ b/Python/ast.c@@ -580,7 +580,9 @@ validate_pattern(struct validator *state, pattern_ty p, int star_ok)                     break;                 }             }-+            if (ret == 0) {+                break;+            }             ret = validate_patterns(state, p->v.MatchMapping.patterns, /*star_ok=*/0);             break;         case MatchClass_kind:@@ -620,6 +622,9 @@ validate_pattern(struct validator *state, pattern_ty p, int star_ok)                 }             } +            if (ret == 0) {+                break;+            }             if (!validate_patterns(state, p->v.MatchClass.patterns, /*star_ok=*/0)) {                 ret = 0;                 break;

If we don't do this we can end up calling _PyAST_Compile with an error set.

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    interpreter-core(Objects, Python, Grammar, and Parser dirs)type-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp