Skip to content

fix[cartesian]: In the debug backend: Itemize lower dimensional fields also on the LHS for numpy >= 2.0#2543

Merged
FlorianDeconinck merged 1 commit intoGridTools:mainfrom
twicki:fix_numpy_deprecation
Mar 18, 2026
Merged

fix[cartesian]: In the debug backend: Itemize lower dimensional fields also on the LHS for numpy >= 2.0#2543
FlorianDeconinck merged 1 commit intoGridTools:mainfrom
twicki:fix_numpy_deprecation

Conversation

@twicki
Copy link
Copy Markdown
Contributor

@twicki twicki commented Mar 18, 2026

Description

With the planned move to numpy >= 2.0 there is one corner case that still leads to exceptions in the debug-backend:
If we convert lower dimensional fields to scalars on the left hand side of assignments in index computation, we get:

TypeError: only 0-dimensional arrays can be converted to Python scalars

This can be fixed by changing the itemization to still happen on the LHS but not for the assigned field.

Requirements

  • All fixes and/or new features come with corresponding tests.
    • The test_upcasting_both_sides_of_assignment had the deprecation-warning in it.

@twicki twicki requested a review from romanc March 18, 2026 16:32
Copy link
Copy Markdown
Contributor

@romanc romanc left a comment

Choose a reason for hiding this comment

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

Looks great. Thanks for the fix!

@FlorianDeconinck FlorianDeconinck merged commit cbdbdb6 into GridTools:main Mar 18, 2026
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants