Thanks to visit codestin.com
Credit goes to github.com

Skip to content

MAINT: make the import-time check for old Accelerate more specific #25452

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

Merged
merged 1 commit into from
Dec 22, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 15 additions & 10 deletions numpy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -388,20 +388,25 @@ def _mac_os_check():
pass

if sys.platform == "darwin":
from . import exceptions
with warnings.catch_warnings(record=True) as w:
_mac_os_check()
# Throw runtime error, if the test failed Check for warning and error_message
error_message = ""
if len(w) > 0:
error_message = "{}: {}".format(w[-1].category.__name__, str(w[-1].message))
msg = (
"Polyfit sanity test emitted a warning, most likely due "
"to using a buggy Accelerate backend."
"\nIf you compiled yourself, more information is available at:"
"\nhttps://numpy.org/doc/stable/user/building.html#accelerated-blas-lapack-libraries"
"\nOtherwise report this to the vendor "
"that provided NumPy.\n{}\n".format(error_message))
raise RuntimeError(msg)
for _wn in w:
if _wn.category is exceptions.RankWarning:
# Ignore other warnings, they may not be relevant (see gh-25433).
error_message = f"{_wn.category.__name__}: {str(_wn.message)}"
msg = (
"Polyfit sanity test emitted a warning, most likely due "
"to using a buggy Accelerate backend."
"\nIf you compiled yourself, more information is available at:"
"\nhttps://numpy.org/devdocs/building/index.html"
"\nOtherwise report this to the vendor "
"that provided NumPy.\n\n{}\n".format(error_message))
raise RuntimeError(msg)
del _wn
del w
del _mac_os_check

# We usually use madvise hugepages support, but on some old kernels it
Expand Down