[Patches] [ python-Patches-1726172 ] ftplib.py: IndexError in voidresp occasionally

SourceForge.net noreply at sourceforge.net
Sat May 26 20:39:50 CEST 2007


Patches item #1726172, was opened at 2007-05-26 20:39
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1726172&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Library (Lib)
Group: Python 2.6
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: kxroberto (kxroberto)
Assigned to: Nobody/Anonymous (nobody)
Summary: ftplib.py: IndexError in voidresp occasionally

Initial Comment:
A 1-char manual patch (still applies from 2.3 up to latest python trunk):


C:\Python23\Lib>diff -u org ftplib.py
--- org/ftplib.py       2002-06-03 11:41:46.000000000 +0200
+++ ftplib.py   2007-05-26 20:33:58.086219200 +0200
@@ -219,7 +219,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




--
it solves a rare:
  ...
  File "ftplib.pyo", line 386, in retrbinary 
  File "ftplib.pyo", line 222, in voidresp
IndexError: string index out of range




Robert

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1726172&group_id=5470


More information about the Patches mailing list