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

Annotated assignment in amatch block does not generateSETUP_ANNOTATIONS #105164

Closed
Assignees
JelleZijlstra
Labels
3.11only security fixes3.12only security fixes3.13bugs and security fixesinterpreter-core(Objects, Python, Grammar, and Parser dirs)triagedThe issue has been accepted as valid by a triager.type-bugAn unexpected behavior, bug, or error
@martindemello

Description

@martindemello

Bug report

Compiling the following code:

match 0:    case 0:        x: int = 1

generates

  1           0 LOAD_CONST               0 (0)  2           2 LOAD_CONST               0 (0)              4 COMPARE_OP               2 (==)              6 POP_JUMP_IF_FALSE       12 (to 24)  3           8 LOAD_CONST               1 (1)             10 STORE_NAME               0 (x)             12 LOAD_NAME                1 (int)             14 LOAD_NAME                2 (__annotations__)             16 LOAD_CONST               2 ('x')             18 STORE_SUBSCR             20 LOAD_CONST               3 (None)             22 RETURN_VALUE  2     >>   24 LOAD_CONST               3 (None)             26 RETURN_VALUE

There is noSETUP_ANNOTATIONS opcode generated despite the__annotations__ access later on. (Found viagoogle/pytype#1435 - for some reason this does not generate a runtime error, but it does cause issues for tools like pytype.)

Your environment

cpython 3.10

Linked PRs

Metadata

Metadata

Assignees

Labels

3.11only security fixes3.12only security fixes3.13bugs and security fixesinterpreter-core(Objects, Python, Grammar, and Parser dirs)triagedThe issue has been accepted as valid by a triager.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