Skip to content

Fix set annotations in concurrent.futures._base #6034

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

Merged
merged 2 commits into from
Sep 14, 2021

Conversation

srittau
Copy link
Collaborator

@srittau srittau commented Sep 14, 2021

Fixes #6033

@github-actions

This comment has been minimized.

1 similar comment
@github-actions
Copy link
Contributor

Diff from mypy_primer, showing the effect of this PR on open source code:

optuna (https://github.com/optuna/optuna.git)
- optuna/study/_optimize.py:103: error: Incompatible types in assignment (expression has type "AbstractSet[Future[Any]]", variable has type "Set[Future[Any]]")

def __new__(_cls, done: Set[Future[_T]], not_done: Set[Future[_T]]) -> DoneAndNotDoneFutures[_T]: ...
done: set[Future[_T]]
not_done: set[Future[_T]]
def __new__(_cls, done: set[Future[_T]], not_done: set[Future[_T]]) -> DoneAndNotDoneFutures[_T]: ...
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should done and not_done be mutable, so that users can add or remove futures from them? collections.abc.Set is immutable and would prevent that.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

They are set in the implementation and mutable.

@Akuli Akuli merged commit ca38856 into python:master Sep 14, 2021
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.

Recent change to concurrent/futures/_base.pyi broke a bunch of code
2 participants