diff options
author | Thomas Grainger <tagrain@gmail.com> | 2024-10-02 23:32:31 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-10-02 23:32:31 (GMT) |
commit | c066bf553577d1000e208eb078d9e758c3e41186 (patch) | |
tree | 0d754f19f47cf0fb5c5a126c6d6b6450b273ef49 /Lib/test/test_asyncio | |
parent | 6810928927e4d12d9a5dd90e672afb096882b730 (diff) | |
download | cpython-c066bf553577d1000e208eb078d9e758c3e41186.zip cpython-c066bf553577d1000e208eb078d9e758c3e41186.tar.gz cpython-c066bf553577d1000e208eb078d9e758c3e41186.tar.bz2 |
gh-124858: fix happy eyeballs refcyles (#124859)
Diffstat (limited to 'Lib/test/test_asyncio')
-rw-r--r-- | Lib/test/test_asyncio/test_streams.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/Lib/test/test_asyncio/test_streams.py b/Lib/test/test_asyncio/test_streams.py index d32b7ff..0688299 100644 --- a/Lib/test/test_asyncio/test_streams.py +++ b/Lib/test/test_asyncio/test_streams.py @@ -1200,6 +1200,24 @@ class StreamTests(test_utils.TestCase): messages = self._basetest_unhandled_exceptions(handle_echo) self.assertEqual(messages, []) + def test_open_connection_happy_eyeball_refcycles(self): + port = socket_helper.find_unused_port() + async def main(): + exc = None + try: + await asyncio.open_connection( + host="localhost", + port=port, + happy_eyeballs_delay=0.25, + ) + except* OSError as excs: + # can't use assertRaises because that clears frames + exc = excs.exceptions[0] + self.assertIsNotNone(exc) + self.assertListEqual(gc.get_referrers(exc), []) + + asyncio.run(main()) + if __name__ == '__main__': unittest.main() |