Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace deprecated typing imports with collections.abc #18336

Merged
merged 2 commits into from
Dec 30, 2024

Conversation

cdce8p
Copy link
Collaborator

@cdce8p cdce8p commented Dec 25, 2024

No description provided.

@@ -6,7 +6,8 @@
import os
import os.path
from collections import Counter
from typing import Any, Dict, Final, Iterable
from collections.abc import Iterable
from typing import Any, Dict, Final
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will replace the generic builtins like Dict, Tuple in a followup.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -1,6 +1,7 @@
from __future__ import annotations

from typing import Callable, Iterable, Sequence
from collections.abc import Iterable, Sequence
from typing import Callable
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

collections.abc.Callable is broken inside Union and Optional on 3.9.0 and 3.9.1, so it isn't safe to replace just yet. https://bugs.python.org/issue42965

We could consider bumping requires-python to >=3.9.2 or just wait until we drop 3.9 next year.

This comment has been minimized.

@cdce8p cdce8p requested a review from hauntsaninja December 29, 2024 22:09
Copy link
Contributor

According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅

@hauntsaninja hauntsaninja merged commit 7982761 into python:master Dec 30, 2024
19 checks passed
@cdce8p cdce8p deleted the 3.8-collections-imports branch December 30, 2024 08:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants