-
-
Notifications
You must be signed in to change notification settings - Fork 10.9k
BUG: MaskedArray.astype('uint8') with certain fill_value raises warning on ARM (Mac M3) inside Docker (Ubuntu 24.04/25.04) and leads inconsistent output #28403
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
Comments
Just wanna give this issue a boost as a fellow M3 user on Python 3.13, who has submitted a Back to the issue, I looked at line 502 and tried to experiment with >>> with warnings.catch_warnings():
... warnings.simplefilter('error', RuntimeWarning)
... for f in [2, 4, 8]: # There's no float8
... for u in [1, 2, 4, 8]:
... try:
... np.asarray(np.dtype(f'f{f}').type(-1), dtype=f'u{u}')
... except RuntimeWarning:
... print(f'Warned: f{f} -> u{u}')
...
array(255, dtype=uint8)
array(65535, dtype=uint16)
Warned: f2 -> u4
Warned: f2 -> u8
array(255, dtype=uint8)
array(65535, dtype=uint16)
Warned: f4 -> u4
Warned: f4 -> u8
array(255, dtype=uint8)
array(65535, dtype=uint16)
Warned: f8 -> u4
Warned: f8 -> u8 Which however seems to be a separate issue to yours, given that yours happened during downcasting to a smaller Unfortunately spelunking though both the Python and the C codebase returned no result on
So I guess (1) we just ran into some platform-dependent UB here, (2) the warning wasn't even issued from Footnotes
|
Uh oh!
There was an error while loading. Please reload this page.
Describe the issue:
I encountered a warning when converting a MaskedArray to uint8 inside a Docker container running Ubuntu 24.04 or 25.04 on an Apple M3 Mac. The same code runs fine on:
However, inside Docker (Ubuntu 24.04 or 25.04 on ARM), the following script produces a warning:
Note that i found this script on another issue that was caused by another bug and seems solved.
Expected Behavior:
The script should execute without warnings, as it does on other platforms and the output shoud be consistent.
Here is the output that i got from all other platforms.
Actual Behavior:
A warning is raised when calling astype("uint8") when running in Docker on ARM.
I also noted that
print(bar.fill_value)
prints 0 only in Docker ARMSystem information
Additional Notes:
I also took note of the .whl files:
Reproduce the code example:
Python and NumPy Versions:
3.13.2 (main, Feb 5 2025, 01:23:35) [GCC 14.2.0]
Runtime Environment:
The text was updated successfully, but these errors were encountered: