summaryrefslogtreecommitdiff
path: root/numpy
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2018-08-14 14:16:49 -0500
committerGitHub <noreply@github.com>2018-08-14 14:16:49 -0500
commite759594d126ccfa16b871e1d484b52e36bffd001 (patch)
treee13509d35838985876b14cab51cf8e5479eae76d /numpy
parenta1b3f26cbfd5d43ad70a4b75f46b417d71a55f93 (diff)
parent062123b11ccdde2e8ad1400f5fac4a563a033d8f (diff)
downloadnumpy-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.c2
-rw-r--r--numpy/core/tests/test_deprecations.py5
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,))