Merge pull request #3761 from nicoddemus/numpy-recursion-error
Fix recursion in pytest.approx() with arrays in numpy<1.13
This commit is contained in:
commit
5db2e6c7a1
|
@ -0,0 +1 @@
|
|||
Fix infinite recursion in ``pytest.approx`` with arrays in ``numpy<1.13``.
|
|
@ -257,7 +257,9 @@ class ApproxScalar(ApproxBase):
|
|||
the pre-specified tolerance.
|
||||
"""
|
||||
if _is_numpy_array(actual):
|
||||
return all(a == self for a in actual.flat)
|
||||
# Call ``__eq__()`` manually to prevent infinite-recursion with
|
||||
# numpy<1.13. See #3748.
|
||||
return all(self.__eq__(a) for a in actual.flat)
|
||||
|
||||
# Short-circuit exact equality.
|
||||
if actual == self.expected:
|
||||
|
|
Loading…
Reference in New Issue