summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Berg <sebastian@sipsolutions.net>2019-08-23 09:21:57 -0500
committerGitHub <noreply@github.com>2019-08-23 09:21:57 -0500
commitdc7af64a3655096b9628175448f8e1c7444bae5a (patch)
treecee4c37e5fe4da654dc2aa820317c59ef7c42258
parent4246ce2a391314acc1da90d56ff4f995d45e18a9 (diff)
parentbc74b3185f131661d602d4c95433b05b050ca4f0 (diff)
downloadnumpy-dc7af64a3655096b9628175448f8e1c7444bae5a.tar.gz
Merge pull request #14341 from mattip/revert-13913
BUG: revert detecting and raising error on ragged arrays
-rw-r--r--numpy/core/src/multiarray/ctors.c7
-rw-r--r--numpy/core/tests/test_multiarray.py5
2 files changed, 1 insertions, 11 deletions
diff --git a/numpy/core/src/multiarray/ctors.c b/numpy/core/src/multiarray/ctors.c
index bc327bf0d..f0a15505d 100644
--- a/numpy/core/src/multiarray/ctors.c
+++ b/numpy/core/src/multiarray/ctors.c
@@ -1849,13 +1849,6 @@ PyArray_GetArrayParamsFromObject(PyObject *op,
*out_arr = NULL;
return 0;
}
- if (is_object && (requested_dtype != NULL) &&
- (requested_dtype->type_num != NPY_OBJECT)) {
- PyErr_SetString(PyExc_ValueError,
- "cannot create an array from unequal-length (ragged) sequences");
- Py_DECREF(*out_dtype);
- return -1;
- }
/* If object arrays are forced */
if (is_object) {
Py_DECREF(*out_dtype);
diff --git a/numpy/core/tests/test_multiarray.py b/numpy/core/tests/test_multiarray.py
index 6a115f41b..2593045ed 100644
--- a/numpy/core/tests/test_multiarray.py
+++ b/numpy/core/tests/test_multiarray.py
@@ -44,7 +44,7 @@ from numpy.testing import (
assert_, assert_raises, assert_warns, assert_equal, assert_almost_equal,
assert_array_equal, assert_raises_regex, assert_array_almost_equal,
assert_allclose, IS_PYPY, HAS_REFCOUNT, assert_array_less, runstring,
- temppath, suppress_warnings, break_cycles, assert_raises_regex,
+ temppath, suppress_warnings, break_cycles,
)
from numpy.core.tests._locales import CommaDecimalPointLocale
@@ -497,9 +497,6 @@ class TestArrayConstruction(object):
assert_(np.ascontiguousarray(d).flags.c_contiguous)
assert_(np.asfortranarray(d).flags.f_contiguous)
- def test_ragged(self):
- assert_raises_regex(ValueError, 'ragged',
- np.array, [[1], [2, 3]], dtype=int)
class TestAssignment(object):
def test_assignment_broadcasting(self):