New submission from Wüstengecko <lemmi59...@gmail.com>: Since Python 3.9, calling `smtplib.LMTP.connect()` without explicitly specifying any `timeout=` raises a `TypeError`. Specifying `None` or any integer value works correctly.
``` >>> import smtplib >>> smtplib.LMTP("/tmp/lmtp.sock") Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/lib/python3.9/smtplib.py", line 1071, in __init__ super().__init__(host, port, local_hostname=local_hostname, File "/usr/lib/python3.9/smtplib.py", line 253, in __init__ (code, msg) = self.connect(host, port) File "/usr/lib/python3.9/smtplib.py", line 1085, in connect self.sock.settimeout(self.timeout) TypeError: an integer is required (got type object) >>> l = smtplib.LMTP() >>> l.connect("/tmp/lmtp.sock") Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/lib/python3.9/smtplib.py", line 1085, in connect self.sock.settimeout(self.timeout) TypeError: an integer is required (got type object) ``` Upon investigation with `pdb`, the default object for the `timeout` parameter (`socket._GLOBAL_DEFAULT_TIMEOUT`) is passed through to the `self.sock.settimeout` call, instead of being handled as "no timeout specified". The relevant changes were introduced as fix for bpo-39329. ---------- components: Library (Lib) messages: 383850 nosy: wuestengecko priority: normal severity: normal status: open title: smtplib.LMTP.connect() raises TypeError if `timeout` is not specified type: crash versions: Python 3.9 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue42756> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com