Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ftplib.py: IndexError in voidresp occasionally #44999

Closed
kxroberto mannequin opened this issue May 26, 2007 · 2 comments
Closed

ftplib.py: IndexError in voidresp occasionally #44999

kxroberto mannequin opened this issue May 26, 2007 · 2 comments
Labels
stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@kxroberto
Copy link
Mannequin

kxroberto mannequin commented May 26, 2007

BPO 1726172
Nosy @birkenfeld, @giampaolo

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = <Date 2009-04-05.10:48:56.979>
created_at = <Date 2007-05-26.18:39:50.000>
labels = ['type-bug', 'library']
title = 'ftplib.py: IndexError in voidresp occasionally'
updated_at = <Date 2009-04-05.10:48:56.977>
user = 'https://bugs.python.org/kxroberto'

bugs.python.org fields:

activity = <Date 2009-04-05.10:48:56.977>
actor = 'georg.brandl'
assignee = 'none'
closed = True
closed_date = <Date 2009-04-05.10:48:56.979>
closer = 'georg.brandl'
components = ['Library (Lib)']
creation = <Date 2007-05-26.18:39:50.000>
creator = 'kxroberto'
dependencies = []
files = []
hgrepos = []
issue_num = 1726172
keywords = ['patch']
message_count = 2.0
messages = ['52671', '85477']
nosy_count = 3.0
nosy_names = ['georg.brandl', 'kxroberto', 'giampaolo.rodola']
pr_nums = []
priority = 'normal'
resolution = 'fixed'
stage = 'test needed'
status = 'closed'
superseder = None
type = 'behavior'
url = 'https://bugs.python.org/issue1726172'
versions = ['Python 2.6']

@kxroberto
Copy link
Mannequin Author

kxroberto mannequin commented May 26, 2007

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

@kxroberto kxroberto mannequin added stdlib Python modules in the Lib dir labels May 26, 2007
@devdanzin devdanzin mannequin added type-bug An unexpected behavior, bug, or error labels Mar 30, 2009
@birkenfeld
Copy link
Member

Fixed in r71217. Thanks!

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

1 participant