mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
gh-124858: fix happy eyeballs refcyles (#124859)
This commit is contained in:
parent
6810928927
commit
c066bf5535
4 changed files with 32 additions and 6 deletions
|
@ -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()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue