Skip to content

gh-149985: Remove future annotations and if TYPE_CHECKING in pyrepl - #149992

Merged
JelleZijlstra merged 6 commits into
python:mainfrom
JelleZijlstra:nofuture
Aug 25, 2026
Merged

JelleZijlstra merged 6 commits into
python:mainfrom
JelleZijlstra:nofuture

Conversation

@JelleZijlstra

@JelleZijlstra JelleZijlstra commented May 18, 2026 •

Copy link
Copy Markdown
Member

from __future__ import annotations is soft-deprecated now that evaluation
of annotations is always deferred. if TYPE_CHECKING can often be replaced
with lazy imports.

A risk is that creation of dataclasses will be slower without from __future__ import annotations, because the dataclass machinery will force evaluation of annotations. However, if the annotations are simple my simple benchmarks do not show an appreciable slowdown.

…repl

`from __future__ import annotations` is soft-deprecated now that evaluation
of annotations is always deferred. `if TYPE_CHECKING` can often be replaced
with lazy imports.
@github-actions

Copy link
Copy Markdown

This PR is stale because it has been open for 90 days with no activity.

@github-actions github-actions Bot added the stale Stale PR or inactive for long period of time. label Aug 19, 2026
@github-actions github-actions Bot removed the stale Stale PR or inactive for long period of time. label Aug 25, 2026
@JelleZijlstra
JelleZijlstra merged commit e2118b0 into python:main Aug 25, 2026
57 checks passed
clin1234 pushed a commit to clin1234/cpython that referenced this pull request Aug 27, 2026
…repl (python#149992)

`from __future__ import annotations` is soft-deprecated now that evaluation
of annotations is always deferred. `if TYPE_CHECKING` can often be replaced
with lazy imports.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

1 participant