Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bpo-39259: smtp.SMTP/SMTP_SSL now reject timeout = 0 #17958

Open
wants to merge 1 commit into
base: master
from

Conversation

@corona10
Copy link
Member

corona10 commented Jan 12, 2020

@corona10 corona10 requested a review from python/email-team as a code owner Jan 12, 2020
@corona10 corona10 requested a review from vstinner Jan 12, 2020
@corona10

This comment has been minimized.

Copy link
Member Author

corona10 commented Jan 12, 2020

@vstinner
Discussion needed:

During I work on this PR, I've noticed that LMTP does not support the timeout parameter.
See: https://docs.python.org/3.9/library/smtplib.html#smtplib.LMTP

However, LMTP also able to use the socket which is created from SMTP.

return SMTP.connect(self, host, port, source_address=source_address)

IMHO LMTP needs to support the timeout parameter.

>>> import socket
>>> sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
>>> sock.settimeout(30)
>>> sock.gettimeout()
30.0
>>> b = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
>>> b.gettimeout()
>>>

Also AFAIK, Unix Socket also able to set a timeout which is used for LMTP protocol
If you agree, I would like to create an issue for this.

@corona10 corona10 force-pushed the corona10:bpo-39259-smtplib branch from e1d29a6 to 29cd207 Jan 12, 2020
@vstinner

This comment has been minimized.

Copy link
Member

vstinner commented Jan 13, 2020

IMHO LMTP needs to support the timeout parameter.

If you think so, please open a separated issue. It's not directly related to https://bugs.python.org/issue39259


def _get_socket(self, host, port, timeout):
if self.debuglevel > 0:
self._print_debug('connect:', (host, port))
new_socket = socket.create_connection((host, port), timeout,
self.source_address)

This comment has been minimized.

Copy link
@vstinner

vstinner Jan 13, 2020

Member

Wait, where is self.source_address gone? And why tests didn't catch that self.source_address is lost?

@bedevere-bot

This comment has been minimized.

Copy link

bedevere-bot commented Jan 13, 2020

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

And if you don't make the requested changes, you will be put in the comfy chair!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.