Skip to content

Replace np.float with float in util.py (removed in NumPy 1.24) - #7

Closed
Azimml wants to merge 1 commit into
choyingw:masterfrom
Azimml:fix/numpy2-removed-aliases
Closed

Replace np.float with float in util.py (removed in NumPy 1.24)#7
Azimml wants to merge 1 commit into
choyingw:masterfrom
Azimml:fix/numpy2-removed-aliases

Conversation

@Azimml

@Azimml Azimml commented Aug 23, 2026

Copy link
Copy Markdown

Thanks for putting this code out — I've been reading through it.

On a current environment (Python 3.12, NumPy 2.x) it uses a few names that NumPy and the stdlib have since removed. These raise rather than warn, so execution stops at the first one reached.

What breaks

Location Symbol Removed in
util/util.py:88 np.float NumPy 1.24
util/util.py:89 np.float NumPy 1.24
util/util.py:90 np.float NumPy 1.24

How I checked

I executed each of these expressions directly against NumPy 2.x to confirm it genuinely raises rather than assuming from the name, and confirmed the replacement returns the same value.

Every file this touches still compiles (py_compile).

What this PR changes

Old New Why it's equivalent
np.float float np.float was the builtin float

These are exact substitutions — no behavioural or numerical change. Only the lines listed above are touched.

Happy to rework this if you'd rather pin NumPy below 2, or if you'd prefer it split differently.

  np.float                 -> float            (removed in NumPy 1.24)

These raise rather than warn, so they stop execution on a
current environment. The replacements are exact equivalents -
no behavioural or numerical change.

Touches 1 file(s); all still compile.
@Azimml Azimml changed the title Fix NumPy 2.x / Python 3.12 incompatibilities Replace np.float with float in util.py (removed in NumPy 1.24) Aug 23, 2026
@Azimml Azimml closed this by deleting the head repository Aug 24, 2026
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.

1 participant