mirror of
https://github.com/python/cpython.git
synced 2025-07-30 14:44:10 +00:00
Issue 4929: Handle socket errors when receiving
This commit is contained in:
parent
a200dd5584
commit
51a035e383
1 changed files with 4 additions and 1 deletions
|
@ -334,7 +334,10 @@ class SMTP:
|
||||||
if self.file is None:
|
if self.file is None:
|
||||||
self.file = self.sock.makefile('rb')
|
self.file = self.sock.makefile('rb')
|
||||||
while 1:
|
while 1:
|
||||||
line = self.file.readline()
|
try:
|
||||||
|
line = self.file.readline()
|
||||||
|
except socket.error:
|
||||||
|
line = ''
|
||||||
if line == '':
|
if line == '':
|
||||||
self.close()
|
self.close()
|
||||||
raise SMTPServerDisconnected("Connection unexpectedly closed")
|
raise SMTPServerDisconnected("Connection unexpectedly closed")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue