[Python-checkins] r71217 - in python/trunk: Lib/ftplib.py Misc/NEWS

georg.brandl python-checkins at python.org
Sun Apr 5 12:48:48 CEST 2009


Author: georg.brandl
Date: Sun Apr  5 12:48:47 2009
New Revision: 71217

Log:
#1726172: dont raise an unexpected IndexError if a voidresp() call has an empty response.

Modified:
   python/trunk/Lib/ftplib.py
   python/trunk/Misc/NEWS

Modified: python/trunk/Lib/ftplib.py
==============================================================================
--- python/trunk/Lib/ftplib.py	(original)
+++ python/trunk/Lib/ftplib.py	Sun Apr  5 12:48:47 2009
@@ -221,7 +221,7 @@
     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 @@
         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
 

Modified: python/trunk/Misc/NEWS
==============================================================================
--- python/trunk/Misc/NEWS	(original)
+++ python/trunk/Misc/NEWS	Sun Apr  5 12:48:47 2009
@@ -210,6 +210,8 @@
 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().
 


More information about the Python-checkins mailing list