Mailing List Archive

[3.12] gh-118042: Fix error in Telnet.__del__ when __init__() was not called (GH-118274)
https://github.com/python/cpython/commit/8e3bd342f39d9904ee48065446562db3f1d66e61
commit: 8e3bd342f39d9904ee48065446562db3f1d66e61
branch: 3.12
author: Serhiy Storchaka <storchaka@gmail.com>
committer: serhiy-storchaka <storchaka@gmail.com>
date: 2024-04-26T08:53:54+03:00
summary:

[3.12] gh-118042: Fix error in Telnet.__del__ when __init__() was not called (GH-118274)

files:
A Misc/NEWS.d/next/Library/2024-04-25-12-02-06.gh-issue-118042.2EcdHf.rst
M Lib/telnetlib.py

diff --git a/Lib/telnetlib.py b/Lib/telnetlib.py
index 62d636129853ad..af44494e7e87dd 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 00000000000000..7337aae0981ef5
--- /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.

_______________________________________________
Python-checkins mailing list -- python-checkins@python.org
To unsubscribe send an email to python-checkins-leave@python.org
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: list-python-checkins@lists.gossamer-threads.com