]> git.ipfire.org Git - thirdparty/bind9.git/commit
Fix Python 3.6 StreamWriter compatibility issue
authorMichał Kępień <michal@isc.org>
Fri, 11 Apr 2025 14:14:57 +0000 (09:14 -0500)
committerMichał Kępień <michal@isc.org>
Fri, 11 Apr 2025 14:20:45 +0000 (14:20 +0000)
commitd86caaee15ad36596047adab857dd7f4829a8f6e
tree64a625359fde338755aa279651768851719fccc5
parent76444d9765829339986ea3c7f5e3860844d7bfb0
Fix Python 3.6 StreamWriter compatibility issue

The StreamWriter.wait_closed() method was introduced in Python 3.7, so
attempting to use it with Python 3.6 raises an exception.  This has not
been noticed before because awaiting StreamWriter.wait_closed() is the
last action taken for each TCP connection and unhandled exceptions were
not causing the scripts based on AsyncServer to exit prematurely until
the previous commit.

As per Python documentation [1], awaiting StreamWriter.wait_closed()
after calling StreamWriter.close() is recommended, but not mandatory, so
try to use it if it is available, without taking any fallback action in
case it isn't.

[1] https://docs.python.org/3.13/library/asyncio-stream.html#asyncio.StreamWriter.close

(cherry picked from commit 715bd1b6678ae591b6edf34c1d5d748f04ad22d0)
bin/tests/system/isctest/asyncserver.py