bpo-42392: Remove loop parameter form asyncio locks and Queue (#23420)

Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
This commit is contained in:
Yurii Karabas 2020-11-24 20:08:54 +02:00 committed by GitHub
parent b0b428510c
commit 0ec34cab9d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 304 additions and 451 deletions

View file

@ -546,7 +546,21 @@ class TestCase(unittest.TestCase):
def setUp(self):
self._get_running_loop = events._get_running_loop
events._get_running_loop = lambda: None
def _get_running_loop():
frame = sys._getframe(1)
if frame.f_globals['__name__'] == 'asyncio.mixins':
# When we called from LoopBoundedMixin we should
# fallback to default implementation of get_running_loop
try:
return events.get_running_loop()
except RuntimeError:
return None
return None
events._get_running_loop = _get_running_loop
self._thread_cleanup = threading_helper.threading_setup()
def tearDown(self):