diff --git a/Lib/ftplib.py b/Lib/ftplib.py index 807bc383eeb..222e77d654d 100644 --- a/Lib/ftplib.py +++ b/Lib/ftplib.py @@ -221,7 +221,7 @@ class FTP: def voidresp(self): """Expect a response beginning with '2'.""" resp = self.getresp() - if resp[0] != '2': + if resp[:1] != '2': raise error_reply, resp return resp @@ -520,8 +520,6 @@ class FTP: resp = self.sendcmd('DELE ' + filename) if resp[:3] in ('250', '200'): return resp - elif resp[:1] == '5': - raise error_perm, resp else: raise error_reply, resp diff --git a/Misc/NEWS b/Misc/NEWS index 09190a0b900..c10896433f9 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -95,6 +95,8 @@ Core and Builtins Library ------- +- Issue 1726172: fix IndexError in the case of and empty response in ftplib. + - Issue 2625: added missing iteritems() call to the for loop in mailbox.MH.get_message().