diff options
author | Yurii Karabas <1998uriyyo@gmail.com> | 2020-11-24 20:08:54 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-24 20:08:54 +0200 |
commit | 0ec34cab9dd4a7bcddafaeeb445fae0f26afcdd1 (patch) | |
tree | 89a37fba7519bd02dca2192e788bf8afe50aecdd /Lib/test/test_asyncio/utils.py | |
parent | b0b428510cfd604a8eef1f245f039331e671ea4a (diff) | |
download | cpython-0ec34cab9dd4a7bcddafaeeb445fae0f26afcdd1.tar.gz cpython-0ec34cab9dd4a7bcddafaeeb445fae0f26afcdd1.zip |
bpo-42392: Remove loop parameter form asyncio locks and Queue (#23420)
Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
Diffstat (limited to 'Lib/test/test_asyncio/utils.py')
-rw-r--r-- | Lib/test/test_asyncio/utils.py | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/Lib/test/test_asyncio/utils.py b/Lib/test/test_asyncio/utils.py index 34da7390e1b..aba90c970a8 100644 --- a/Lib/test/test_asyncio/utils.py +++ b/Lib/test/test_asyncio/utils.py @@ -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): |