{"action":"opened","issue":{"url":"https://api.github.com/repos/numpy/numpy/issues/6459","labels_url":"https://api.github.com/repos/numpy/numpy/issues/6459/labels{/name}","comments_url":"https://api.github.com/repos/numpy/numpy/issues/6459/comments","events_url":"https://api.github.com/repos/numpy/numpy/issues/6459/events","html_url":"https://github.com/numpy/numpy/issues/6459","id":111014922,"number":6459,"title":"error when making view of a recarray of an aligned record dtype","user":{"login":"sklam","id":1929845,"avatar_url":"https://avatars.githubusercontent.com/u/1929845?v=3","gravatar_id":"","url":"https://api.github.com/users/sklam","html_url":"https://github.com/sklam","followers_url":"https://api.github.com/users/sklam/followers","following_url":"https://api.github.com/users/sklam/following{/other_user}","gists_url":"https://api.github.com/users/sklam/gists{/gist_id}","starred_url":"https://api.github.com/users/sklam/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sklam/subscriptions","organizations_url":"https://api.github.com/users/sklam/orgs","repos_url":"https://api.github.com/users/sklam/repos","events_url":"https://api.github.com/users/sklam/events{/privacy}","received_events_url":"https://api.github.com/users/sklam/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-10-12T16:55:36Z","updated_at":"2015-10-12T16:55:36Z","closed_at":null,"body":"A `TypeError: view would access data parent array doesn't own` is raised when a view is created from a recarray and its dtype is an aligned record.  The following code demonstrate this error on py3.4 numpy1.10:\r\n\r\n```python\r\nimport numpy as np\r\n\r\nfields = [('a', np.float32), ('b', np.int8)]\r\nnonaligned_dtype = np.dtype(fields)\r\nprint(nonaligned_dtype, nonaligned_dtype.type)\r\n\r\naligned_dtype = np.dtype(fields, align=True)\r\nprint(aligned_dtype, aligned_dtype.type)\r\n\r\nnonaligned_array = np.recarray(1, dtype=nonaligned_dtype)\r\naligned_array = np.recarray(1, dtype=aligned_dtype)\r\n\r\nprint(nonaligned_array.dtype)\r\nprint(aligned_array.dtype)\r\n\r\nprint(nonaligned_array[:])  # nonaligned record works\r\nprint(aligned_array[:])  # <--- raises view would access data parent array doesn't own\r\n```\r\n\r\nThe cause of the error is likely due to the loss of the `aligned` attribute at <https://github.com/numpy/numpy/blob/b65cdbf41bdf11aa4732983555a32043f9abec13/numpy/core/records.py#L502>. The itemsize of the `aligned_dtype` is 8 while the `nonaligned_dtype` has itemsize 5.  \r\n"}}