Message383850
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. |
|
Date |
User |
Action |
Args |
2020-12-27 13:11:53 | wuestengecko | set | recipients:
+ wuestengecko |
2020-12-27 13:11:53 | wuestengecko | set | messageid: <1609074713.39.0.771360640486.issue42756@roundup.psfhosted.org> |
2020-12-27 13:11:53 | wuestengecko | link | issue42756 messages |
2020-12-27 13:11:53 | wuestengecko | create | |
|