We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f048c07 commit 54fa129Copy full SHA for 54fa129
mkl_random/_patch_numpy.py
@@ -25,6 +25,7 @@
25
26
"""Define functions for patching NumPy with MKL-based NumPy interface."""
27
28
+import warnings
29
from contextlib import ContextDecorator
30
from threading import Lock, local
31
@@ -85,11 +86,12 @@ def do_restore(self, verbose=False):
85
86
with self._lock:
87
local_count = getattr(self._tls, "local_count", 0)
88
if local_count <= 0:
- if verbose:
89
- print(
90
- "Warning: restore_numpy_random called more times than "
91
- "patch_numpy_random in this thread."
92
- )
+ warnings.warn(
+ "restore_numpy_random called more times than "
+ "patch_numpy_random in this thread.",
+ RuntimeWarning,
93
+ stacklevel=2,
94
+ )
95
return
96
self._tls.local_count -= 1
97
self._patch_count -= 1
0 commit comments