{"action":"created","comment":{"url":"https://api.github.com/repos/numpy/numpy/pulls/comments/31585325","id":31585325,"diff_hunk":"@@ -1359,18 +1382,31 @@ array_richcompare(PyArrayObject *self, PyObject *other, int cmp_op)\n                                          PyArray_DESCR(array_other),\n                                          NPY_EQUIV_CASTING);\n             if (_res == 0) {\n-                Py_DECREF(result);\n                 Py_DECREF(array_other);\n+                if (DEPRECATE_FUTUREWARNING(","path":"numpy/core/src/multiarray/arrayobject.c","position":70,"original_position":70,"commit_id":"d3e763cbef17440966009f54cbc578a83d41e0cd","original_commit_id":"d3e763cbef17440966009f54cbc578a83d41e0cd","user":{"login":"charris","id":77272,"avatar_url":"https://avatars.githubusercontent.com/u/77272?v=3","gravatar_id":"","url":"https://api.github.com/users/charris","html_url":"https://github.com/charris","followers_url":"https://api.github.com/users/charris/followers","following_url":"https://api.github.com/users/charris/following{/other_user}","gists_url":"https://api.github.com/users/charris/gists{/gist_id}","starred_url":"https://api.github.com/users/charris/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/charris/subscriptions","organizations_url":"https://api.github.com/users/charris/orgs","repos_url":"https://api.github.com/users/charris/repos","events_url":"https://api.github.com/users/charris/events{/privacy}","received_events_url":"https://api.github.com/users/charris/received_events","type":"User","site_admin":false},"body":"But that won't work here. Hmm....","created_at":"2015-06-03T00:34:57Z","updated_at":"2015-06-03T00:34:57Z","html_url":"https://github.com/numpy/numpy/pull/5864#discussion_r31585325","pull_request_url":"https://api.github.com/repos/numpy/numpy/pulls/5864","_links":{"self":{"href":"https://api.github.com/repos/numpy/numpy/pulls/comments/31585325"},"html":{"href":"https://github.com/numpy/numpy/pull/5864#discussion_r31585325"},"pull_request":{"href":"https://api.github.com/repos/numpy/numpy/pulls/5864"}}},"pull_request":{"url":"https://api.github.com/repos/numpy/numpy/pulls/5864","id":35088097,"html_url":"https://github.com/numpy/numpy/pull/5864","diff_url":"https://github.com/numpy/numpy/pull/5864.diff","patch_url":"https://github.com/numpy/numpy/pull/5864.patch","issue_url":"https://api.github.com/repos/numpy/numpy/issues/5864","number":5864,"state":"open","locked":false,"title":"Remove NotImplemented handling from the ufunc machinery (almost)","user":{"login":"njsmith","id":609896,"avatar_url":"https://avatars.githubusercontent.com/u/609896?v=3","gravatar_id":"","url":"https://api.github.com/users/njsmith","html_url":"https://github.com/njsmith","followers_url":"https://api.github.com/users/njsmith/followers","following_url":"https://api.github.com/users/njsmith/following{/other_user}","gists_url":"https://api.github.com/users/njsmith/gists{/gist_id}","starred_url":"https://api.github.com/users/njsmith/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/njsmith/subscriptions","organizations_url":"https://api.github.com/users/njsmith/orgs","repos_url":"https://api.github.com/users/njsmith/repos","events_url":"https://api.github.com/users/njsmith/events{/privacy}","received_events_url":"https://api.github.com/users/njsmith/received_events","type":"User","site_admin":false},"body":"We've long had consensus that returning `NotImplemented` from ufuncs was a bad and ugly hack, since it violates layering -- `NotImplemented` is the responsibility of `__op__` methods, not ufuncs. And one of the things that came out of the discussion in gh-5844 is that the `NotImplemented` handling inside the ufunc machinery was actually mostly useless and broken (see the first post on that report for analysis).\r\n\r\nOf course, it turns out it's not *quite* that simple -- there were some places, esp. in the trainwreck that is `array_richcompare`, which were depending on the current behavior.\r\n\r\nThis patch series fixes the main pieces of code that used to rely on this behavior, and then removes as much of the `NotImplemented` handling as it can. And for what isn't removed, it adds deprecation or future warnings.\r\n\r\nIn particular, there are a bunch of cases where `array_richcompare` returns bad and wrong results, like where you can compare two arrays (which should produce a boolean array), some failure occurs, and then the error gets thrown away and we end up returning a boolean scalar. Some of these were deprecated in 9b8f6c72, but this deprecates the rest. Probably the most controversial part of this is that this patch deprecates scalar ordering comparisons between unlike types, like `np.float64(1) < \"foo\"`, which are already an error on py3 but have traditionally returned some semi-arbitrary value on py2. To convince you that this is broken and we should stop supporting it, check this out:\r\n```\r\n# Note: the name of this class affects the results below\r\nIn [1]: class quux(object):\r\n   ...:     pass\r\n   ...: \r\n\r\nIn [2]: q = quux()\r\n\r\nIn [3]: np.string_(\"foo\") < q\r\nOut[3]: True\r\n\r\nIn [4]: np.asarray(np.string_(\"foo\")) < q\r\nOut[4]: False\r\n```\r\nFor a full analysis of how we handle all the legacy comparison cases, see the long comment that starts here: https://github.com/numpy/numpy/blob/19b829a660a6adc8118dc427e1a7e4ba6946ccf7/numpy/core/src/umath/ufunc_object.c#L867\r\n\r\nNB this PR is probably easier to review if you read the commits one at a time in order, instead of jumping straight to the big diff.","created_at":"2015-05-10T20:16:17Z","updated_at":"2015-06-03T00:34:57Z","closed_at":null,"merged_at":null,"merge_commit_sha":"fb4889c1407bad0fa3692dfafbc2b807e796d96a","assignee":null,"milestone":{"url":"https://api.github.com/repos/numpy/numpy/milestones/35","html_url":"https://github.com/numpy/numpy/milestones/1.10.0%20release","labels_url":"https://api.github.com/repos/numpy/numpy/milestones/35/labels","id":1055363,"number":35,"title":"1.10.0 release","description":"Marker for PRs that should go into Numpy 1.10.1.","creator":{"login":"charris","id":77272,"avatar_url":"https://avatars.githubusercontent.com/u/77272?v=3","gravatar_id":"","url":"https://api.github.com/users/charris","html_url":"https://github.com/charris","followers_url":"https://api.github.com/users/charris/followers","following_url":"https://api.github.com/users/charris/following{/other_user}","gists_url":"https://api.github.com/users/charris/gists{/gist_id}","starred_url":"https://api.github.com/users/charris/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/charris/subscriptions","organizations_url":"https://api.github.com/users/charris/orgs","repos_url":"https://api.github.com/users/charris/repos","events_url":"https://api.github.com/users/charris/events{/privacy}","received_events_url":"https://api.github.com/users/charris/received_events","type":"User","site_admin":false},"open_issues":16,"closed_issues":27,"state":"open","created_at":"2015-04-07T00:02:10Z","updated_at":"2015-05-15T13:04:43Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/numpy/numpy/pulls/5864/commits","review_comments_url":"https://api.github.com/repos/numpy/numpy/pulls/5864/comments","review_comment_url":"https://api.github.com/repos/numpy/numpy/pulls/comments{/number}","comments_url":"https://api.github.com/repos/numpy/numpy/issues/5864/comments","statuses_url":"https://api.github.com/repos/numpy/numpy/statuses/d3e763cbef17440966009f54cbc578a83d41e0cd","head":{"label":"njsmith:binop-dispatch","ref":"binop-dispatch","sha":"d3e763cbef17440966009f54cbc578a83d41e0cd","user":{"login":"njsmith","id":609896,"avatar_url":"https://avatars.githubusercontent.com/u/609896?v=3","gravatar_id":"","url":"https://api.github.com/users/njsmith","html_url":"https://github.com/njsmith","followers_url":"https://api.github.com/users/njsmith/followers","following_url":"https://api.github.com/users/njsmith/following{/other_user}","gists_url":"https://api.github.com/users/njsmith/gists{/gist_id}","starred_url":"https://api.github.com/users/njsmith/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/njsmith/subscriptions","organizations_url":"https://api.github.com/users/njsmith/orgs","repos_url":"https://api.github.com/users/njsmith/repos","events_url":"https://api.github.com/users/njsmith/events{/privacy}","received_events_url":"https://api.github.com/users/njsmith/received_events","type":"User","site_admin":false},"repo":{"id":2634288,"name":"numpy","full_name":"njsmith/numpy","owner":{"login":"njsmith","id":609896,"avatar_url":"https://avatars.githubusercontent.com/u/609896?v=3","gravatar_id":"","url":"https://api.github.com/users/njsmith","html_url":"https://github.com/njsmith","followers_url":"https://api.github.com/users/njsmith/followers","following_url":"https://api.github.com/users/njsmith/following{/other_user}","gists_url":"https://api.github.com/users/njsmith/gists{/gist_id}","starred_url":"https://api.github.com/users/njsmith/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/njsmith/subscriptions","organizations_url":"https://api.github.com/users/njsmith/orgs","repos_url":"https://api.github.com/users/njsmith/repos","events_url":"https://api.github.com/users/njsmith/events{/privacy}","received_events_url":"https://api.github.com/users/njsmith/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/njsmith/numpy","description":"Numpy main repository","fork":true,"url":"https://api.github.com/repos/njsmith/numpy","forks_url":"https://api.github.com/repos/njsmith/numpy/forks","keys_url":"https://api.github.com/repos/njsmith/numpy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/njsmith/numpy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/njsmith/numpy/teams","hooks_url":"https://api.github.com/repos/njsmith/numpy/hooks","issue_events_url":"https://api.github.com/repos/njsmith/numpy/issues/events{/number}","events_url":"https://api.github.com/repos/njsmith/numpy/events","assignees_url":"https://api.github.com/repos/njsmith/numpy/assignees{/user}","branches_url":"https://api.github.com/repos/njsmith/numpy/branches{/branch}","tags_url":"https://api.github.com/repos/njsmith/numpy/tags","blobs_url":"https://api.github.com/repos/njsmith/numpy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/njsmith/numpy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/njsmith/numpy/git/refs{/sha}","trees_url":"https://api.github.com/repos/njsmith/numpy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/njsmith/numpy/statuses/{sha}","languages_url":"https://api.github.com/repos/njsmith/numpy/languages","stargazers_url":"https://api.github.com/repos/njsmith/numpy/stargazers","contributors_url":"https://api.github.com/repos/njsmith/numpy/contributors","subscribers_url":"https://api.github.com/repos/njsmith/numpy/subscribers","subscription_url":"https://api.github.com/repos/njsmith/numpy/subscription","commits_url":"https://api.github.com/repos/njsmith/numpy/commits{/sha}","git_commits_url":"https://api.github.com/repos/njsmith/numpy/git/commits{/sha}","comments_url":"https://api.github.com/repos/njsmith/numpy/comments{/number}","issue_comment_url":"https://api.github.com/repos/njsmith/numpy/issues/comments{/number}","contents_url":"https://api.github.com/repos/njsmith/numpy/contents/{+path}","compare_url":"https://api.github.com/repos/njsmith/numpy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/njsmith/numpy/merges","archive_url":"https://api.github.com/repos/njsmith/numpy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/njsmith/numpy/downloads","issues_url":"https://api.github.com/repos/njsmith/numpy/issues{/number}","pulls_url":"https://api.github.com/repos/njsmith/numpy/pulls{/number}","milestones_url":"https://api.github.com/repos/njsmith/numpy/milestones{/number}","notifications_url":"https://api.github.com/repos/njsmith/numpy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/njsmith/numpy/labels{/name}","releases_url":"https://api.github.com/repos/njsmith/numpy/releases{/id}","created_at":"2011-10-24T05:10:05Z","updated_at":"2014-10-18T02:13:16Z","pushed_at":"2015-05-15T21:57:46Z","git_url":"git://github.com/njsmith/numpy.git","ssh_url":"git@github.com:njsmith/numpy.git","clone_url":"https://github.com/njsmith/numpy.git","svn_url":"https://github.com/njsmith/numpy","homepage":"http://www.numpy.org/","size":38278,"stargazers_count":2,"watchers_count":2,"language":"C","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":2,"default_branch":"master"}},"base":{"label":"numpy:master","ref":"master","sha":"0174f2ae5d9efc7d7459c20c99e31ace20a341ed","user":{"login":"numpy","id":288276,"avatar_url":"https://avatars.githubusercontent.com/u/288276?v=3","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://avatars.githubusercontent.com/u/288276?v=3","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}","created_at":"2010-09-13T23:02:39Z","updated_at":"2015-06-02T17:14:52Z","pushed_at":"2015-06-02T22:44:02Z","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":66286,"stargazers_count":1959,"watchers_count":1959,"language":"C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1008,"mirror_url":null,"open_issues_count":884,"forks":1008,"open_issues":884,"watchers":1959,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/numpy/numpy/pulls/5864"},"html":{"href":"https://github.com/numpy/numpy/pull/5864"},"issue":{"href":"https://api.github.com/repos/numpy/numpy/issues/5864"},"comments":{"href":"https://api.github.com/repos/numpy/numpy/issues/5864/comments"},"review_comments":{"href":"https://api.github.com/repos/numpy/numpy/pulls/5864/comments"},"review_comment":{"href":"https://api.github.com/repos/numpy/numpy/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/numpy/numpy/pulls/5864/commits"},"statuses":{"href":"https://api.github.com/repos/numpy/numpy/statuses/d3e763cbef17440966009f54cbc578a83d41e0cd"}}}}