Skip to content

Commit

Permalink
Fix TypeError: 'NoneType' object is not iterable
Browse files Browse the repository at this point in the history
  • Loading branch information
eric-wieser committed Nov 17, 2016
1 parent e009f55 commit 2cccee1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
6 changes: 5 additions & 1 deletion pint/quantity.py
Original file line number Diff line number Diff line change
Expand Up @@ -1223,7 +1223,7 @@ def tolist(self):
__array_priority__ = 17

def __array_prepare__(self, obj, context=None):
# If this uf is handled by Pint, write it down in the handling dictionary.
# If we have no context, assume this is unhandled
if context is None:
return obj

Expand All @@ -1246,6 +1246,10 @@ def __array_prepare__(self, obj, context=None):
return obj

def __array_wrap__(self, obj, context=None):
# If we have no context, assume this is unhandled
if context is None:
return self.magnitude.__array_wrap__(obj, context)

uf, objs, huh = context

# if this ufunc is not handled by Pint, pass it to the magnitude.
Expand Down
1 change: 0 additions & 1 deletion pint/testsuite/test_numpy.py
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,6 @@ def test_maximum(self):
# TODO
# self.assertEqual(x.units, ureg.m * ureg.s)

@unittest.expectedFailure
def test_linalg_solve(self):
ureg = self.ureg
A = np.eye(2) * ureg.s
Expand Down

0 comments on commit 2cccee1

Please sign in to comment.