Title: Error handling bugs in ast.c · Issue #104482 · python/cpython · GitHub
Open Graph Title: Error handling bugs in ast.c · Issue #104482 · python/cpython
X Title: Error handling bugs in ast.c · Issue #104482 · python/cpython
Description: 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, pat...
Open Graph Description: 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 @@ valid...
X Description: 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 @@ valid...
Opengraph URL: https://github.com/python/cpython/issues/104482
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Error handling bugs in ast.c","articleBody":"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.\r\n\r\n```\r\n--- a/Python/ast.c\r\n+++ b/Python/ast.c\r\n@@ -580,7 +580,9 @@ validate_pattern(struct validator *state, pattern_ty p, int star_ok)\r\n break;\r\n }\r\n }\r\n-\r\n+ if (ret == 0) {\r\n+ break;\r\n+ }\r\n ret = validate_patterns(state, p-\u003ev.MatchMapping.patterns, /*star_ok=*/0);\r\n break;\r\n case MatchClass_kind:\r\n@@ -620,6 +622,9 @@ validate_pattern(struct validator *state, pattern_ty p, int star_ok)\r\n }\r\n }\r\n \r\n+ if (ret == 0) {\r\n+ break;\r\n+ }\r\n if (!validate_patterns(state, p-\u003ev.MatchClass.patterns, /*star_ok=*/0)) {\r\n ret = 0;\r\n break;\r\n```\r\n\r\nIf we don't do this we can end up calling _PyAST_Compile with an error set.\r\n\r\n\n\n\u003c!-- gh-linked-prs --\u003e\n### Linked PRs\n* gh-104483\n* gh-104514\n\u003c!-- /gh-linked-prs --\u003e\n","author":{"url":"https://github.com/iritkatriel","@type":"Person","name":"iritkatriel"},"datePublished":"2023-05-14T18:51:50.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/104482/cpython/issues/104482"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:2aa1698e-168f-7ee4-a9ac-fc92ff169243 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9E2E:155AC0:70500B:9A007A:696950A5 |
| html-safe-nonce | 9180bf5f8eeec3b6c8ecc17fa37906e4549dd552b889b23134988c8edbdd01b7 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5RTJFOjE1NUFDMDo3MDUwMEI6OUEwMDdBOjY5Njk1MEE1IiwidmlzaXRvcl9pZCI6IjQ0Mjg2ODY4MzEwMzcwMTAwODUiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 0fd9bd97e397f49476a74d681f76d4b8401430792b09d256f1641ab843284977 |
| hovercard-subject-tag | issue:1709038923 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/cpython/104482/issue_layout |
| twitter:image | https://opengraph.githubassets.com/eacbaf33b4af19f6231ca65aea993a42acf9162a07f3c231b1213554de76e32d/python/cpython/issues/104482 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/eacbaf33b4af19f6231ca65aea993a42acf9162a07f3c231b1213554de76e32d/python/cpython/issues/104482 |
| og:image:alt | 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 @@ valid... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | iritkatriel |
| hostname | github.com |
| expected-hostname | github.com |
| None | 54182691a21263b584d2e600b758e081b0ff1d10ffc0d2eefa51cf754b43b51d |
| turbo-cache-control | no-preview |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | d69ac0477df0f87da03b8b06cebd187012d7a930 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width