This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author wuestengecko
Recipients wuestengecko
Date 2020-12-27.13:11:53
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1609074713.39.0.771360640486.issue42756@roundup.psfhosted.org>
In-reply-to
Content
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.
History
Date User Action Args
2020-12-27 13:11:53wuestengeckosetrecipients: + wuestengecko
2020-12-27 13:11:53wuestengeckosetmessageid: <1609074713.39.0.771360640486.issue42756@roundup.psfhosted.org>
2020-12-27 13:11:53wuestengeckolinkissue42756 messages
2020-12-27 13:11:53wuestengeckocreate