10000 MAINT, TST: NumPy stride deprecation shim by tylerjereddy · Pull Request #23199 · scipy/scipy · GitHub
[go: up one dir, main page]

Skip to content

MAINT, TST: NumPy stride deprecation shim #23199

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

Merged
merged 2 commits into from
Jun 21, 2025

Conversation

tylerjereddy
Copy link
Contributor

We shouldn't really have to backport this, since it is slated for NumPy 2.4.x series, but if it becomes annoying on the maintenance branch we could backport it since it is a test-only shim (though not running dev version tests on maintenance branches is also something we discussed in the past).

@tylerjereddy tylerjereddy added this to the 1.17.0 milestone Jun 20, 2025
@tylerjereddy tylerjereddy added scipy.signal maintenance Items related to regular maintenance tasks labels Jun 20, 2025
@@ -1295,7 +1295,7 @@ def test_odd_strides(self, xp):
# us into wrong memory if used (but it does not need to be used)
dummy = xp.arange(10, dtype=xp.float64)
a = dummy[5:6]
a.strides = 16
a = xp.lib.stride_tricks.as_strided(a)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't know if using xp here contributes that much--pretty sure the stride trick stuff can't be part of the array API standard anyway.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I should probably set the value to 16 though...

Copy link
Member

Choose a reason for hiding this comment

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

xp.asarray(np.stride_tricks.as_strided(np.asarray(a),...)))

Copy link
Member

Choose a reason for hiding this comment

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

Or make the test numpy-only via @skip_xp_baxkends(np_only=True)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it is also NumPy-only in the decorator I think, unless you're thinking of farther into the future (although some array API backends still don't propagate the strides do they?)

* This patch allows the SciPy testsuite to pass against
NumPy `main` branch, after numpy/numpy#28925 was
merged in the last day or so.
@tylerjereddy tylerjereddy force-pushed the treddy_np_stride_dep branch from 1242ade to 3e40b21 Compare June 20, 2025 20:52
Copy link
Member
@lucascolley lucascolley left a comment

Choose a reason for hiding this comment

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

thanks Tyler, LGTM now that strides=(16,) is here!

@lucascolley lucascolley removed request for ilayn and larsoner June 20, 2025 20:54
@tylerjereddy tylerjereddy added the backport-candidate This fix should be ported by a maintainer to previous SciPy versions. label Jun 20, 2025
@tylerjereddy tylerjereddy modified the milestones: 1.17.0, 1.16.0 Jun 20, 2025
@tylerjereddy
Copy link
Contributor Author

note that this patch causes a failure on the maintenance branch when backported: https://github.com/scipy/scipy/actions/runs/15788333092/job/44509424585?pr=23188

The array API stuff and its deps are pretty tricky to handle portably on both branches..

@lucascolley lucascolley merged commit 2b2dbfc into scipy:main Jun 21, 2025
37 of 38 checks passed
@lucascolley
Copy link
Member

thanks Tyler

@tylerjereddy tylerjereddy deleted the treddy_np_stride_dep branch June 21, 2025 21:12
@tylerjereddy tylerjereddy removed the backport-candidate This fix should be ported by a maintainer to previous SciPy versions. label Jun 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintenance Items related to regular maintenance tasks scipy.signal
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0