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

Source location of match sub-expressions are incorrect #98762

Closed
Assignees
iritkatrielbrandtbucher
Labels
3.12only security fixesinterpreter-core(Objects, Python, Grammar, and Parser dirs)type-bugAn unexpected behavior, bug, or error
@iritkatriel

Description

@iritkatriel
def f(x):  match x:    case a,b:        return 1import disfrom pprint import pprint as ppdef pos(p):    return (p.lineno, p.end_lineno, p.col_offset, p.end_col_offset)pp([(pos(x.positions), x.opname, x.argval) for x in dis.get_instructions(f)])

Output is:

[((2, 2, 0, 0), 'RESUME', 0), ((3, 3, 8, 9), 'LOAD_FAST', 'x'), ((4, 4, 9, 12), 'MATCH_SEQUENCE', None), ((4, 4, 9, 12), 'POP_JUMP_IF_FALSE', 32), ((4, 4, 9, 12), 'GET_LEN', None), ((4, 4, 9, 12), 'LOAD_CONST', 2), ((4, 4, 9, 12), 'COMPARE_OP', '=='), ((4, 4, 9, 12), 'POP_JUMP_IF_FALSE', 32), ((4, 4, 9, 12), 'UNPACK_SEQUENCE', 2), ((4, 4, 11, 12), 'STORE_FAST', 'a'),           <-- incorrect ((4, 4, 11, 12), 'STORE_FAST', 'b'), ((5, 5, 15, 16), 'LOAD_CONST', 1), ((5, 5, 15, 16), 'RETURN_VALUE', None), ((4, 4, 9, 12), 'POP_TOP', None), ((4, 4, 9, 12), 'LOAD_CONST', None), ((4, 4, 9, 12), 'RETURN_VALUE', None)]

Metadata

Metadata

Labels

3.12only security fixesinterpreter-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