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

Incorrect type annotation for ndarray.real #19318

Closed
NeilGirdhar opened this issue Jun 23, 2021 · 3 comments · Fixed by #19324
Closed

Incorrect type annotation for ndarray.real #19318

NeilGirdhar opened this issue Jun 23, 2021 · 3 comments · Fixed by #19324

Comments

@NeilGirdhar
Copy link
Contributor

from typing import Any
import numpy as np
import numpy.typing as npt

decay: npt.NDArray[np.complexfloating[Any, Any]]

reveal_type(decay)  # note: Revealed type is "numpy.ndarray[Any, numpy.dtype[numpy.complexfloating[Any, Any]]]"
reveal_type(decay.real)  # note: Revealed type is "numpy.ndarray[Any, numpy.dtype[numpy.complexfloating[Any, Any]]]"

I believe it should be numpy.ndarray[Any, numpy.dtype[numpy.floating[Any, Any]]]

@BvB93
Copy link
Member

BvB93 commented Jun 24, 2021

I believe it should be numpy.ndarray[Any, numpy.dtype[numpy.floating[Any, Any]]]

Yup, you're completely right.
The issue was recently fixed in #19286; it should be quite easy to backport.

@BvB93 BvB93 added this to the 1.21.1 release milestone Jun 24, 2021
@NeilGirdhar
Copy link
Contributor Author

Awesome feel free to close this issue whenever it's convenient for you.

Also, I'm really loving the type annotations!!

@BvB93
Copy link
Member

BvB93 commented Jun 24, 2021

Closed by #19324.

@BvB93 BvB93 closed this as completed Jun 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants