{"action":"created","issue":{"url":"https://api.github.com/repos/python/asyncio/issues/452","repository_url":"https://api.github.com/repos/python/asyncio","labels_url":"https://api.github.com/repos/python/asyncio/issues/452/labels{/name}","comments_url":"https://api.github.com/repos/python/asyncio/issues/452/comments","events_url":"https://api.github.com/repos/python/asyncio/issues/452/events","html_url":"https://github.com/python/asyncio/pull/452","id":187196831,"number":452,"title":"Make get_event_loop() return the current loop if called from coroutines/callbacks","user":{"login":"1st1","id":239003,"avatar_url":"https://avatars.githubusercontent.com/u/239003?v=3","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},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":18,"created_at":"2016-11-03T21:35:43Z","updated_at":"2016-11-04T18:59:47Z","closed_at":"2016-11-04T18:22:52Z","pull_request":{"url":"https://api.github.com/repos/python/asyncio/pulls/452","html_url":"https://github.com/python/asyncio/pull/452","diff_url":"https://github.com/python/asyncio/pull/452.diff","patch_url":"https://github.com/python/asyncio/pull/452.patch"},"body":"As discussed in [1] and [2], this PR makes `asyncio.get_event_loop()` to always return the currently running event loop when it is called from a coroutine.\r\n\r\nThe patch adds two new functions: `asyncio._set_current_loop()` and `asyncio._get_current_loop()`.  Both functions are thread-specific and are considered as low-level APIs, intended to be used by third-party loop implementations only. Even though they have a leading underscore, they will be documented as public asyncio API.\r\n\r\n`loop.run_forever()` is modified to call `asyncio._set_current_loop()` and `asyncio._get_current_loop()`.\r\n\r\n`asyncio.get_event_loop()` is modified to check if there is a current loop set by calling `asyncio._get_current_loop()`.  If there is no current event loop, it returns the result of `get_event_loop_policy().get_event_loop()` (old behaviour).\r\n\r\nThe biggest part of the patch is fixing unit tests: all test classes call `super().setUp()`. `test_utils.TestCase.setUp` patches `asyncio._get_current_loop()` to always return `None`. This change is to make sure that the loop is still being passed explicitly within asyncio.\r\n\r\n[1] PR: https://github.com/python/asyncio/pull/355\r\n[2] https://groups.google.com/d/msg/python-tulip/yF9C-rFpiKk/tk5oA3GLHAAJ"},"comment":{"url":"https://api.github.com/repos/python/asyncio/issues/comments/258519620","html_url":"https://github.com/python/asyncio/pull/452#issuecomment-258519620","issue_url":"https://api.github.com/repos/python/asyncio/issues/452","id":258519620,"user":{"login":"1st1","id":239003,"avatar_url":"https://avatars.githubusercontent.com/u/239003?v=3","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},"created_at":"2016-11-04T18:59:47Z","updated_at":"2016-11-04T18:59:47Z","body":"Short answer: race between Travis & GH (at least that's what it looks like).\r\n\r\nLong answer: I squashed everything and force pushed it to the PR. When I merged it to the `master` branch. The PR was automatically closed by GH and it then aborted the builds (that were just started that time). Travis aborted the build marking it as a fail."}}
{"actor":{"display_login":"1st1"}}