Skip to content

Reduce use of Any in builtins #6292

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 18 commits into from
Nov 14, 2021
Merged

Conversation

AlexWaygood
Copy link
Member

An attempt to reduce the use of Any in builtins. A little experimental; this will likely be revised based on the output from mypy primer.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@AlexWaygood
Copy link
Member Author

Reverting the change to getattr's return type, as that seems to be responsible for a lot of the new errors, and I'm interested in seeing the mypy_primer diff without it.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@AlexWaygood
Copy link
Member Author

Reverting the change to getattr's return type, as that seems to be responsible for a lot of the new errors, and I'm interested in seeing the mypy_primer diff without it.

Ditto for vars()

@github-actions

This comment has been minimized.

@AlexWaygood
Copy link
Member Author

Reverting the change to getattr's return type, as that seems to be responsible for a lot of the new errors, and I'm interested in seeing the mypy_primer diff without it.

Ditto for __import__

@github-actions

This comment has been minimized.

@AlexWaygood
Copy link
Member Author

Reverting the change to getattr's return type, as that seems to be responsible for a lot of the new errors, and I'm interested in seeing the mypy_primer diff without it.

Ditto for eval

@github-actions

This comment has been minimized.

@AlexWaygood
Copy link
Member Author

Reverting the change to getattr's return type, as that seems to be responsible for a lot of the new errors, and I'm interested in seeing the mypy_primer diff without it.

Ditto for object.__getattribute__

@github-actions

This comment has been minimized.

Copy link
Collaborator

@srittau srittau left a comment

Choose a reason for hiding this comment

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

I like the general idea of this PR. I noticed one thing below and will comment in more depth, once you've whittled down the primer output and mark this as ready to review.

@github-actions

This comment has been minimized.

@AlexWaygood
Copy link
Member Author

Reverting the change to getattr's return type, as that seems to be responsible for a lot of the new errors, and I'm interested in seeing the mypy_primer diff without it.

Ditto for globals()

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@JelleZijlstra
Copy link
Member

Not sure what's going on in pytest (affected code is here: https://github.com/pytest-dev/pytest/blob/main/src/_pytest/fixtures.py#L290). Maybe mypy just reordered its module processing for some reason.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@AlexWaygood AlexWaygood requested a review from srittau November 14, 2021 15:49
Would've been weird to have eval() return Any and exec() return object.
Copy link
Collaborator

@srittau srittau left a comment

Choose a reason for hiding this comment

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

A few more remarks below. The rest LGTM.

@github-actions

This comment has been minimized.

@github-actions
Copy link
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

@AlexWaygood AlexWaygood requested a review from srittau November 14, 2021 16:44
@JelleZijlstra JelleZijlstra merged commit 88f86a0 into python:master Nov 14, 2021
AlexWaygood added a commit to AlexWaygood/typeshed that referenced this pull request Nov 14, 2021
@AlexWaygood AlexWaygood deleted the cut-down-anys branch November 15, 2021 00:16
AlexWaygood added a commit to AlexWaygood/typeshed that referenced this pull request Dec 22, 2021
Reverts regressions introduced by python#6292. Fixes python#6661.
JelleZijlstra pushed a commit that referenced this pull request Dec 22, 2021
Reverts regressions introduced by #6292. Fixes #6661.
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.

3 participants