Skip to content

TYP: fix sliding_window_view axis parameter typing#31240

Merged
jorenham merged 1 commit into
numpy:mainfrom
Jah-yee:fix/sliding-window-axis-typing
Apr 14, 2026
Merged

TYP: fix sliding_window_view axis parameter typing#31240
jorenham merged 1 commit into
numpy:mainfrom
Jah-yee:fix/sliding-window-axis-typing

Conversation

@Jah-yee

@Jah-yee Jah-yee commented Apr 14, 2026

Copy link
Copy Markdown

Good day,

The axis parameter in sliding_window_view now accepts int | tuple[int, ...] instead of just SupportsIndex, matching the documentation and implementation.

This fixes the type inconsistency issue reported in #31233.

Changes:

  • Changed axis: SupportsIndex | None to axis: int | tuple[int, ...] | None in both overloads in numpy/lib/_stride_tricks_impl.pyi

Thank you for your work on this project. I hope this small fix is helpful. Please let me know if there is anything to adjust.

Warmly, RoomWithOutRoof

The axis parameter now accepts int | tuple[int, ...] instead of just
SupportsIndex, matching the documentation and implementation.

Fixes numpy#31233
@jorenham

Copy link
Copy Markdown
Member

Thanks; looks good.

Next time, try not to ignore the PR template which includes the AI disclosure :)

@jorenham jorenham added the 09 - Backport-Candidate PRs tagged should be backported label Apr 14, 2026
@jorenham jorenham merged commit 0cc9f9e into numpy:main Apr 14, 2026
15 checks passed
@Jah-yee Jah-yee deleted the fix/sliding-window-axis-typing branch April 14, 2026 13:30
@funtimefranky1530-coder

Copy link
Copy Markdown

Thanks for the help as I don't know how to use github yet

@charris charris removed the 09 - Backport-Candidate PRs tagged should be backported label Apr 25, 2026
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.

4 participants