René's URL Explorer Experiment


Title: Ensure get_event_loop returns the running loop when called in a coroutine by vxgmichel · Pull Request #355 · python/asyncio · GitHub

Open Graph Title: Ensure get_event_loop returns the running loop when called in a coroutine by vxgmichel · Pull Request #355 · python/asyncio

X Title: Ensure get_event_loop returns the running loop when called in a coroutine by vxgmichel · Pull Request #355 · python/asyncio

Description: This PR follows up on the issue 26969. It is meant to ensure that asyncio.get_event_loop returns the running loop when called in a coroutine (or loop callbacks). This could simplify all the coroutines that includes a loop optional argument by removing it. This is done by modifying the interface of AbstractEventLoopPolicy: get/set_event_loop is renamed to get/set_default_loop get/set_running_loop is added get_event_loop now uses the running loop if available, and the default loop otherwise BaseEventLoopPolicy is updated, and adds a few features: it does not allow to set a running loop if another one is already set it issues warnings if the running loop doesn't correspond to the default loop A context manager is also added to AbstractEventLoopPolicy and AbstractEventLoop to set and clear the running loop in a safe manner. This might help for other event loop implementations.

Open Graph Description: This PR follows up on the issue 26969. It is meant to ensure that asyncio.get_event_loop returns the running loop when called in a coroutine (or loop callbacks). This could simplify all the corouti...

X Description: This PR follows up on the issue 26969. It is meant to ensure that asyncio.get_event_loop returns the running loop when called in a coroutine (or loop callbacks). This could simplify all the corouti...

Opengraph URL: https://github.com/python/asyncio/pull/355

X: @github

direct link

Domain: github.com

