Skip to content

TYP: Fix return type of histogram2d#30526

Merged
jorenham merged 1 commit intonumpy:mainfrom
BillTompkins:histogram2d_return_type_fix
Dec 27, 2025
Merged

TYP: Fix return type of histogram2d#30526
jorenham merged 1 commit intonumpy:mainfrom
BillTompkins:histogram2d_return_type_fix

Conversation

@BillTompkins
Copy link
Copy Markdown
Contributor

Closes #30525

Testing

  • spin mypy passes with the updated tests
  • spin test -v passes
  • python tools/linter.py passes

Running the test in #30525 now results in the proper type information for the first histogram2d return value and the .tolist() of that np.array:

tests/minimal_numpy.py:10:17 - information: Type of "a" is "ndarray[tuple[Literal[2], Literal[2]], dtype[float64]]"
tests/minimal_numpy.py:11:17 - information: Type of "a[0]" is "Any"
tests/minimal_numpy.py:19:17 - information: Type of "al" is "list[list[float]]"
tests/minimal_numpy.py:20:17 - information: Type of "al[0]" is "list[float]"

Copy link
Copy Markdown
Member

@jorenham jorenham left a comment

Choose a reason for hiding this comment

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

Thanks; this looks correct.

@jorenham jorenham merged commit 4b3b270 into numpy:main Dec 27, 2025
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TYP: Incorrect type hint from histogram2d

2 participants