8000 [Cython] Fix deprecation warning in NumPy 1.20 · Cantera/cantera@185aa97 · GitHub
[go: up one dir, main page]

Skip to content

Commit 185aa97

Browse files
bryanwweberspeth
authored andcommitted
[Cython] Fix deprecation warning in NumPy 1.20
NumPy 1.20 deprecates numpy namespace aliases to built-in types, such as int, float, and object. Explicit specification of the precision with float64 is still supported and does not need to be changed. See: https://github.com/numpy/numpy/releases/tag/v1.20.0 and numpy/numpy#14882
1 parent dceb911 commit 185aa97

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

interfaces/cython/cantera/composite.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -540,10 +540,10 @@ def __init__(self, phase, shape=(0,), states=None, extra=None, meta=None):
540540
elif (self._shape[0] == 1
541541
or np.array(v).shape[:len(self._shape)] == self._shape):
542542
arr = np.array(v)
543-
if arr.dtype == np.object:
543+
if arr.dtype == object:
544544
raise ValueError(
545545
"Unable to create extra column '{}': data type "
546-
"'np.object' is not supported.".format(name))
546+
"'object' is not supported.".format(name))
547547
if self._shape[0] == 1 and len(arr) > 1:
548548
arr = arr[np.newaxis, :]
549549
self._extra[name] = arr

interfaces/cython/cantera/test/test_thermo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1787,7 +1787,7 @@ def test_extra_not_string(self):
17871787

17881788
def test_extra_no_objects(self):
17891789
with self.assertRaisesRegex(ValueError, "not supported"):
1790-
prop = np.array([0, [1, 2], (3, 4)], dtype=np.object)
1790+
prop = np.array([0, [1, 2], (3, 4)], dtype=object)
17911791
states = ct.SolutionArray(self.gas, 3, extra={"prop": prop})
17921792

17931793
def test_extra_reserved_names(self):

0 commit comments

Comments
 (0)
0