route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:e3724247-7700-a170-f94b-a33a836703ab
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idB4FE:148F52:170DC64:20C0A88:6A5FA6B8
html-safe-noncee54d5babdff5e1eda3df4cac4a0e946b691d4c7ab342c4b46a0f916e01d767d6
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCNEZFOjE0OEY1MjoxNzBEQzY0OjIwQzBBODg6NkE1RkE2QjgiLCJ2aXNpdG9yX2lkIjoiMjczMDEzNTM1NjkyNzA5MjQwOCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac1959d855406ea196deddcbe82492277c1a35dc74b0b91d99cdfb43adcd829d57
hovercard-subject-tagpull_request:71451100
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/python/asyncio/pull/355/files
twitter:imagehttps://avatars.githubusercontent.com/u/7490006?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/7490006?s=400&v=4
og:image:altThis PR follows up on the issue 26969. It is meant to ensure that asyncio.get_event_loop returns the running loop when called in a coroutine (or loop callbacks). This could simplify all the corouti...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None9b835c054d57dfb6ce72ba8f0eb8f16f0370860631609eb10df818738c61c68d
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/python/asyncio git https://github.com/python/asyncio.git
octolytics-dimension-user_id1525981
octolytics-dimension-user_loginpython
octolytics-dimension-repository_id33739295
octolytics-dimension-repository_nwopython/asyncio
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id33739295
octolytics-dimension-repository_network_root_nwopython/asyncio
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release4df9bc0bde4bfd7cd95e75afdd7f103984ece3a1
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/python/asyncio/pull/355/files#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fasyncio%2Fpull%2F355%2Ffiles
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub Copilot appDirect agents from issue to mergehttps://github.com/features/ai/github-app
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
Code QualityEnforce quality at mergehttps://github.com/features/code-quality
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
View all resourceshttps://github.com/resources
GitHub SponsorsFund open source developershttps://github.com/open-source/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/open-source/accelerator
GitHub Starshttps://stars.github.com
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fasyncio%2Fpull%2F355%2Ffiles
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=python%2Fasyncio
Reloadhttps://github.com/python/asyncio/pull/355/files
Reloadhttps://github.com/python/asyncio/pull/355/files
Reloadhttps://github.com/python/asyncio/pull/355/files
Please reload this pagehttps://github.com/python/asyncio/pull/355/files
python https://github.com/python
asynciohttps://github.com/python/asyncio
Please reload this pagehttps://github.com/python/asyncio/pull/355/files
Notifications https://github.com/login?return_to=%2Fpython%2Fasyncio
Fork 182 https://github.com/login?return_to=%2Fpython%2Fasyncio
Star 1.1k https://github.com/login?return_to=%2Fpython%2Fasyncio
Code https://github.com/python/asyncio
Issues 76 https://github.com/python/asyncio/issues
Pull requests 10 https://github.com/python/asyncio/pulls
Actions https://github.com/python/asyncio/actions
Projects https://github.com/python/asyncio/projects
Wiki https://github.com/python/asyncio/wiki
Security and quality 0 https://github.com/python/asyncio/security
Insights https://github.com/python/asyncio/pulse
Code https://github.com/python/asyncio
Issues https://github.com/python/asyncio/issues
Pull requests https://github.com/python/asyncio/pulls
Actions https://github.com/python/asyncio/actions
Projects https://github.com/python/asyncio/projects
Wiki https://github.com/python/asyncio/wiki
Security and quality https://github.com/python/asyncio/security
Insights https://github.com/python/asyncio/pulse
vxgmichelhttps://github.com/vxgmichel
python:masterhttps://github.com/python/asyncio/tree/master
vxgmichel:running-loophttps://github.com/vxgmichel/asyncio/tree/running-loop
Conversation 68 https://github.com/python/asyncio/pull/355
Commits 18 https://github.com/python/asyncio/pull/355/commits
Checks 0 https://github.com/python/asyncio/pull/355/checks
Files changed https://github.com/python/asyncio/pull/355/files
Please reload this pagehttps://github.com/python/asyncio/pull/355/files
Ensure get_event_loop returns the running loop when called in a coroutine https://github.com/python/asyncio/pull/355/files#top
Show all changes 18 commits https://github.com/python/asyncio/pull/355/files
b30bcdc Modify the interface for AbstractEventLoopPolicy May 25, 2016 https://github.com/python/asyncio/pull/355/commits/b30bcdc87cdc8f60c06a3cc2e6f2904c35147d1b
705a54c Update BaseEventLoop.run_forever to set and clear the running loop May 25, 2016 https://github.com/python/asyncio/pull/355/commits/705a54c6183e4fb36a49e1fd528e12fbcd501301
2e55a60 Ignore event loop policy warnings during the tests May 25, 2016 https://github.com/python/asyncio/pull/355/commits/2e55a602df3cfcce6a3569ab0e2d2c1d2039f7ff
f117c75 Fix SleepTests and TimeoutTests May 25, 2016 https://github.com/python/asyncio/pull/355/commits/f117c7571d9739a4a5b500e3026bba769e9fe624
1c3a166 Revert "Ignore event loop policy warnings during the tests" Jun 3, 2016 https://github.com/python/asyncio/pull/355/commits/1c3a166af007bd517b4f09796b97f9f181a11a5d
6e8eaa2 Remove running loop context and event loop policy warnings Jun 3, 2016 https://github.com/python/asyncio/pull/355/commits/6e8eaa23d4459a486aeb8c3b963214ac50c0b585
be2c0f1 Revert "Fix SleepTests and TimeoutTests" Jun 3, 2016 https://github.com/python/asyncio/pull/355/commits/be2c0f10a08676078ac7d05a73b13731aaab0d65
c1cb666 Update docstrings for AbstractEventLoopPolicy Jun 3, 2016 https://github.com/python/asyncio/pull/355/commits/c1cb666d4ee5cc5be5cd4690e6e1ed5d5dc7e43a
8788c72 Remove get/set_default_loop Jun 3, 2016 https://github.com/python/asyncio/pull/355/commits/8788c72b0de75a672ccba58fab2ee5e3d198f443
121cca3 Add disable_get_running_loop method to TestCase Jun 3, 2016 https://github.com/python/asyncio/pull/355/commits/121cca3fef3820a1850df91f6d772e40ed5844d4
f1674e8 Update set_event_loop docstring Jun 3, 2016 https://github.com/python/asyncio/pull/355/commits/f1674e8d55272095103faedb696d4c29b14ed92c
c634f79 Merge both try-finally blocks into one in BaseEventLoop.run_forever Jun 3, 2016 https://github.com/python/asyncio/pull/355/commits/c634f7949b9a7f5663c3e0ae95a3b2407811a345
71fcfab Fix new_event_loop docstring for AbstractEventLoopPolicy Jun 4, 2016 https://github.com/python/asyncio/pull/355/commits/71fcfabbc6d21bc07cb5ac63188c07d228e66f86
1a60ee8 Add test_set_running_loop to PolicyTests Jun 4, 2016 https://github.com/python/asyncio/pull/355/commits/1a60ee8eb1452ff7a73de7628e5f1c8862c56b38
db6774d Clean set_running_loop Jun 4, 2016 https://github.com/python/asyncio/pull/355/commits/db6774db69aec75a3dc4a21a75f6a93825270b1d
28c3de3 Add test_get_event_loop_after_set_running_loop to PolicyTests Jun 4, 2016 https://github.com/python/asyncio/pull/355/commits/28c3de3d9d8b44cdddcf72378febb52e27042d85
5b19055 Fix get_event_loop docstring Jun 4, 2016 https://github.com/python/asyncio/pull/355/commits/5b190555ee1dfaec09d8cd2c60b0ca5613f20a6c
7513577 Update running context in BaseEventLoop.run_forever Jun 4, 2016 https://github.com/python/asyncio/pull/355/commits/751357720fd936607db6b10d7fb765f6a296244d
Clear filters https://github.com/python/asyncio/pull/355/files
Please reload this pagehttps://github.com/python/asyncio/pull/355/files
Please reload this pagehttps://github.com/python/asyncio/pull/355/files
base_events.py https://github.com/python/asyncio/pull/355/files#diff-f57505d1f4330e1cb061ee8e5beb4ea518c7f27a9cc6a2ebfea1e28543e2dd46
events.py https://github.com/python/asyncio/pull/355/files#diff-b2fbb6ed81c97ae9e6c53aa9cf5bdb497e1979f953a75f133213b474a946f4b4
test_utils.py https://github.com/python/asyncio/pull/355/files#diff-ade8d62271ecead4eee0acdda801d117fc75473517f14792824d257adfad1fe5
test_events.py https://github.com/python/asyncio/pull/355/files#diff-17a9b99a7b95f217c0c8d0f8d0c9d852368eb8e2e14883d26b443483e1b7597f
asyncio/base_events.pyhttps://github.com/python/asyncio/pull/355/files#diff-f57505d1f4330e1cb061ee8e5beb4ea518c7f27a9cc6a2ebfea1e28543e2dd46
View file https://github.com/vxgmichel/asyncio/blob/751357720fd936607db6b10d7fb765f6a296244d/asyncio/base_events.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/asyncio/pull/355/{{ revealButtonHref }}
https://github.com/python/asyncio/pull/355/files#diff-f57505d1f4330e1cb061ee8e5beb4ea518c7f27a9cc6a2ebfea1e28543e2dd46
1st1https://github.com/1st1
Jun 5, 2016https://github.com/python/asyncio/pull/355/files#r65821096
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
Please reload this pagehttps://github.com/python/asyncio/pull/355/files
vxgmichelhttps://github.com/vxgmichel
Jun 5, 2016https://github.com/python/asyncio/pull/355/files#r65822245
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
Please reload this pagehttps://github.com/python/asyncio/pull/355/files
gvanrossumhttps://github.com/gvanrossum
Jun 5, 2016https://github.com/python/asyncio/pull/355/files#r65827163
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
Please reload this pagehttps://github.com/python/asyncio/pull/355/files
vxgmichelhttps://github.com/vxgmichel
Jun 6, 2016https://github.com/python/asyncio/pull/355/files#r65872460
Please reload this pagehttps://github.com/python/asyncio/pull/355/files
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
@gvanrossumhttps://github.com/gvanrossum
Please reload this pagehttps://github.com/python/asyncio/pull/355/files
1st1https://github.com/1st1
Jun 6, 2016https://github.com/python/asyncio/pull/355/files#r65927487
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
@gvanrossumhttps://github.com/gvanrossum
Please reload this pagehttps://github.com/python/asyncio/pull/355/files
gvanrossumhttps://github.com/gvanrossum
Jun 6, 2016https://github.com/python/asyncio/pull/355/files#r65935069
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
Please reload this pagehttps://github.com/python/asyncio/pull/355/files
1st1https://github.com/1st1
Jun 6, 2016https://github.com/python/asyncio/pull/355/files#r65936580
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
Please reload this pagehttps://github.com/python/asyncio/pull/355/files
gvanrossumhttps://github.com/gvanrossum
Jun 6, 2016https://github.com/python/asyncio/pull/355/files#r65937419
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
Please reload this pagehttps://github.com/python/asyncio/pull/355/files
1st1https://github.com/1st1
Jun 3, 2016https://github.com/python/asyncio/pull/355/files#r65785846
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
Please reload this pagehttps://github.com/python/asyncio/pull/355/files
1st1https://github.com/1st1
Jun 4, 2016https://github.com/python/asyncio/pull/355/files#r65797578
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
Please reload this pagehttps://github.com/python/asyncio/pull/355/files
https://github.com/python/asyncio/pull/355/files#diff-f57505d1f4330e1cb061ee8e5beb4ea518c7f27a9cc6a2ebfea1e28543e2dd46
asyncio/events.pyhttps://github.com/python/asyncio/pull/355/files#diff-b2fbb6ed81c97ae9e6c53aa9cf5bdb497e1979f953a75f133213b474a946f4b4
View file https://github.com/vxgmichel/asyncio/blob/751357720fd936607db6b10d7fb765f6a296244d/asyncio/events.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/asyncio/pull/355/{{ revealButtonHref }}
https://github.com/python/asyncio/pull/355/files#diff-b2fbb6ed81c97ae9e6c53aa9cf5bdb497e1979f953a75f133213b474a946f4b4
https://github.com/python/asyncio/pull/355/files#diff-b2fbb6ed81c97ae9e6c53aa9cf5bdb497e1979f953a75f133213b474a946f4b4
https://github.com/python/asyncio/pull/355/files#diff-b2fbb6ed81c97ae9e6c53aa9cf5bdb497e1979f953a75f133213b474a946f4b4
https://github.com/python/asyncio/pull/355/files#diff-b2fbb6ed81c97ae9e6c53aa9cf5bdb497e1979f953a75f133213b474a946f4b4
1st1https://github.com/1st1
Jun 2, 2016https://github.com/python/asyncio/pull/355/files#r65620088
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
Please reload this pagehttps://github.com/python/asyncio/pull/355/files
vxgmichelhttps://github.com/vxgmichel
Jun 3, 2016https://github.com/python/asyncio/pull/355/files#r65677655
Please reload this pagehttps://github.com/python/asyncio/pull/355/files
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
Please reload this pagehttps://github.com/python/asyncio/pull/355/files
1st1https://github.com/1st1
Jun 3, 2016https://github.com/python/asyncio/pull/355/files#r65724145
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
Please reload this pagehttps://github.com/python/asyncio/pull/355/files
https://github.com/python/asyncio/pull/355/files#diff-b2fbb6ed81c97ae9e6c53aa9cf5bdb497e1979f953a75f133213b474a946f4b4
asyncio/test_utils.pyhttps://github.com/python/asyncio/pull/355/files#diff-ade8d62271ecead4eee0acdda801d117fc75473517f14792824d257adfad1fe5
View file https://github.com/vxgmichel/asyncio/blob/751357720fd936607db6b10d7fb765f6a296244d/asyncio/test_utils.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/asyncio/pull/355/{{ revealButtonHref }}
https://github.com/python/asyncio/pull/355/files#diff-ade8d62271ecead4eee0acdda801d117fc75473517f14792824d257adfad1fe5
https://github.com/python/asyncio/pull/355/files#diff-ade8d62271ecead4eee0acdda801d117fc75473517f14792824d257adfad1fe5
tests/test_events.pyhttps://github.com/python/asyncio/pull/355/files#diff-17a9b99a7b95f217c0c8d0f8d0c9d852368eb8e2e14883d26b443483e1b7597f
View file https://github.com/vxgmichel/asyncio/blob/751357720fd936607db6b10d7fb765f6a296244d/tests/test_events.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/asyncio/pull/355/{{ revealButtonHref }}
https://github.com/python/asyncio/pull/355/files#diff-17a9b99a7b95f217c0c8d0f8d0c9d852368eb8e2e14883d26b443483e1b7597f
https://github.com/python/asyncio/pull/355/files#diff-17a9b99a7b95f217c0c8d0f8d0c9d852368eb8e2e14883d26b443483e1b7597f
https://github.com/python/asyncio/pull/355/files#diff-17a9b99a7b95f217c0c8d0f8d0c9d852368eb8e2e14883d26b443483e1b7597f
https://github.com/python/asyncio/pull/355/files#diff-17a9b99a7b95f217c0c8d0f8d0c9d852368eb8e2e14883d26b443483e1b7597f
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.