Skip to content

TYP: Backport multiple static typing fixes 1. - #31889

Merged
charris merged 11 commits into
numpy:maintenance/2.5.xfrom
charris:backport-typing-fixes-1
Jul 6, 2026
Merged

TYP: Backport multiple static typing fixes 1.#31889
charris merged 11 commits into
numpy:maintenance/2.5.xfrom
charris:backport-typing-fixes-1

Conversation

@charris

@charris charris commented Jul 6, 2026

Copy link
Copy Markdown
Member

Backports of:

TYP: fix tri{l,u} shape-typing for 1d input (#31886)
TYP: fix int promotion for linalg.trace (#31885)
TYP: fix datetime64 unit conversion (#31883)
TYP: fix swapped linalg.slogdet dtypes of sign/logabsdet (#31882)
TYP: fix random.RandomState.get_state conflicting overloads (#31881)
TYP: fix std/var output type for complex input (#31880)
TYP: fix str_.__getitem__ and bytes_.__getitem__ (#31879)
TYP: fix Pyright error for piecewise with all-scalar funclist (#31878)
TYP: fix random.Generator.choice output type for int sequences (#31877)
TYP: fix int promotion for *sum and *prod (#31876)
TYP: fix unit-dependent timedelta64/datetime64 overloads (#31874)

@charris charris added this to the 2.5.2 release milestone Jul 6, 2026
@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown

Diff from mypy_primer, showing the effect of this PR on type check results on a corpus of open source code:

jax (https://github.com/google/jax)
- jax/_src/numpy/hijax.py:269: error: Incompatible types in assignment (expression has type "tuple[Any, ...]", variable has type "ndarray[tuple[Any, ...], dtype[float64]]")  [assignment]
+ jax/_src/numpy/hijax.py:269: error: Incompatible types in assignment (expression has type "tuple[Any, ...]", variable has type "ndarray[tuple[Any, ...], dtype[signedinteger[Any]]]")  [assignment]

pandas-stubs (https://github.com/pandas-dev/pandas-stubs)
- tests/scalars/test_scalars.py:570: error: Unused "type: ignore" comment  [unused-ignore]
- tests/scalars/test_scalars.py:618: error: Unused "type: ignore" comment  [unused-ignore]

@charris
charris merged commit 7bcebec into numpy:maintenance/2.5.x Jul 6, 2026
12 checks passed
@charris
charris deleted the backport-typing-fixes-1 branch July 6, 2026 23:58
@charris charris changed the title TYP: Backport multiple static typing fixes. TYP: Backport multiple static typing fixes 1. Jul 8, 2026
@charris charris added the 08 - Backport Used to tag backport PRs label Jul 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

08 - Backport Used to tag backport PRs 41 - Static typing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants