{"action":"created","comment":{"url":"https://api.github.com/repos/python/cpython/pulls/comments/156803668","pull_request_review_id":83340643,"id":156803668,"diff_hunk":"@@ -0,0 +1,48 @@\n+__all__ = 'run',\n+\n+from . import coroutines\n+from . import events\n+\n+\n+def run(main, *, debug=False):\n+    \"\"\"Run a coroutine.\n+\n+    This function runs the passed coroutine, taking care of\n+    managing the asyncio event loop and finalizing asynchronous\n+    generators.\n+\n+    This function cannot be called when another asyncio event loop is\n+    running in the same thread.\n+\n+    If debug is True, the event loop will be run in debug mode.\n+\n+    This function always creates a new event loop and closes it at the end.\n+    It should be used as a main entry point for asyncio programs, and should\n+    ideally only be called once.\n+\n+    Example:\n+\n+        async def main():\n+            await asyncio.sleep(1)\n+            print('hello')\n+\n+        asyncio.run(main())\n+    \"\"\"\n+    if events._get_running_loop() is not None:\n+        raise RuntimeError(\n+            \"asyncio.run() cannot be called from a running event loop\")\n+\n+    if not coroutines.iscoroutine(main):\n+        raise ValueError(\"a coroutine was expected, got {!r}\".format(main))\n+\n+    loop = events.new_event_loop()\n+    try:\n+        events.set_event_loop(loop)","path":"Lib/asyncio/runners.py","position":40,"original_position":40,"commit_id":"b4f3d3af8fd0387cea6d95902f4bd8eb044bb8fb","original_commit_id":"826f7a6888d278c051c47cd75f913788974d982d","user":{"login":"1st1","id":239003,"avatar_url":"https://avatars0.githubusercontent.com/u/239003?v=4","gravatar_id":"","url":"https://api.github.com/users/1st1","html_url":"https://github.com/1st1","followers_url":"https://api.github.com/users/1st1/followers","following_url":"https://api.github.com/users/1st1/following{/other_user}","gists_url":"https://api.github.com/users/1st1/gists{/gist_id}","starred_url":"https://api.github.com/users/1st1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/1st1/subscriptions","organizations_url":"https://api.github.com/users/1st1/orgs","repos_url":"https://api.github.com/users/1st1/repos","events_url":"https://api.github.com/users/1st1/events{/privacy}","received_events_url":"https://api.github.com/users/1st1/received_events","type":"User","site_admin":false},"body":"What's your point?\r\n\r\nThe point of this code is to always close the `loop`, no matter what.  What benefit is there in moving `set_event_loop()` one line up?","created_at":"2017-12-13T22:23:42Z","updated_at":"2017-12-13T22:23:42Z","html_url":"https://github.com/python/cpython/pull/4852#discussion_r156803668","pull_request_url":"https://api.github.com/repos/python/cpython/pulls/4852","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/python/cpython/pulls/comments/156803668"},"html":{"href":"https://github.com/python/cpython/pull/4852#discussion_r156803668"},"pull_request":{"href":"https://api.github.com/repos/python/cpython/pulls/4852"}},"in_reply_to_id":156801014},"pull_request":{"url":"https://api.github.com/repos/python/cpython/pulls/4852","id":158213926,"html_url":"https://github.com/python/cpython/pull/4852","diff_url":"https://github.com/python/cpython/pull/4852.diff","patch_url":"https://github.com/python/cpython/pull/4852.patch","issue_url":"https://api.github.com/repos/python/cpython/issues/4852","number":4852,"state":"open","locked":false,"title":"bpo-32314: Implement asyncio.run()","user":{"login":"1st1","id":239003,"avatar_url":"https://avatars0.githubusercontent.com/u/239003?v=4","gravatar_id":"","url":"https://api.github.com/users/1st1","html_url":"https://github.com/1st1","followers_url":"https://api.github.com/users/1st1/followers","following_url":"https://api.github.com/users/1st1/following{/other_user}","gists_url":"https://api.github.com/users/1st1/gists{/gist_id}","starred_url":"https://api.github.com/users/1st1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/1st1/subscriptions","organizations_url":"https://api.github.com/users/1st1/orgs","repos_url":"https://api.github.com/users/1st1/repos","events_url":"https://api.github.com/users/1st1/events{/privacy}","received_events_url":"https://api.github.com/users/1st1/received_events","type":"User","site_admin":false},"body":"\n\n<!-- issue-number: bpo-32314 -->\nhttps://bugs.python.org/issue32314\n<!-- /issue-number -->\n","created_at":"2017-12-13T21:48:24Z","updated_at":"2017-12-13T22:23:42Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0aaee60213c3b0c237437a7712aa6824580f8c76","assignee":null,"assignees":[],"requested_reviewers":[{"login":"ilevkivskyi","id":12005495,"avatar_url":"https://avatars1.githubusercontent.com/u/12005495?v=4","gravatar_id":"","url":"https://api.github.com/users/ilevkivskyi","html_url":"https://github.com/ilevkivskyi","followers_url":"https://api.github.com/users/ilevkivskyi/followers","following_url":"https://api.github.com/users/ilevkivskyi/following{/other_user}","gists_url":"https://api.github.com/users/ilevkivskyi/gists{/gist_id}","starred_url":"https://api.github.com/users/ilevkivskyi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ilevkivskyi/subscriptions","organizations_url":"https://api.github.com/users/ilevkivskyi/orgs","repos_url":"https://api.github.com/users/ilevkivskyi/repos","events_url":"https://api.github.com/users/ilevkivskyi/events{/privacy}","received_events_url":"https://api.github.com/users/ilevkivskyi/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/python/cpython/pulls/4852/commits","review_comments_url":"https://api.github.com/repos/python/cpython/pulls/4852/comments","review_comment_url":"https://api.github.com/repos/python/cpython/pulls/comments{/number}","comments_url":"https://api.github.com/repos/python/cpython/issues/4852/comments","statuses_url":"https://api.github.com/repos/python/cpython/statuses/b4f3d3af8fd0387cea6d95902f4bd8eb044bb8fb","head":{"label":"1st1:aio_run","ref":"aio_run","sha":"b4f3d3af8fd0387cea6d95902f4bd8eb044bb8fb","user":{"login":"1st1","id":239003,"avatar_url":"https://avatars0.githubusercontent.com/u/239003?v=4","gravatar_id":"","url":"https://api.github.com/users/1st1","html_url":"https://github.com/1st1","followers_url":"https://api.github.com/users/1st1/followers","following_url":"https://api.github.com/users/1st1/following{/other_user}","gists_url":"https://api.github.com/users/1st1/gists{/gist_id}","starred_url":"https://api.github.com/users/1st1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/1st1/subscriptions","organizations_url":"https://api.github.com/users/1st1/orgs","repos_url":"https://api.github.com/users/1st1/repos","events_url":"https://api.github.com/users/1st1/events{/privacy}","received_events_url":"https://api.github.com/users/1st1/received_events","type":"User","site_admin":false},"repo":{"id":83706257,"name":"cpython","full_name":"1st1/cpython","owner":{"login":"1st1","id":239003,"avatar_url":"https://avatars0.githubusercontent.com/u/239003?v=4","gravatar_id":"","url":"https://api.github.com/users/1st1","html_url":"https://github.com/1st1","followers_url":"https://api.github.com/users/1st1/followers","following_url":"https://api.github.com/users/1st1/following{/other_user}","gists_url":"https://api.github.com/users/1st1/gists{/gist_id}","starred_url":"https://api.github.com/users/1st1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/1st1/subscriptions","organizations_url":"https://api.github.com/users/1st1/orgs","repos_url":"https://api.github.com/users/1st1/repos","events_url":"https://api.github.com/users/1st1/events{/privacy}","received_events_url":"https://api.github.com/users/1st1/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/1st1/cpython","description":"The Python programming language","fork":true,"url":"https://api.github.com/repos/1st1/cpython","forks_url":"https://api.github.com/repos/1st1/cpython/forks","keys_url":"https://api.github.com/repos/1st1/cpython/keys{/key_id}","collaborators_url":"https://api.github.com/repos/1st1/cpython/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/1st1/cpython/teams","hooks_url":"https://api.github.com/repos/1st1/cpython/hooks","issue_events_url":"https://api.github.com/repos/1st1/cpython/issues/events{/number}","events_url":"https://api.github.com/repos/1st1/cpython/events","assignees_url":"https://api.github.com/repos/1st1/cpython/assignees{/user}","branches_url":"https://api.github.com/repos/1st1/cpython/branches{/branch}","tags_url":"https://api.github.com/repos/1st1/cpython/tags","blobs_url":"https://api.github.com/repos/1st1/cpython/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/1st1/cpython/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/1st1/cpython/git/refs{/sha}","trees_url":"https://api.github.com/repos/1st1/cpython/git/trees{/sha}","statuses_url":"https://api.github.com/repos/1st1/cpython/statuses/{sha}","languages_url":"https://api.github.com/repos/1st1/cpython/languages","stargazers_url":"https://api.github.com/repos/1st1/cpython/stargazers","contributors_url":"https://api.github.com/repos/1st1/cpython/contributors","subscribers_url":"https://api.github.com/repos/1st1/cpython/subscribers","subscription_url":"https://api.github.com/repos/1st1/cpython/subscription","commits_url":"https://api.github.com/repos/1st1/cpython/commits{/sha}","git_commits_url":"https://api.github.com/repos/1st1/cpython/git/commits{/sha}","comments_url":"https://api.github.com/repos/1st1/cpython/comments{/number}","issue_comment_url":"https://api.github.com/repos/1st1/cpython/issues/comments{/number}","contents_url":"https://api.github.com/repos/1st1/cpython/contents/{+path}","compare_url":"https://api.github.com/repos/1st1/cpython/compare/{base}...{head}","merges_url":"https://api.github.com/repos/1st1/cpython/merges","archive_url":"https://api.github.com/repos/1st1/cpython/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/1st1/cpython/downloads","issues_url":"https://api.github.com/repos/1st1/cpython/issues{/number}","pulls_url":"https://api.github.com/repos/1st1/cpython/pulls{/number}","milestones_url":"https://api.github.com/repos/1st1/cpython/milestones{/number}","notifications_url":"https://api.github.com/repos/1st1/cpython/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/1st1/cpython/labels{/name}","releases_url":"https://api.github.com/repos/1st1/cpython/releases{/id}","deployments_url":"https://api.github.com/repos/1st1/cpython/deployments","created_at":"2017-03-02T17:32:42Z","updated_at":"2017-08-25T06:15:17Z","pushed_at":"2017-12-13T22:20:14Z","git_url":"git://github.com/1st1/cpython.git","ssh_url":"git@github.com:1st1/cpython.git","clone_url":"https://github.com/1st1/cpython.git","svn_url":"https://github.com/1st1/cpython","homepage":"https://www.python.org/","size":211488,"stargazers_count":3,"watchers_count":3,"language":"Python","has_issues":true,"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":null,"forks":0,"open_issues":0,"watchers":3,"default_branch":"master"}},"base":{"label":"python:master","ref":"master","sha":"11a247df88f15b51feff8a3c46005676bb29b96e","user":{"login":"python","id":1525981,"avatar_url":"https://avatars3.githubusercontent.com/u/1525981?v=4","gravatar_id":"","url":"https://api.github.com/users/python","html_url":"https://github.com/python","followers_url":"https://api.github.com/users/python/followers","following_url":"https://api.github.com/users/python/following{/other_user}","gists_url":"https://api.github.com/users/python/gists{/gist_id}","starred_url":"https://api.github.com/users/python/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/python/subscriptions","organizations_url":"https://api.github.com/users/python/orgs","repos_url":"https://api.github.com/users/python/repos","events_url":"https://api.github.com/users/python/events{/privacy}","received_events_url":"https://api.github.com/users/python/received_events","type":"Organization","site_admin":false},"repo":{"id":81598961,"name":"cpython","full_name":"python/cpython","owner":{"login":"python","id":1525981,"avatar_url":"https://avatars3.githubusercontent.com/u/1525981?v=4","gravatar_id":"","url":"https://api.github.com/users/python","html_url":"https://github.com/python","followers_url":"https://api.github.com/users/python/followers","following_url":"https://api.github.com/users/python/following{/other_user}","gists_url":"https://api.github.com/users/python/gists{/gist_id}","starred_url":"https://api.github.com/users/python/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/python/subscriptions","organizations_url":"https://api.github.com/users/python/orgs","repos_url":"https://api.github.com/users/python/repos","events_url":"https://api.github.com/users/python/events{/privacy}","received_events_url":"https://api.github.com/users/python/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/python/cpython","description":"The Python programming language","fork":false,"url":"https://api.github.com/repos/python/cpython","forks_url":"https://api.github.com/repos/python/cpython/forks","keys_url":"https://api.github.com/repos/python/cpython/keys{/key_id}","collaborators_url":"https://api.github.com/repos/python/cpython/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/python/cpython/teams","hooks_url":"https://api.github.com/repos/python/cpython/hooks","issue_events_url":"https://api.github.com/repos/python/cpython/issues/events{/number}","events_url":"https://api.github.com/repos/python/cpython/events","assignees_url":"https://api.github.com/repos/python/cpython/assignees{/user}","branches_url":"https://api.github.com/repos/python/cpython/branches{/branch}","tags_url":"https://api.github.com/repos/python/cpython/tags","blobs_url":"https://api.github.com/repos/python/cpython/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/python/cpython/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/python/cpython/git/refs{/sha}","trees_url":"https://api.github.com/repos/python/cpython/git/trees{/sha}","statuses_url":"https://api.github.com/repos/python/cpython/statuses/{sha}","languages_url":"https://api.github.com/repos/python/cpython/languages","stargazers_url":"https://api.github.com/repos/python/cpython/stargazers","contributors_url":"https://api.github.com/repos/python/cpython/contributors","subscribers_url":"https://api.github.com/repos/python/cpython/subscribers","subscription_url":"https://api.github.com/repos/python/cpython/subscription","commits_url":"https://api.github.com/repos/python/cpython/commits{/sha}","git_commits_url":"https://api.github.com/repos/python/cpython/git/commits{/sha}","comments_url":"https://api.github.com/repos/python/cpython/comments{/number}","issue_comment_url":"https://api.github.com/repos/python/cpython/issues/comments{/number}","contents_url":"https://api.github.com/repos/python/cpython/contents/{+path}","compare_url":"https://api.github.com/repos/python/cpython/compare/{base}...{head}","merges_url":"https://api.github.com/repos/python/cpython/merges","archive_url":"https://api.github.com/repos/python/cpython/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/python/cpython/downloads","issues_url":"https://api.github.com/repos/python/cpython/issues{/number}","pulls_url":"https://api.github.com/repos/python/cpython/pulls{/number}","milestones_url":"https://api.github.com/repos/python/cpython/milestones{/number}","notifications_url":"https://api.github.com/repos/python/cpython/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/python/cpython/labels{/name}","releases_url":"https://api.github.com/repos/python/cpython/releases{/id}","deployments_url":"https://api.github.com/repos/python/cpython/deployments","created_at":"2017-02-10T19:23:51Z","updated_at":"2017-12-13T21:27:38Z","pushed_at":"2017-12-13T22:23:41Z","git_url":"git://github.com/python/cpython.git","ssh_url":"git@github.com:python/cpython.git","clone_url":"https://github.com/python/cpython.git","svn_url":"https://github.com/python/cpython","homepage":"https://www.python.org/","size":219769,"stargazers_count":14758,"watchers_count":14758,"language":"Python","has_issues":false,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":3578,"mirror_url":null,"archived":false,"open_issues_count":538,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":3578,"open_issues":538,"watchers":14758,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/python/cpython/pulls/4852"},"html":{"href":"https://github.com/python/cpython/pull/4852"},"issue":{"href":"https://api.github.com/repos/python/cpython/issues/4852"},"comments":{"href":"https://api.github.com/repos/python/cpython/issues/4852/comments"},"review_comments":{"href":"https://api.github.com/repos/python/cpython/pulls/4852/comments"},"review_comment":{"href":"https://api.github.com/repos/python/cpython/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/python/cpython/pulls/4852/commits"},"statuses":{"href":"https://api.github.com/repos/python/cpython/statuses/b4f3d3af8fd0387cea6d95902f4bd8eb044bb8fb"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"1st1"}}