Repository navigation
sys.monitoring branches for match cases showing incorrectly #123044
Description
Activity
- addedtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
on Aug 15, 2024 Do we craete issues for unmerged PR? I thought issues are supposed to be about code that's already merged. For unmerged PRs, shouldn't we just discuss it in the PR itself?
- addedinterpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)
on Aug 16, 2024 I don't think there is any harm in creating a new issue. We often break down larger pieces of work into smaller issues.
We should make it clear that this is part of #122564, though.I think we should tackle these issues of locations within
matchstatement related issues as follows:- Generally, we want to be giving
POP_TOPs and other cleanup codeNO_LOCATIONin the front-end. - When assigning locations to instructions with no locations we should prefer locations within the same basic block to those locations outside it.
- We also want the compiler to prefer locations following the basic block, to those preceding it, which assigning locations to basic blocks with no locations.
@iritkatriel does that make sense to you?
- Generally, we want to be giving
We also want the compiler to prefer locations following the basic block, to those preceding it, which assigning locations to basic blocks with no locations.
I think it's doing the opposite now. Will need to experiment with this.
- addedtype-featureA feature request or enhancementA feature request or enhancementand removedtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
on Aug 20, 2024 Given that we cannot reliably expected
NOT_TAKENto be followed by an instruction with a meaningful location (see #123050) we'll need a different approach to this.We still need correct locations for actual expressions, but we should be fine with the compiler filling in locations as it does now for artificial instructions.
- added a commit that references this issue
on Mar 10, 2025
Bug report
Bug description:
With the code from PR 122564, the destinations of branches into the blocks of certain
cases are mapping to the pattern as well, making them look like they go out of scope:This code yields (branches listing below extracted from
co_branches()):@markshannon @nedbat
CPython versions tested on:
CPython main branch
Operating systems tested on:
macOS
Linked PRs
POP_TOPafter a case test a location in the body, not the pattern. #130627