]> granicus.if.org Git - python/commitdiff
#1726172: dont raise an unexpected IndexError if a voidresp() call has an empty response.
authorGeorg Brandl <georg@python.org>
Sun, 5 Apr 2009 10:48:47 +0000 (10:48 +0000)
committerGeorg Brandl <georg@python.org>
Sun, 5 Apr 2009 10:48:47 +0000 (10:48 +0000)
Lib/ftplib.py
Misc/NEWS

index 807bc383eeb05cbb8b62f4a0ba180b2322a96b56..222e77d654d2ea1db8012bea9f5f4548e70cc132 100644 (file)
@@ -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
 
index db86b517b24fd1c59aa79076716d00113087759a..13d220279e0e5f4694800eb46d4c689533398214 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -210,6 +210,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().