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

assigning to __annotations__ has no effect in 3.14.0b1 under from __future__ import annotations #133778

Closed
Assignees
JelleZijlstra
Labels
3.14bugs and security fixesstdlibStandard Library Python modules in the Lib/ directorytopic-typingtype-bugAn unexpected behavior, bug, or error
@zzzeek

Description

@zzzeek

Bug report

Bug description:

from __future__importannotationsimportannotationlibclassA:a:intA.__annotations__= {"a":str}print(A.__annotations__)print(annotationlib.get_annotations(A))

this works in 3.14.0a7, has no effect in 3.14.0b1. there seems to be a new attribute__annotations_cache__ that the assignment goes into but it isn't returned from__annotations__:

# 3.14.0a7$ ~/.venv314a7/bin/python test4.py {'a': <class 'str'>}{'a': <class 'str'>}# 3.14.0b1$ ~/.venv314/bin/python test4.py {'a': 'int'}{'a': 'int'}

If there's a way to get annotationlib.get_annotations() to pick up the change I can use that as a workaround

cc@JelleZijlstra

CPython versions tested on:

3.14

Operating systems tested on:

No response

Linked PRs

Metadata

Metadata

Assignees

Labels

3.14bugs and security fixesstdlibStandard Library Python modules in the Lib/ directorytopic-typingtype-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