Group :: Development/Python3
RPM: python3-module-numpy
Main Changelog Spec Patches Sources Download Gear Bugs e FR Repocop
Patch: numpy-1.21.1-alt-recfunctions-use-warnings-instead-of-suppress_warnings.patch
Download
Download
diff --git a/numpy/lib/recfunctions.py b/numpy/lib/recfunctions.py
index fbfbca73d..486d3ee4f 100644
--- a/numpy/lib/recfunctions.py
+++ b/numpy/lib/recfunctions.py
@@ -8,12 +8,12 @@
import itertools
import numpy as np
import numpy.ma as ma
+import warnings
from numpy import ndarray, recarray
from numpy.ma import MaskedArray
from numpy.ma.mrecords import MaskedRecords
from numpy.core.overrides import array_function_dispatch
from numpy.lib._iotools import _is_string_like
-from numpy.testing import suppress_warnings
_check_fill_value = np.ma.core._check_fill_value
@@ -975,8 +975,8 @@ def structured_to_unstructured(arr, dtype=None, copy=False, casting='unsafe'):
'formats': dts,
'offsets': offsets,
'itemsize': arr.dtype.itemsize})
- with suppress_warnings() as sup: # until 1.16 (gh-12447)
- sup.filter(FutureWarning, "Numpy has detected")
+ with warnings.catch_warnings(): # until 1.16 (gh-12447)
+ warnings.filterwarnings("always", "Numpy has detected", FutureWarning)
arr = arr.view(flattened_fields)
# next cast to a packed format with all fields converted to new dtype