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

Name lookup in annotation scopes in classes does not work with non-dict globals #119821

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

Description

@JelleZijlstra

Bug report

Bug description:

This works:

classcustomdict(dict):def__missing__(self,key):returnkeycode=compile("type Alias = undefined","test","exec")ns=customdict()exec(code,ns)Alias=ns["Alias"]assertAlias.__value__=="undefined"

But this does not:

code=compile("class A: type Alias = undefined","test","exec")ns=customdict()exec(code,ns)Alias=ns["A"].AliasassertAlias.__value__=="undefined"

This is a problem for PEP 649 because we're going to rely on a non-dict globals namespace.

CPython versions tested on:

CPython main branch

Operating systems tested on:

macOS

Linked PRs

Metadata

Metadata

Assignees

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