bpo-36094: Update smtplib.py by prrvchr · Pull Request #23635 · python/cpython
I cannot identify the discrepancy between the implementation and the documentation to which you appear to be alluding; can you elaborate?
I want to integrate smtplib in LibreOffice / OpenOffice.
For that, I have a wizard allowing to configure the connection (host, port, connection mode: not secure, SSL or TLS, authentication method: without, login, OAuth2 ...) using Mozilla ISPDB technology ...
This wizard needs to load the smtplib.SMTP or smtplib.SMTP_SSL class without connection for 2 reasons:
Allow to adjust the debug level before connecting.
Get the code and the message returned by the connect () method to allow better debugging if necessary...
For the moment it is not possible to instantiate the smtplib.SMTP or smtplib.SMTP_SSL class without providing the host parameter without having an error (see bug , contrary to what the documentation says: host is optional ...)
There is never any question of connecting with an ip address
I understand the need to have a deterministic connection mode on the ip address, but in this case it is necessary to modify the API, because it does not offer anything like method or property to allow it... , and assign a private attribute (self._host) is not very pythonic...