Skip to content

Conversation

@musicinmybrain
Copy link

Use .item() to extract a float before applying repr().

Fixes a regression in numpy 2.2:

 FAILED tests/test_dolfin.py::test_dolfin[mesh3] - ValueError: could not convert string to float: 'np.float64(63.69616873214543)'

See #1499.

Use `.item()` to extract a `float` before applying `repr()`.

Fixes a regression in numpy 2.2:

   FAILED tests/test_dolfin.py::test_dolfin[mesh3] - ValueError: could
   not convert string to float: 'np.float64(63.69616873214543)'
@mgorny
Copy link

mgorny commented Mar 17, 2025

@musicinmybrain, I've submitted a slightly different fix (using str()) in #1513. Not sure, but I think it's more reliable than using .item().

@musicinmybrain
Copy link
Author

Thanks! Hopefully @nschloe will investigate and choose an approach.

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.

2 participants