summaryrefslogtreecommitdiff
path: root/numpy
diff options
context:
space:
mode:
authorPearu Peterson <pearu.peterson@gmail.com>2021-09-01 12:32:23 +0300
committerPearu Peterson <pearu.peterson@gmail.com>2021-09-01 12:32:23 +0300
commit26752c3ad454f72a94cc7db32ccba43a76a85a5e (patch)
tree5422eff45bd07ad5d5ec0701ba5a3a6cc3e1660c /numpy
parent7b229a277a2a1ed8e3d49d361acbc0d4918f8bf5 (diff)
downloadnumpy-26752c3ad454f72a94cc7db32ccba43a76a85a5e.tar.gz
Workaround numpy.tests.test_warnings bug of treating local warn function as warnings.warn
Diffstat (limited to 'numpy')
-rw-r--r--numpy/f2py/symbolic.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/numpy/f2py/symbolic.py b/numpy/f2py/symbolic.py
index 5a6755489..f0b1da288 100644
--- a/numpy/f2py/symbolic.py
+++ b/numpy/f2py/symbolic.py
@@ -103,7 +103,7 @@ class ExprWarning(UserWarning):
pass
-def warn(message):
+def ewarn(message):
warnings.warn(message, ExprWarning, stacklevel=2)
@@ -489,7 +489,7 @@ class Expr:
if not isinstance(index, tuple):
index = index,
if len(index) > 1:
- warn(f'C-index should be a single expression but got `{index}`')
+ ewarn(f'C-index should be a single expression but got `{index}`')
return Expr(Op.INDEXING, (self,) + index)
def substitute(self, symbols_map):
@@ -525,8 +525,8 @@ class Expr:
else:
r += term.substitute(symbols_map) * coeff
if r is None:
- warn('substitute: empty TERMS expression interpreted as'
- ' int-literal 0')
+ ewarn('substitute: empty TERMS expression interpreted as'
+ ' int-literal 0')
return as_number(0)
return r
if self.op is Op.FACTORS:
@@ -537,8 +537,8 @@ class Expr:
else:
r *= base.substitute(symbols_map) ** exponent
if r is None:
- warn('substitute: empty FACTORS expression interpreted'
- ' as int-literal 1')
+ ewarn('substitute: empty FACTORS expression interpreted'
+ ' as int-literal 1')
return as_number(1)
return r
if self.op is Op.APPLY:
@@ -1260,5 +1260,5 @@ def _fromstring_worker(s, dummy=None):
# f2py special dummy name
return as_symbol(r)
- warn(f'fromstring: treating {r!r} as symbol')
+ ewarn(f'fromstring: treating {r!r} as symbol')
return as_symbol(r)