-
Notifications
You must be signed in to change notification settings - Fork 259
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
Filter upstream warning raised by np.finfo(np.longdouble)
on WSL1
#1310
Filter upstream warning raised by np.finfo(np.longdouble)
on WSL1
#1310
Conversation
This commit filters the following warning: > UserWarning: Signature b'\x00\xd0\xcc\xcc\xcc\xcc\xcc\xcc\xfb\xbf\x00\x00\x00\x00\x00\x00' for > <class 'numpy.longdouble'> does not match any known type: falling back to type probe function. > This warnings [sic] indicates broken support for the dtype! > machar = _get_machar(dtype) To ensure that this warning is only filtered on WSL1, we try to detect WSL by checking for a WSL-specific string from the uname, which appears to be endorsed by WSL devs. (microsoft/WSL#4555 (comment)) I also tried checking the `WSL_INTEROP` and `WSL_DISTRO_NAME` environment variables as suggested in the above linked issues, but I preferred reusing the `platform` module that was already imported inside `casting.py`. There is perhaps a more thorough approach where we collect all raised warnings, test the collected warnings, etc. but I didn't want to overcomplicate things.
Thanks for this! Yeah, I think detecting the platform is overkill and would suggest just ignoring unconditionally. |
LGTM. Please feel free to add your name, affiliation and ORCID to https://github.com/nipy/nibabel/blob/master/.zenodo.json in order to be credited as an author on future releases. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #1310 +/- ##
=======================================
Coverage 92.27% 92.27%
=======================================
Files 99 99
Lines 12460 12462 +2
Branches 2561 2562 +1
=======================================
+ Hits 11497 11499 +2
Misses 641 641
Partials 322 322 ☔ View full report in Codecov by Sentry. |
My apologies for not understanding, but should I edit this file in the context of this PR? Or, separately? (Looking at the history of this file, many of the edits appear to be authored by yourself, hence my confusion.) {
"affiliation": "Polytechnique Montréal, Montréal, CA",
"name": "Newton, Joshua",
"orcid": "0009-0005-6963-3812"
}, |
I'm listed as the author because we have a script to reorder them (and I do also add them sometimes). Please go ahead and add it yourself in this PR. |
Description
This PR filters an upstream warning regarding broken support for
np.longdouble
, raised bynp.finfo(np.longdouble)
whennumpy>=1.25
is used on WSL1.NB: The context in which
type_info
is called onnp.longdouble
is here:nibabel/nibabel/casting.py
Lines 664 to 670 in 0e925ab
nibabel/nibabel/casting.py
Line 685 in 0e925ab
Given that
nibabel
already tries to avoidnp.longdouble
on Windows, I think it should be fine to filter this warning?Notes:
I've tried to detect WSL1 to avoid filtering warnings for any other platforms -- I wanted this to be as minimal a change as is necessary. But, maybe checkingEDIT: Removed.uname
is a bit overkill. 😅Related issues/PRs
Fixes #1309.