{"action":"created","issue":{"url":"https://api.github.com/repos/numpy/numpy/issues/11642","repository_url":"https://api.github.com/repos/numpy/numpy","labels_url":"https://api.github.com/repos/numpy/numpy/issues/11642/labels{/name}","comments_url":"https://api.github.com/repos/numpy/numpy/issues/11642/comments","events_url":"https://api.github.com/repos/numpy/numpy/issues/11642/events","html_url":"https://github.com/numpy/numpy/pull/11642","id":345952316,"node_id":"MDExOlB1bGxSZXF1ZXN0MjA0OTQyNDgw","number":11642,"title":"Fixes for unicode field names in Python 2","user":{"login":"chrisjbillington","id":1044087,"node_id":"MDQ6VXNlcjEwNDQwODc=","avatar_url":"https://avatars0.githubusercontent.com/u/1044087?v=4","gravatar_id":"","url":"https://api.github.com/users/chrisjbillington","html_url":"https://github.com/chrisjbillington","followers_url":"https://api.github.com/users/chrisjbillington/followers","following_url":"https://api.github.com/users/chrisjbillington/following{/other_user}","gists_url":"https://api.github.com/users/chrisjbillington/gists{/gist_id}","starred_url":"https://api.github.com/users/chrisjbillington/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chrisjbillington/subscriptions","organizations_url":"https://api.github.com/users/chrisjbillington/orgs","repos_url":"https://api.github.com/users/chrisjbillington/repos","events_url":"https://api.github.com/users/chrisjbillington/events{/privacy}","received_events_url":"https://api.github.com/users/chrisjbillington/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-07-30T22:00:32Z","updated_at":"2018-07-30T22:08:15Z","closed_at":null,"author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/numpy/numpy/pulls/11642","html_url":"https://github.com/numpy/numpy/pull/11642","diff_url":"https://github.com/numpy/numpy/pull/11642.diff","patch_url":"https://github.com/numpy/numpy/pull/11642.patch"},"body":"* Allow specifying a single comma-separated unicode string of names in np.rec.fromarrays\r\n* Allow sorting on unicode field names.\r\n\r\nThis addresses some of the problems raised in issue #2407\r\n\r\n<!-- Please be sure you are following the instructions in the dev guidelines\r\nhttp://www.numpy.org/devdocs/dev/gitwash/development_workflow.html\r\n-->\r\n\r\n<!-- We'd appreciate it if your commit message is properly formatted\r\nhttp://www.numpy.org/devdocs/dev/gitwash/development_workflow.html#writing-the-commit-message\r\n-->\r\n"},"comment":{"url":"https://api.github.com/repos/numpy/numpy/issues/comments/409027989","html_url":"https://github.com/numpy/numpy/pull/11642#issuecomment-409027989","issue_url":"https://api.github.com/repos/numpy/numpy/issues/11642","id":409027989,"node_id":"MDEyOklzc3VlQ29tbWVudDQwOTAyNzk4OQ==","user":{"login":"chrisjbillington","id":1044087,"node_id":"MDQ6VXNlcjEwNDQwODc=","avatar_url":"https://avatars0.githubusercontent.com/u/1044087?v=4","gravatar_id":"","url":"https://api.github.com/users/chrisjbillington","html_url":"https://github.com/chrisjbillington","followers_url":"https://api.github.com/users/chrisjbillington/followers","following_url":"https://api.github.com/users/chrisjbillington/following{/other_user}","gists_url":"https://api.github.com/users/chrisjbillington/gists{/gist_id}","starred_url":"https://api.github.com/users/chrisjbillington/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chrisjbillington/subscriptions","organizations_url":"https://api.github.com/users/chrisjbillington/orgs","repos_url":"https://api.github.com/users/chrisjbillington/repos","events_url":"https://api.github.com/users/chrisjbillington/events{/privacy}","received_events_url":"https://api.github.com/users/chrisjbillington/received_events","type":"User","site_admin":false},"created_at":"2018-07-30T22:08:15Z","updated_at":"2018-07-30T22:08:15Z","author_association":"CONTRIBUTOR","body":"Without the changes in this pull request, the following fails in Python 2\r\n```python\r\nx = np.zeros(1, dtype=[(u'test', int)])\r\nx.sort(order=u'test')\r\n```\r\nwith\r\n```\r\nTraceback (most recent call last):\r\n  File \"91.py\", line 4, in <module>\r\n    x.sort(order=u'test')\r\n  File \"/home/bilbo/anaconda2/lib/python2.7/site-packages/numpy/core/_internal.py\", line 312, in _newnames\r\n    raise ValueError(\"unsupported order value: %s\" % (order,))\r\nValueError: unsupported order value: test\r\n```\r\n\r\nand the following\r\n\r\n```python\r\nx = np.core.records.fromarrays([[0], [0]], names=u'a,b', formats=u'i4,i4')\r\n```\r\n\r\nfails with\r\n```\r\nTraceback (most recent call last):\r\n  File \"91.py\", line 6, in <module>\r\n    x = np.core.records.fromarrays([[0], [0]], names=u'a,b', formats=u'i4,i4')\r\n  File \"/home/bilbo/anaconda2/lib/python2.7/site-packages/numpy/core/records.py\", line 610, in fromarrays\r\n    parsed = format_parser(formats, names, titles, aligned, byteorder)\r\n  File \"/home/bilbo/anaconda2/lib/python2.7/site-packages/numpy/core/records.py\", line 147, in __init__\r\n    self._setfieldnames(names, titles)\r\n  File \"/home/bilbo/anaconda2/lib/python2.7/site-packages/numpy/core/records.py\", line 180, in _setfieldnames\r\n    raise NameError(\"illegal input names %s\" % repr(names))\r\nNameError: illegal input names u'a,b'\r\n```\r\n\r\nAlthough the fix from pull request #10672 allowed for unicode field names in Python 2, the two above examples would still fail as the strings were explicitly required to be bytestrings before being passed to lower level code."}}
{"actor":{"display_login":"chrisjbillington"}}