Skip to content

Reduce use of Any in builtins - #6292

Merged
JelleZijlstra merged 18 commits into
python:masterfrom
AlexWaygood:cut-down-anys
Nov 14, 2021
Merged

JelleZijlstra merged 18 commits into
python:masterfrom
AlexWaygood:cut-down-anys

Conversation

@AlexWaygood

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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__

Comment thread stdlib/builtins.pyi Outdated
Comment thread stdlib/builtins.pyi Outdated
Comment thread stdlib/builtins.pyi
Comment thread stdlib/builtins.pyi Outdated
@github-actions

This comment has been minimized.

@srittau srittau left a comment

Copy link
Copy Markdown
Collaborator

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.

Comment thread stdlib/builtins.pyi Outdated
@github-actions

This comment has been minimized.

@AlexWaygood

Copy link
Copy Markdown
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
Copy Markdown
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.

Comment thread stdlib/builtins.pyi Outdated
@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.

@srittau srittau left a comment

Copy link
Copy Markdown
Collaborator

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.

Comment thread stdlib/builtins.pyi Outdated
Comment thread stdlib/builtins.pyi Outdated
Comment thread stdlib/builtins.pyi Outdated
@github-actions

This comment has been minimized.

@github-actions

Copy link
Copy Markdown
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