BUG: Fix shadowed reference of dtype in type stubs#20224
Merged
BvB93 merged 2 commits intonumpy:mainfrom Nov 2, 2021
Azureblade3808:use-alias-for-dtype-in-type-stubs
Merged
BUG: Fix shadowed reference of dtype in type stubs#20224BvB93 merged 2 commits intonumpy:mainfrom Azureblade3808:use-alias-for-dtype-in-type-stubs
dtype in type stubs#20224BvB93 merged 2 commits intonumpy:mainfrom
Azureblade3808:use-alias-for-dtype-in-type-stubs
Conversation
Direct use of `dtype` in `ndarray` or `generic` would be shadowed by `ndarray.dtype` or `generic.dtype`, so an alias is used here. See #20223.
BvB93
reviewed
Oct 29, 2021
Member
BvB93
left a comment
There was a problem hiding this comment.
There is a similar naming conflict involving dtype.str that I would suggest addressing as well.
Lines 923 to 926 in d5f6618
Besides that, the dtype changes look good to me; I know mypy can deal with the name shadowing as long as the offending attribute is at the bottom of the class, but this does not seem to be universal among type checkers.
BvB93
approved these changes
Nov 1, 2021
Member
|
Thanks @Azureblade3808. |
dtype in type stubsdtype in type stubs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Direct use of
dtypeinndarrayorgenericwould be shadowed byndarray.dtypeorgeneric.dtype, so an alias is used here.See #20223.