Skip to content

Commit

Permalink
[Numpy 2.x] No longer allow conversion from numpy scalar type to pyth…
Browse files Browse the repository at this point in the history
…on scalar type in consteval

This actually leads to inaccuracy during some operations, so don't try
to outsmart the developer there.
  • Loading branch information
serge-sans-paille committed Apr 24, 2024
1 parent c67e4a6 commit b2264fa
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pythran/conversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ def to_ast(value):
if any(value is t for t in (bool, int, float)):
return builtin_folding(value)
elif isinstance(value, np.generic):
return to_ast(value.item())
raise ToNotEval()
elif isinstance(value, (numbers.Number, str, bool, type(None))):
iinfo = np.iinfo(int)
if isinstance(value, int) and not (iinfo.min <= value <= iinfo.max):
Expand Down

0 comments on commit b2264fa

Please sign in to comment.