From 8a2f07fcf18b1175fae8483962f281ad1504f000 Mon Sep 17 00:00:00 2001 From: snowykami Date: Mon, 14 Oct 2024 20:40:14 +0800 Subject: [PATCH] =?UTF-8?q?:bug:=20=E5=9C=A8=E5=9B=9E=E6=94=B6=E6=97=B6?= =?UTF-8?q?=E5=85=B3=E9=97=AD=E9=80=9A=E9=81=93=E4=BB=A5=E8=8A=82=E7=9C=81?= =?UTF-8?q?=E8=B5=84=E6=BA=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- magicoca/chan.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/magicoca/chan.py b/magicoca/chan.py index b5b9307..b4a7de9 100644 --- a/magicoca/chan.py +++ b/magicoca/chan.py @@ -110,3 +110,9 @@ class Chan(Generic[T]): Returns: """ self.recv_conn, other.recv_conn = other.recv_conn, self.recv_conn + + def __del__(self): + """ + Close the channel when the object is deleted. + """ + self.close()