Skip to content

[red-knot] Fallback for typing._NoDefaultType#14783

Merged
sharkdp merged 2 commits intomainfrom
david/no-default-type-fallback
Dec 5, 2024
Merged

[red-knot] Fallback for typing._NoDefaultType#14783
sharkdp merged 2 commits intomainfrom
david/no-default-type-fallback

Conversation

@sharkdp
Copy link
Contributor

@sharkdp sharkdp commented Dec 5, 2024

Summary

typing_extensions has a >=3.13 re-export for the typing.NoDefault singleton, but not for typing._NoDefaultType. This causes problems as soon as we understand sys.version_info branches, so we explicity switch to typing._NoDefaultType for Python 3.13 and later.

This is a part of #14759 that I thought might make sense to break out and merge in isolation.

Test Plan

New test that will become more meaningful with #12700

`typing_extensions` has a `>=3.13` re-export for the `typing.NoDefault`
singleton, but not for `typing._NoDefaultType`. This causes problems as
soon as we understand `sys.version_info` branches, so we explicity
switch to `typing._NoDefaultType` for Python 3.13 and later.
@sharkdp sharkdp added the ty Multi-file analysis & type inference label Dec 5, 2024
Co-authored-by: Micha Reiser <micha@reiser.io>
@sharkdp sharkdp force-pushed the david/no-default-type-fallback branch from 9257ffa to ea2820a Compare December 5, 2024 08:09
@github-actions
Copy link
Contributor

github-actions bot commented Dec 5, 2024

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

@sharkdp
Copy link
Contributor Author

sharkdp commented Dec 5, 2024

I'm merging this to decrease the diff in the statically-known branches PR. It seems relatively uncontroversial, but please let me know if something is off.

@sharkdp sharkdp merged commit 2d3f557 into main Dec 5, 2024
@sharkdp sharkdp deleted the david/no-default-type-fallback branch December 5, 2024 08:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ty Multi-file analysis & type inference

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants