diff options
author | Victor Stinner <vstinner@python.org> | 2023-11-04 00:47:07 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-04 00:47:07 (GMT) |
commit | ac01e2243a1104b2154c0d1bdbc9f8d5b3ada778 (patch) | |
tree | f7a20f99ec3639f0180a721a0d5e827aba9e85e8 /Lib/test/test_asyncio | |
parent | f62c7ccf9abf6e0493978da9cf9ca43adcd403f9 (diff) | |
download | cpython-ac01e2243a1104b2154c0d1bdbc9f8d5b3ada778.zip cpython-ac01e2243a1104b2154c0d1bdbc9f8d5b3ada778.tar.gz cpython-ac01e2243a1104b2154c0d1bdbc9f8d5b3ada778.tar.bz2 |
gh-111644: Fix asyncio test_unhandled_exceptions() (#111713)
Fix test_unhandled_exceptions() of test_asyncio.test_streams: break
explicitly a reference cycle.
Fix also StreamTests.tearDown(): the loop must not be closed
explicitly, but using set_event_loop() which takes care of shutting
down the executor with executor.shutdown(wait=True).
BaseEventLoop.close() calls executor.shutdown(wait=False).
Diffstat (limited to 'Lib/test/test_asyncio')
-rw-r--r-- | Lib/test/test_asyncio/test_streams.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/Lib/test/test_asyncio/test_streams.py b/Lib/test/test_asyncio/test_streams.py index c477b6c..3fea7b9 100644 --- a/Lib/test/test_asyncio/test_streams.py +++ b/Lib/test/test_asyncio/test_streams.py @@ -37,8 +37,7 @@ class StreamTests(test_utils.TestCase): # just in case if we have transport close callbacks test_utils.run_briefly(self.loop) - self.loop.close() - gc.collect() + # set_event_loop() takes care of closing self.loop in a safe way super().tearDown() def _basetest_open_connection(self, open_connection_fut): @@ -1124,6 +1123,8 @@ os.close(fd) self.assertEqual(messages[0]['message'], 'Unhandled exception in client_connected_cb') + # Break explicitly reference cycle + messages = None if __name__ == '__main__': |