]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.12] gh-118042: Fix error in Telnet.__del__ when __init__() was not called (GH...
authorSerhiy Storchaka <storchaka@gmail.com>
Fri, 26 Apr 2024 05:53:54 +0000 (08:53 +0300)
committerGitHub <noreply@github.com>
Fri, 26 Apr 2024 05:53:54 +0000 (08:53 +0300)
Lib/telnetlib.py
Misc/NEWS.d/next/Library/2024-04-25-12-02-06.gh-issue-118042.2EcdHf.rst [new file with mode: 0644]

index 62d636129853ad14bf63371f54d70bb06455f636..af44494e7e87dd591534fd28aea7a3fa14d47969 100644 (file)
@@ -195,6 +195,7 @@ class Telnet:
         No other action is done afterwards by telnetlib.
 
     """
+    sock = None  # for __del__()
 
     def __init__(self, host=None, port=0,
                  timeout=socket._GLOBAL_DEFAULT_TIMEOUT):
diff --git a/Misc/NEWS.d/next/Library/2024-04-25-12-02-06.gh-issue-118042.2EcdHf.rst b/Misc/NEWS.d/next/Library/2024-04-25-12-02-06.gh-issue-118042.2EcdHf.rst
new file mode 100644 (file)
index 0000000..7337aae
--- /dev/null
@@ -0,0 +1,2 @@
+Fix an unraisable exception in :meth:`telnetlib.Telnet.__del__` when the
+``__init__()`` method was not called.