{"action":"created","issue":{"url":"https://api.github.com/repos/numpy/numpy/issues/11636","repository_url":"https://api.github.com/repos/numpy/numpy","labels_url":"https://api.github.com/repos/numpy/numpy/issues/11636/labels{/name}","comments_url":"https://api.github.com/repos/numpy/numpy/issues/11636/comments","events_url":"https://api.github.com/repos/numpy/numpy/issues/11636/events","html_url":"https://github.com/numpy/numpy/issues/11636","id":345613049,"node_id":"MDU6SXNzdWUzNDU2MTMwNDk=","number":11636,"title":"Array shape is lost during as_ctypes/as_array round trip in 1.15","user":{"login":"Strilanc","id":79941,"node_id":"MDQ6VXNlcjc5OTQx","avatar_url":"https://avatars1.githubusercontent.com/u/79941?v=4","gravatar_id":"","url":"https://api.github.com/users/Strilanc","html_url":"https://github.com/Strilanc","followers_url":"https://api.github.com/users/Strilanc/followers","following_url":"https://api.github.com/users/Strilanc/following{/other_user}","gists_url":"https://api.github.com/users/Strilanc/gists{/gist_id}","starred_url":"https://api.github.com/users/Strilanc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Strilanc/subscriptions","organizations_url":"https://api.github.com/users/Strilanc/orgs","repos_url":"https://api.github.com/users/Strilanc/repos","events_url":"https://api.github.com/users/Strilanc/events{/privacy}","received_events_url":"https://api.github.com/users/Strilanc/received_events","type":"User","site_admin":false},"labels":[{"id":6394859,"node_id":"MDU6TGFiZWw2Mzk0ODU5","url":"https://api.github.com/repos/numpy/numpy/labels/05%20-%20Regression","name":"05 - Regression","color":"fef2c0","default":false}],"state":"open","locked":false,"assignee":{"login":"eric-wieser","id":425260,"node_id":"MDQ6VXNlcjQyNTI2MA==","avatar_url":"https://avatars3.githubusercontent.com/u/425260?v=4","gravatar_id":"","url":"https://api.github.com/users/eric-wieser","html_url":"https://github.com/eric-wieser","followers_url":"https://api.github.com/users/eric-wieser/followers","following_url":"https://api.github.com/users/eric-wieser/following{/other_user}","gists_url":"https://api.github.com/users/eric-wieser/gists{/gist_id}","starred_url":"https://api.github.com/users/eric-wieser/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eric-wieser/subscriptions","organizations_url":"https://api.github.com/users/eric-wieser/orgs","repos_url":"https://api.github.com/users/eric-wieser/repos","events_url":"https://api.github.com/users/eric-wieser/events{/privacy}","received_events_url":"https://api.github.com/users/eric-wieser/received_events","type":"User","site_admin":false},"assignees":[{"login":"eric-wieser","id":425260,"node_id":"MDQ6VXNlcjQyNTI2MA==","avatar_url":"https://avatars3.githubusercontent.com/u/425260?v=4","gravatar_id":"","url":"https://api.github.com/users/eric-wieser","html_url":"https://github.com/eric-wieser","followers_url":"https://api.github.com/users/eric-wieser/followers","following_url":"https://api.github.com/users/eric-wieser/following{/other_user}","gists_url":"https://api.github.com/users/eric-wieser/gists{/gist_id}","starred_url":"https://api.github.com/users/eric-wieser/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eric-wieser/subscriptions","organizations_url":"https://api.github.com/users/eric-wieser/orgs","repos_url":"https://api.github.com/users/eric-wieser/repos","events_url":"https://api.github.com/users/eric-wieser/events{/privacy}","received_events_url":"https://api.github.com/users/eric-wieser/received_events","type":"User","site_admin":false}],"milestone":null,"comments":1,"created_at":"2018-07-30T05:09:33Z","updated_at":"2018-07-30T05:34:51Z","closed_at":null,"author_association":"NONE","body":"It appears that, when a 2 dimensional array's first index has a length of 1, round-tripping the array through `np.ctypeslib.as_ctypes` and `np.ctypeslib.as_array` loses the shape of the array.\r\n\r\nHere is a short repro:\r\n\r\n```python\r\nimport numpy as np\r\narr = np.array([[1, 2]])\r\nc_arr = np.ctypeslib.as_ctypes(arr)\r\nback = np.ctypeslib.as_array(c_arr)\r\nnp.testing.assert_equal(arr, back)\r\n\r\n# In numpy 1.15:\r\n# E       AssertionError: \r\n# E       Arrays are not equal\r\n# E       \r\n# E       (shapes (1, 2), (2,) mismatch)\r\n# E        x: array([[1, 2]])\r\n# E        y: array([1, 2])\r\n```\r\n\r\nNote that this did not occur in numpy v1.14. Another example of an array that doesn't round trip correctly is `[[1], [2]]`. However, `[[1, 2], [3, 4]]` does round trip correctly.\r\n\r\nNote that a possibly-relevant warning which I do not understand occurs when executing the repro code:\r\n\r\n```\r\nRuntimeWarning: Item size computed from the PEP 3118 buffer format string does not match the actual item size.\r\n```"},"comment":{"url":"https://api.github.com/repos/numpy/numpy/issues/comments/408751846","html_url":"https://github.com/numpy/numpy/issues/11636#issuecomment-408751846","issue_url":"https://api.github.com/repos/numpy/numpy/issues/11636","id":408751846,"node_id":"MDEyOklzc3VlQ29tbWVudDQwODc1MTg0Ng==","user":{"login":"eric-wieser","id":425260,"node_id":"MDQ6VXNlcjQyNTI2MA==","avatar_url":"https://avatars3.githubusercontent.com/u/425260?v=4","gravatar_id":"","url":"https://api.github.com/users/eric-wieser","html_url":"https://github.com/eric-wieser","followers_url":"https://api.github.com/users/eric-wieser/followers","following_url":"https://api.github.com/users/eric-wieser/following{/other_user}","gists_url":"https://api.github.com/users/eric-wieser/gists{/gist_id}","starred_url":"https://api.github.com/users/eric-wieser/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eric-wieser/subscriptions","organizations_url":"https://api.github.com/users/eric-wieser/orgs","repos_url":"https://api.github.com/users/eric-wieser/repos","events_url":"https://api.github.com/users/eric-wieser/events{/privacy}","received_events_url":"https://api.github.com/users/eric-wieser/received_events","type":"User","site_admin":false},"created_at":"2018-07-30T05:34:51Z","updated_at":"2018-07-30T05:34:51Z","author_association":"MEMBER","body":"I can't reproduce this - what is `sys.version_info` on your platform?\r\n\r\nCan you show the result of `print(repr(c_arr))` and of `memoryview(c_arr).format`?"}}
{"actor":{"display_login":"eric-wieser"}}