diff --git a/Lib/telnetlib.py b/Lib/telnetlib.py index 62d63612985..af44494e7e8 100644 --- a/Lib/telnetlib.py +++ b/Lib/telnetlib.py @@ -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 index 00000000000..7337aae0981 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2024-04-25-12-02-06.gh-issue-118042.2EcdHf.rst @@ -0,0 +1,2 @@ +Fix an unraisable exception in :meth:`telnetlib.Telnet.__del__` when the +``__init__()`` method was not called.