{"action":"created","comment":{"url":"https://api.github.com/repos/django/django/pulls/comments/72904037","id":72904037,"diff_hunk":"@@ -148,6 +148,19 @@ def test_mixed_type_annotation_numbers(self):\n         combined = int(test.pages + test.rating)\n         self.assertEqual(b.combined, combined)\n \n+    def test_empty_expression_annotation(self):\n+        books = Book.objects.annotate(\n+            selected=ExpressionWrapper(Q(pk__in=[]), output_field=BooleanField())","path":"tests/annotations/tests.py","position":15,"original_position":15,"commit_id":"2a71d62f9fcd5b5f7ed96a579db8a79963a66578","original_commit_id":"06c2ed14f68dd378def3f867c5e409b850172047","user":{"login":"jarshwah","id":541083,"avatar_url":"https://avatars.githubusercontent.com/u/541083?v=3","gravatar_id":"","url":"https://api.github.com/users/jarshwah","html_url":"https://github.com/jarshwah","followers_url":"https://api.github.com/users/jarshwah/followers","following_url":"https://api.github.com/users/jarshwah/following{/other_user}","gists_url":"https://api.github.com/users/jarshwah/gists{/gist_id}","starred_url":"https://api.github.com/users/jarshwah/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jarshwah/subscriptions","organizations_url":"https://api.github.com/users/jarshwah/orgs","repos_url":"https://api.github.com/users/jarshwah/repos","events_url":"https://api.github.com/users/jarshwah/events{/privacy}","received_events_url":"https://api.github.com/users/jarshwah/received_events","type":"User","site_admin":false},"body":"Ok, let's leave the compiler changes and the test. There are enough people using this structure for us to either break it outright or support it. We can always fix any bugs that appear with `ExpressionWrapper(Q)`.\r\n\r\nFWIW the problems I considered were to do with relabelling aliases or resolve_expression running multiple times. Now Q is just a resolvable, not really an expression. Whatever it returns must be a genuine expression. It returns `WhereNode` which has everything that an expression should have *except* `resolve_expression` and `output_field`.\r\n\r\nIf there's a way to trigger resolve_expression to be run multiple times, perhaps by using a queryset as a subquery, then it might be possible to trigger an error. I'm just brain dumping right now, I don't expect this to be tested for this patch.\r\n\r\nAnyway, if we're going to all this trouble to support Q() objects as fields, then why not just add an `output_field = BooleanField()` to the WhereNode and bypass ExpressionWrapper altogether?\r\n\r\n","created_at":"2016-07-31T13:18:09Z","updated_at":"2016-07-31T13:18:09Z","html_url":"https://github.com/django/django/pull/6638#discussion_r72904037","pull_request_url":"https://api.github.com/repos/django/django/pulls/6638","_links":{"self":{"href":"https://api.github.com/repos/django/django/pulls/comments/72904037"},"html":{"href":"https://github.com/django/django/pull/6638#discussion_r72904037"},"pull_request":{"href":"https://api.github.com/repos/django/django/pulls/6638"}}},"pull_request":{"url":"https://api.github.com/repos/django/django/pulls/6638","id":70979359,"html_url":"https://github.com/django/django/pull/6638","diff_url":"https://github.com/django/django/pull/6638.diff","patch_url":"https://github.com/django/django/pull/6638.patch","issue_url":"https://api.github.com/repos/django/django/issues/6638","number":6638,"state":"open","locked":false,"title":"Fixed #26517 -- Select 0 for impossible predicates","user":{"login":"emulbreh","id":120118,"avatar_url":"https://avatars.githubusercontent.com/u/120118?v=3","gravatar_id":"","url":"https://api.github.com/users/emulbreh","html_url":"https://github.com/emulbreh","followers_url":"https://api.github.com/users/emulbreh/followers","following_url":"https://api.github.com/users/emulbreh/following{/other_user}","gists_url":"https://api.github.com/users/emulbreh/gists{/gist_id}","starred_url":"https://api.github.com/users/emulbreh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/emulbreh/subscriptions","organizations_url":"https://api.github.com/users/emulbreh/orgs","repos_url":"https://api.github.com/users/emulbreh/repos","events_url":"https://api.github.com/users/emulbreh/events{/privacy}","received_events_url":"https://api.github.com/users/emulbreh/received_events","type":"User","site_admin":false},"body":"* https://code.djangoproject.com/ticket/26517\r\n* https://code.djangoproject.com/ticket/26433","created_at":"2016-05-22T15:07:16Z","updated_at":"2016-07-31T13:18:09Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e8f1cfe4fa59cc56cc7a2331df61a94b56b9d5cb","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/django/django/pulls/6638/commits","review_comments_url":"https://api.github.com/repos/django/django/pulls/6638/comments","review_comment_url":"https://api.github.com/repos/django/django/pulls/comments{/number}","comments_url":"https://api.github.com/repos/django/django/issues/6638/comments","statuses_url":"https://api.github.com/repos/django/django/statuses/2a71d62f9fcd5b5f7ed96a579db8a79963a66578","head":{"label":"emulbreh:t26517","ref":"t26517","sha":"2a71d62f9fcd5b5f7ed96a579db8a79963a66578","user":{"login":"emulbreh","id":120118,"avatar_url":"https://avatars.githubusercontent.com/u/120118?v=3","gravatar_id":"","url":"https://api.github.com/users/emulbreh","html_url":"https://github.com/emulbreh","followers_url":"https://api.github.com/users/emulbreh/followers","following_url":"https://api.github.com/users/emulbreh/following{/other_user}","gists_url":"https://api.github.com/users/emulbreh/gists{/gist_id}","starred_url":"https://api.github.com/users/emulbreh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/emulbreh/subscriptions","organizations_url":"https://api.github.com/users/emulbreh/orgs","repos_url":"https://api.github.com/users/emulbreh/repos","events_url":"https://api.github.com/users/emulbreh/events{/privacy}","received_events_url":"https://api.github.com/users/emulbreh/received_events","type":"User","site_admin":false},"repo":{"id":7096248,"name":"django","full_name":"emulbreh/django","owner":{"login":"emulbreh","id":120118,"avatar_url":"https://avatars.githubusercontent.com/u/120118?v=3","gravatar_id":"","url":"https://api.github.com/users/emulbreh","html_url":"https://github.com/emulbreh","followers_url":"https://api.github.com/users/emulbreh/followers","following_url":"https://api.github.com/users/emulbreh/following{/other_user}","gists_url":"https://api.github.com/users/emulbreh/gists{/gist_id}","starred_url":"https://api.github.com/users/emulbreh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/emulbreh/subscriptions","organizations_url":"https://api.github.com/users/emulbreh/orgs","repos_url":"https://api.github.com/users/emulbreh/repos","events_url":"https://api.github.com/users/emulbreh/events{/privacy}","received_events_url":"https://api.github.com/users/emulbreh/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/emulbreh/django","description":"The Web framework for perfectionists with deadlines.","fork":true,"url":"https://api.github.com/repos/emulbreh/django","forks_url":"https://api.github.com/repos/emulbreh/django/forks","keys_url":"https://api.github.com/repos/emulbreh/django/keys{/key_id}","collaborators_url":"https://api.github.com/repos/emulbreh/django/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/emulbreh/django/teams","hooks_url":"https://api.github.com/repos/emulbreh/django/hooks","issue_events_url":"https://api.github.com/repos/emulbreh/django/issues/events{/number}","events_url":"https://api.github.com/repos/emulbreh/django/events","assignees_url":"https://api.github.com/repos/emulbreh/django/assignees{/user}","branches_url":"https://api.github.com/repos/emulbreh/django/branches{/branch}","tags_url":"https://api.github.com/repos/emulbreh/django/tags","blobs_url":"https://api.github.com/repos/emulbreh/django/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/emulbreh/django/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/emulbreh/django/git/refs{/sha}","trees_url":"https://api.github.com/repos/emulbreh/django/git/trees{/sha}","statuses_url":"https://api.github.com/repos/emulbreh/django/statuses/{sha}","languages_url":"https://api.github.com/repos/emulbreh/django/languages","stargazers_url":"https://api.github.com/repos/emulbreh/django/stargazers","contributors_url":"https://api.github.com/repos/emulbreh/django/contributors","subscribers_url":"https://api.github.com/repos/emulbreh/django/subscribers","subscription_url":"https://api.github.com/repos/emulbreh/django/subscription","commits_url":"https://api.github.com/repos/emulbreh/django/commits{/sha}","git_commits_url":"https://api.github.com/repos/emulbreh/django/git/commits{/sha}","comments_url":"https://api.github.com/repos/emulbreh/django/comments{/number}","issue_comment_url":"https://api.github.com/repos/emulbreh/django/issues/comments{/number}","contents_url":"https://api.github.com/repos/emulbreh/django/contents/{+path}","compare_url":"https://api.github.com/repos/emulbreh/django/compare/{base}...{head}","merges_url":"https://api.github.com/repos/emulbreh/django/merges","archive_url":"https://api.github.com/repos/emulbreh/django/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/emulbreh/django/downloads","issues_url":"https://api.github.com/repos/emulbreh/django/issues{/number}","pulls_url":"https://api.github.com/repos/emulbreh/django/pulls{/number}","milestones_url":"https://api.github.com/repos/emulbreh/django/milestones{/number}","notifications_url":"https://api.github.com/repos/emulbreh/django/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/emulbreh/django/labels{/name}","releases_url":"https://api.github.com/repos/emulbreh/django/releases{/id}","deployments_url":"https://api.github.com/repos/emulbreh/django/deployments","created_at":"2012-12-10T16:07:20Z","updated_at":"2015-03-10T00:44:56Z","pushed_at":"2016-07-10T10:33:23Z","git_url":"git://github.com/emulbreh/django.git","ssh_url":"git@github.com:emulbreh/django.git","clone_url":"https://github.com/emulbreh/django.git","svn_url":"https://github.com/emulbreh/django","homepage":"http://www.djangoproject.com/","size":118333,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"django:master","ref":"master","sha":"418658f453bed7fe7949dda26651aab370003e6a","user":{"login":"django","id":27804,"avatar_url":"https://avatars.githubusercontent.com/u/27804?v=3","gravatar_id":"","url":"https://api.github.com/users/django","html_url":"https://github.com/django","followers_url":"https://api.github.com/users/django/followers","following_url":"https://api.github.com/users/django/following{/other_user}","gists_url":"https://api.github.com/users/django/gists{/gist_id}","starred_url":"https://api.github.com/users/django/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/django/subscriptions","organizations_url":"https://api.github.com/users/django/orgs","repos_url":"https://api.github.com/users/django/repos","events_url":"https://api.github.com/users/django/events{/privacy}","received_events_url":"https://api.github.com/users/django/received_events","type":"Organization","site_admin":false},"repo":{"id":4164482,"name":"django","full_name":"django/django","owner":{"login":"django","id":27804,"avatar_url":"https://avatars.githubusercontent.com/u/27804?v=3","gravatar_id":"","url":"https://api.github.com/users/django","html_url":"https://github.com/django","followers_url":"https://api.github.com/users/django/followers","following_url":"https://api.github.com/users/django/following{/other_user}","gists_url":"https://api.github.com/users/django/gists{/gist_id}","starred_url":"https://api.github.com/users/django/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/django/subscriptions","organizations_url":"https://api.github.com/users/django/orgs","repos_url":"https://api.github.com/users/django/repos","events_url":"https://api.github.com/users/django/events{/privacy}","received_events_url":"https://api.github.com/users/django/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/django/django","description":"The Web framework for perfectionists with deadlines.","fork":false,"url":"https://api.github.com/repos/django/django","forks_url":"https://api.github.com/repos/django/django/forks","keys_url":"https://api.github.com/repos/django/django/keys{/key_id}","collaborators_url":"https://api.github.com/repos/django/django/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/django/django/teams","hooks_url":"https://api.github.com/repos/django/django/hooks","issue_events_url":"https://api.github.com/repos/django/django/issues/events{/number}","events_url":"https://api.github.com/repos/django/django/events","assignees_url":"https://api.github.com/repos/django/django/assignees{/user}","branches_url":"https://api.github.com/repos/django/django/branches{/branch}","tags_url":"https://api.github.com/repos/django/django/tags","blobs_url":"https://api.github.com/repos/django/django/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/django/django/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/django/django/git/refs{/sha}","trees_url":"https://api.github.com/repos/django/django/git/trees{/sha}","statuses_url":"https://api.github.com/repos/django/django/statuses/{sha}","languages_url":"https://api.github.com/repos/django/django/languages","stargazers_url":"https://api.github.com/repos/django/django/stargazers","contributors_url":"https://api.github.com/repos/django/django/contributors","subscribers_url":"https://api.github.com/repos/django/django/subscribers","subscription_url":"https://api.github.com/repos/django/django/subscription","commits_url":"https://api.github.com/repos/django/django/commits{/sha}","git_commits_url":"https://api.github.com/repos/django/django/git/commits{/sha}","comments_url":"https://api.github.com/repos/django/django/comments{/number}","issue_comment_url":"https://api.github.com/repos/django/django/issues/comments{/number}","contents_url":"https://api.github.com/repos/django/django/contents/{+path}","compare_url":"https://api.github.com/repos/django/django/compare/{base}...{head}","merges_url":"https://api.github.com/repos/django/django/merges","archive_url":"https://api.github.com/repos/django/django/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/django/django/downloads","issues_url":"https://api.github.com/repos/django/django/issues{/number}","pulls_url":"https://api.github.com/repos/django/django/pulls{/number}","milestones_url":"https://api.github.com/repos/django/django/milestones{/number}","notifications_url":"https://api.github.com/repos/django/django/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/django/django/labels{/name}","releases_url":"https://api.github.com/repos/django/django/releases{/id}","deployments_url":"https://api.github.com/repos/django/django/deployments","created_at":"2012-04-28T02:47:18Z","updated_at":"2016-07-31T11:47:13Z","pushed_at":"2016-07-31T09:49:45Z","git_url":"git://github.com/django/django.git","ssh_url":"git@github.com:django/django.git","clone_url":"https://github.com/django/django.git","svn_url":"https://github.com/django/django","homepage":"https://www.djangoproject.com/","size":192618,"stargazers_count":20521,"watchers_count":20521,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":8282,"mirror_url":null,"open_issues_count":101,"forks":8282,"open_issues":101,"watchers":20521,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/django/django/pulls/6638"},"html":{"href":"https://github.com/django/django/pull/6638"},"issue":{"href":"https://api.github.com/repos/django/django/issues/6638"},"comments":{"href":"https://api.github.com/repos/django/django/issues/6638/comments"},"review_comments":{"href":"https://api.github.com/repos/django/django/pulls/6638/comments"},"review_comment":{"href":"https://api.github.com/repos/django/django/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/django/django/pulls/6638/commits"},"statuses":{"href":"https://api.github.com/repos/django/django/statuses/2a71d62f9fcd5b5f7ed96a579db8a79963a66578"}}}}
{"actor":{"display_login":"jarshwah"}}