diff options
author | Charles Harris <charlesr.harris@gmail.com> | 2018-08-14 14:16:49 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-14 14:16:49 -0500 |
commit | e759594d126ccfa16b871e1d484b52e36bffd001 (patch) | |
tree | e13509d35838985876b14cab51cf8e5479eae76d /numpy | |
parent | a1b3f26cbfd5d43ad70a4b75f46b417d71a55f93 (diff) | |
parent | 062123b11ccdde2e8ad1400f5fac4a563a033d8f (diff) | |
download | numpy-e759594d126ccfa16b871e1d484b52e36bffd001.tar.gz |
Merge pull request #11740 from mattip/deprecate-fromstring-binary
BUG: deprecation triggers segfault
Diffstat (limited to 'numpy')
-rw-r--r-- | numpy/core/src/multiarray/multiarraymodule.c | 2 | ||||
-rw-r--r-- | numpy/core/tests/test_deprecations.py | 5 |
2 files changed, 6 insertions, 1 deletions
diff --git a/numpy/core/src/multiarray/multiarraymodule.c b/numpy/core/src/multiarray/multiarraymodule.c index 6e57f1d6d..dc571dfcb 100644 --- a/numpy/core/src/multiarray/multiarraymodule.c +++ b/numpy/core/src/multiarray/multiarraymodule.c @@ -2020,7 +2020,7 @@ array_fromstring(PyObject *NPY_UNUSED(ignored), PyObject *args, PyObject *keywds if (DEPRECATE( "The binary mode of fromstring is deprecated, as it behaves " "surprisingly on unicode inputs. Use frombuffer instead") < 0) { - Py_DECREF(descr); + Py_XDECREF(descr); return NULL; } } diff --git a/numpy/core/tests/test_deprecations.py b/numpy/core/tests/test_deprecations.py index 5d66d963f..10ef16800 100644 --- a/numpy/core/tests/test_deprecations.py +++ b/numpy/core/tests/test_deprecations.py @@ -518,3 +518,8 @@ class TestPositiveOnNonNumerical(_DeprecationTestCase): # 2018-06-28, 1.16.0 def test_positive_on_non_number(self): self.assert_deprecated(operator.pos, args=(np.array('foo'),)) + +class TestFromstring(_DeprecationTestCase): + # 2017-10-19, 1.14 + def test_fromstring(self): + self.assert_deprecated(np.fromstring, args=('\x00'*80,)) |