{"action":"created","comment":{"url":"https://api.github.com/repos/numpy/numpy/pulls/comments/179932494","pull_request_review_id":110271721,"id":179932494,"diff_hunk":"@@ -232,9 +232,34 @@ PyArray_DiscardWritebackIfCopy(PyArrayObject *arr)\n    dict.\n */\n \n+#ifndef PYPY_VERSION\n #define NPY_TITLE_KEY(key, value) ((PyTuple_GET_SIZE((value))==3) && \\\n                                    (PyTuple_GET_ITEM((value), 2) == (key)))\n-\n+#else\n+/* On PyPy, dictionary string keys do not always preserve object identity */\n+static NPY_INLINE int\n+NPY_TITLE_KEY_check(PyObject *key, PyObject *value)\n+{\n+    PyObject *title;\n+    if (PyTuple_GET_SIZE(value) != 3) {\n+        return 0;\n+    }\n+    title = PyTuple_GET_ITEM(value, 2);\n+    if (key == title) {\n+        return 1;\n+    }\n+    if (PyUnicode_Check(title) && PyUnicode_Check(key)) {\n+        return PyUnicode_Compare(title, key) == 0;\n+    }\n+#if PY_VERSION_HEX < 0x03000000\n+    if (PyString_Check(title) && PyString_Check(key)) {\n+        return PyObject_Compare(title, key) == 0;\n+    }\n+#endif\n+    return 0;\n+}\n+#define NPY_TITLE_KEY(key, value) (NPY_TITLE_KEY_check(key, value))","path":"numpy/core/include/numpy/ndarrayobject.h","position":31,"original_position":31,"commit_id":"adb3997a2971c32b0a8b8573a316a1e082b8986b","original_commit_id":"adb3997a2971c32b0a8b8573a316a1e082b8986b","user":{"login":"eric-wieser","id":425260,"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},"body":"Why the macro wrapping? Should both paths maybe be replaced with the inline function, which would narrow the scope of the PYPY check?","created_at":"2018-04-08T01:46:29Z","updated_at":"2018-04-08T01:46:29Z","html_url":"https://github.com/numpy/numpy/pull/10860#discussion_r179932494","pull_request_url":"https://api.github.com/repos/numpy/numpy/pulls/10860","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/numpy/numpy/pulls/comments/179932494"},"html":{"href":"https://github.com/numpy/numpy/pull/10860#discussion_r179932494"},"pull_request":{"href":"https://api.github.com/repos/numpy/numpy/pulls/10860"}}},"pull_request":{"url":"https://api.github.com/repos/numpy/numpy/pulls/10860","id":180126592,"html_url":"https://github.com/numpy/numpy/pull/10860","diff_url":"https://github.com/numpy/numpy/pull/10860.diff","patch_url":"https://github.com/numpy/numpy/pull/10860.patch","issue_url":"https://api.github.com/repos/numpy/numpy/issues/10860","number":10860,"state":"open","locked":false,"title":"BUG: core: fix NPY_TITLE_KEY macro on pypy","user":{"login":"pv","id":35046,"avatar_url":"https://avatars1.githubusercontent.com/u/35046?v=4","gravatar_id":"","url":"https://api.github.com/users/pv","html_url":"https://github.com/pv","followers_url":"https://api.github.com/users/pv/followers","following_url":"https://api.github.com/users/pv/following{/other_user}","gists_url":"https://api.github.com/users/pv/gists{/gist_id}","starred_url":"https://api.github.com/users/pv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pv/subscriptions","organizations_url":"https://api.github.com/users/pv/orgs","repos_url":"https://api.github.com/users/pv/repos","events_url":"https://api.github.com/users/pv/events{/privacy}","received_events_url":"https://api.github.com/users/pv/received_events","type":"User","site_admin":false},"body":"On Pypy, dictionary keys do not necessarily preserve object identity.\r\n\r\nThis however was assumed by the NPY_TITLE_KEY macro, which relies on\r\ndescriptor.c:568 using the same 'title' object both as a dictionary key\r\nas an entry in the tuple inserted.\r\n\r\nSince the items in the field dict are unique, value identity is however\r\nsufficient for the NPY_TITLE_KEY macro. On PyPy, fix the macro by\r\ncomparing values instead.\r\n\r\ncf. https://bitbucket.org/pypy/pypy/issues/2789\r\n\r\ncc: @mattip ","created_at":"2018-04-07T21:42:07Z","updated_at":"2018-04-08T01:46:29Z","closed_at":null,"merged_at":null,"merge_commit_sha":"846e0a2040d8a5e2338a8496f75573ea1e3075a0","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/numpy/numpy/pulls/10860/commits","review_comments_url":"https://api.github.com/repos/numpy/numpy/pulls/10860/comments","review_comment_url":"https://api.github.com/repos/numpy/numpy/pulls/comments{/number}","comments_url":"https://api.github.com/repos/numpy/numpy/issues/10860/comments","statuses_url":"https://api.github.com/repos/numpy/numpy/statuses/adb3997a2971c32b0a8b8573a316a1e082b8986b","head":{"label":"pv:pypyfix-npy-title-key","ref":"pypyfix-npy-title-key","sha":"adb3997a2971c32b0a8b8573a316a1e082b8986b","user":{"login":"pv","id":35046,"avatar_url":"https://avatars1.githubusercontent.com/u/35046?v=4","gravatar_id":"","url":"https://api.github.com/users/pv","html_url":"https://github.com/pv","followers_url":"https://api.github.com/users/pv/followers","following_url":"https://api.github.com/users/pv/following{/other_user}","gists_url":"https://api.github.com/users/pv/gists{/gist_id}","starred_url":"https://api.github.com/users/pv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pv/subscriptions","organizations_url":"https://api.github.com/users/pv/orgs","repos_url":"https://api.github.com/users/pv/repos","events_url":"https://api.github.com/users/pv/events{/privacy}","received_events_url":"https://api.github.com/users/pv/received_events","type":"User","site_admin":false},"repo":{"id":908784,"name":"numpy","full_name":"pv/numpy","owner":{"login":"pv","id":35046,"avatar_url":"https://avatars1.githubusercontent.com/u/35046?v=4","gravatar_id":"","url":"https://api.github.com/users/pv","html_url":"https://github.com/pv","followers_url":"https://api.github.com/users/pv/followers","following_url":"https://api.github.com/users/pv/following{/other_user}","gists_url":"https://api.github.com/users/pv/gists{/gist_id}","starred_url":"https://api.github.com/users/pv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pv/subscriptions","organizations_url":"https://api.github.com/users/pv/orgs","repos_url":"https://api.github.com/users/pv/repos","events_url":"https://api.github.com/users/pv/events{/privacy}","received_events_url":"https://api.github.com/users/pv/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/pv/numpy","description":"Work on Numpy","fork":true,"url":"https://api.github.com/repos/pv/numpy","forks_url":"https://api.github.com/repos/pv/numpy/forks","keys_url":"https://api.github.com/repos/pv/numpy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pv/numpy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pv/numpy/teams","hooks_url":"https://api.github.com/repos/pv/numpy/hooks","issue_events_url":"https://api.github.com/repos/pv/numpy/issues/events{/number}","events_url":"https://api.github.com/repos/pv/numpy/events","assignees_url":"https://api.github.com/repos/pv/numpy/assignees{/user}","branches_url":"https://api.github.com/repos/pv/numpy/branches{/branch}","tags_url":"https://api.github.com/repos/pv/numpy/tags","blobs_url":"https://api.github.com/repos/pv/numpy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pv/numpy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pv/numpy/git/refs{/sha}","trees_url":"https://api.github.com/repos/pv/numpy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pv/numpy/statuses/{sha}","languages_url":"https://api.github.com/repos/pv/numpy/languages","stargazers_url":"https://api.github.com/repos/pv/numpy/stargazers","contributors_url":"https://api.github.com/repos/pv/numpy/contributors","subscribers_url":"https://api.github.com/repos/pv/numpy/subscribers","subscription_url":"https://api.github.com/repos/pv/numpy/subscription","commits_url":"https://api.github.com/repos/pv/numpy/commits{/sha}","git_commits_url":"https://api.github.com/repos/pv/numpy/git/commits{/sha}","comments_url":"https://api.github.com/repos/pv/numpy/comments{/number}","issue_comment_url":"https://api.github.com/repos/pv/numpy/issues/comments{/number}","contents_url":"https://api.github.com/repos/pv/numpy/contents/{+path}","compare_url":"https://api.github.com/repos/pv/numpy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pv/numpy/merges","archive_url":"https://api.github.com/repos/pv/numpy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pv/numpy/downloads","issues_url":"https://api.github.com/repos/pv/numpy/issues{/number}","pulls_url":"https://api.github.com/repos/pv/numpy/pulls{/number}","milestones_url":"https://api.github.com/repos/pv/numpy/milestones{/number}","notifications_url":"https://api.github.com/repos/pv/numpy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pv/numpy/labels{/name}","releases_url":"https://api.github.com/repos/pv/numpy/releases{/id}","deployments_url":"https://api.github.com/repos/pv/numpy/deployments","created_at":"2010-09-14T00:51:49Z","updated_at":"2014-08-18T16:06:25Z","pushed_at":"2018-04-07T21:57:34Z","git_url":"git://github.com/pv/numpy.git","ssh_url":"git@github.com:pv/numpy.git","clone_url":"https://github.com/pv/numpy.git","svn_url":"https://github.com/pv/numpy","homepage":"","size":56267,"stargazers_count":2,"watchers_count":2,"language":"C","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":0,"open_issues":0,"watchers":2,"default_branch":"master"}},"base":{"label":"numpy:master","ref":"master","sha":"b8e8a6ee1f032474a0119fa0c0a6dfb51355abd6","user":{"login":"numpy","id":288276,"avatar_url":"https://avatars2.githubusercontent.com/u/288276?v=4","gravatar_id":"","url":"https://api.github.com/users/numpy","html_url":"https://github.com/numpy","followers_url":"https://api.github.com/users/numpy/followers","following_url":"https://api.github.com/users/numpy/following{/other_user}","gists_url":"https://api.github.com/users/numpy/gists{/gist_id}","starred_url":"https://api.github.com/users/numpy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/numpy/subscriptions","organizations_url":"https://api.github.com/users/numpy/orgs","repos_url":"https://api.github.com/users/numpy/repos","events_url":"https://api.github.com/users/numpy/events{/privacy}","received_events_url":"https://api.github.com/users/numpy/received_events","type":"Organization","site_admin":false},"repo":{"id":908607,"name":"numpy","full_name":"numpy/numpy","owner":{"login":"numpy","id":288276,"avatar_url":"https://avatars2.githubusercontent.com/u/288276?v=4","gravatar_id":"","url":"https://api.github.com/users/numpy","html_url":"https://github.com/numpy","followers_url":"https://api.github.com/users/numpy/followers","following_url":"https://api.github.com/users/numpy/following{/other_user}","gists_url":"https://api.github.com/users/numpy/gists{/gist_id}","starred_url":"https://api.github.com/users/numpy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/numpy/subscriptions","organizations_url":"https://api.github.com/users/numpy/orgs","repos_url":"https://api.github.com/users/numpy/repos","events_url":"https://api.github.com/users/numpy/events{/privacy}","received_events_url":"https://api.github.com/users/numpy/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/numpy/numpy","description":"Numpy main repository","fork":false,"url":"https://api.github.com/repos/numpy/numpy","forks_url":"https://api.github.com/repos/numpy/numpy/forks","keys_url":"https://api.github.com/repos/numpy/numpy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/numpy/numpy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/numpy/numpy/teams","hooks_url":"https://api.github.com/repos/numpy/numpy/hooks","issue_events_url":"https://api.github.com/repos/numpy/numpy/issues/events{/number}","events_url":"https://api.github.com/repos/numpy/numpy/events","assignees_url":"https://api.github.com/repos/numpy/numpy/assignees{/user}","branches_url":"https://api.github.com/repos/numpy/numpy/branches{/branch}","tags_url":"https://api.github.com/repos/numpy/numpy/tags","blobs_url":"https://api.github.com/repos/numpy/numpy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/numpy/numpy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/numpy/numpy/git/refs{/sha}","trees_url":"https://api.github.com/repos/numpy/numpy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/numpy/numpy/statuses/{sha}","languages_url":"https://api.github.com/repos/numpy/numpy/languages","stargazers_url":"https://api.github.com/repos/numpy/numpy/stargazers","contributors_url":"https://api.github.com/repos/numpy/numpy/contributors","subscribers_url":"https://api.github.com/repos/numpy/numpy/subscribers","subscription_url":"https://api.github.com/repos/numpy/numpy/subscription","commits_url":"https://api.github.com/repos/numpy/numpy/commits{/sha}","git_commits_url":"https://api.github.com/repos/numpy/numpy/git/commits{/sha}","comments_url":"https://api.github.com/repos/numpy/numpy/comments{/number}","issue_comment_url":"https://api.github.com/repos/numpy/numpy/issues/comments{/number}","contents_url":"https://api.github.com/repos/numpy/numpy/contents/{+path}","compare_url":"https://api.github.com/repos/numpy/numpy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/numpy/numpy/merges","archive_url":"https://api.github.com/repos/numpy/numpy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/numpy/numpy/downloads","issues_url":"https://api.github.com/repos/numpy/numpy/issues{/number}","pulls_url":"https://api.github.com/repos/numpy/numpy/pulls{/number}","milestones_url":"https://api.github.com/repos/numpy/numpy/milestones{/number}","notifications_url":"https://api.github.com/repos/numpy/numpy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/numpy/numpy/labels{/name}","releases_url":"https://api.github.com/repos/numpy/numpy/releases{/id}","deployments_url":"https://api.github.com/repos/numpy/numpy/deployments","created_at":"2010-09-13T23:02:39Z","updated_at":"2018-04-08T01:06:07Z","pushed_at":"2018-04-07T21:57:35Z","git_url":"git://github.com/numpy/numpy.git","ssh_url":"git@github.com:numpy/numpy.git","clone_url":"https://github.com/numpy/numpy.git","svn_url":"https://github.com/numpy/numpy","homepage":"http://www.numpy.org/","size":56784,"stargazers_count":6890,"watchers_count":6890,"language":"C","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2695,"mirror_url":null,"archived":false,"open_issues_count":1866,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":2695,"open_issues":1866,"watchers":6890,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/numpy/numpy/pulls/10860"},"html":{"href":"https://github.com/numpy/numpy/pull/10860"},"issue":{"href":"https://api.github.com/repos/numpy/numpy/issues/10860"},"comments":{"href":"https://api.github.com/repos/numpy/numpy/issues/10860/comments"},"review_comments":{"href":"https://api.github.com/repos/numpy/numpy/pulls/10860/comments"},"review_comment":{"href":"https://api.github.com/repos/numpy/numpy/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/numpy/numpy/pulls/10860/commits"},"statuses":{"href":"https://api.github.com/repos/numpy/numpy/statuses/adb3997a2971c32b0a8b8573a316a1e082b8986b"}},"author_association":"OWNER"}}
{"actor":{"display_login":"eric-wieser"}}