From: Georg Brandl Date: Sun, 5 Apr 2009 10:51:10 +0000 (+0000) Subject: Merged revisions 71217 via svnmerge from X-Git-Tag: v2.6.2c1~23 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f7a1efcd98dbb7d02f75668d8c7e4df2eb37b942;p=python Merged revisions 71217 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r71217 | georg.brandl | 2009-04-05 12:48:47 +0200 (So, 05 Apr 2009) | 1 line #1726172: dont raise an unexpected IndexError if a voidresp() call has an empty response. ........ --- diff --git a/Lib/ftplib.py b/Lib/ftplib.py index 807bc383ee..222e77d654 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 09190a0b90..c10896433f 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().