summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--numpy/core/src/multiarray/descriptor.c1
-rw-r--r--numpy/core/tests/test_dtype.py6
2 files changed, 7 insertions, 0 deletions
diff --git a/numpy/core/src/multiarray/descriptor.c b/numpy/core/src/multiarray/descriptor.c
index 8f6582edf..b7a8f11ef 100644
--- a/numpy/core/src/multiarray/descriptor.c
+++ b/numpy/core/src/multiarray/descriptor.c
@@ -351,6 +351,7 @@ _convert_from_tuple(PyObject *obj)
goto fail;
}
newdescr->flags = type->flags;
+ newdescr->alignment = type->alignment;
newdescr->subarray->base = type;
type = NULL;
Py_XDECREF(newdescr->fields);
diff --git a/numpy/core/tests/test_dtype.py b/numpy/core/tests/test_dtype.py
index b20dad33b..2e98b2cf8 100644
--- a/numpy/core/tests/test_dtype.py
+++ b/numpy/core/tests/test_dtype.py
@@ -331,6 +331,12 @@ class TestSubarray(TestCase):
assert_raises(ValueError, np.dtype, [('a', 'f4', -1)])
assert_raises(ValueError, np.dtype, [('a', 'f4', (-1, -1))])
+ def test_alignment(self):
+ #Check that subarrays are aligned
+ t1 = np.dtype('1i4', align=True)
+ t2 = np.dtype('2i4', align=True)
+ assert_equal(t1.alignment, t2.alignment)
+
class TestMonsterType(TestCase):
"""Test deeply nested subtypes."""