This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: struni: corrections in ftplib
Type: Stage:
Components: Library (Lib) Versions: Python 3.0
process
Status: closed Resolution: rejected
Dependencies: Superseder:
Assigned To: gvanrossum Nosy List: amaury.forgeotdarc, gvanrossum
Priority: normal Keywords: patch

Created on 2007-07-17 00:46 by amaury.forgeotdarc, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
ftplib.diff amaury.forgeotdarc, 2007-07-17 00:46
Messages (3)
msg52895 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) Date: 2007-07-17 00:46
test_ftplib now passes, but it only tests socket timeouts...
My corrections were based on runs like:
python -m ftplib ftp.gnu.org -l emacs

Note: In this kind of code, byte objects make the code more difficult:
- it is easy to forget the b prefix 
eg:    resp[:3] in (b'250', '200')
- getitem does not return a single byte:
eg:    resp[0] == b'2'

Or should ftplib decode all the lines it receives?
msg52896 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2007-07-17 19:15
You're right, it's ugly. I wonder if it makes more sense to change the makefile() call to use 'r' for the mode, and adjust the various put* methods to convert their argument to bytes?  We could use "ASCII", "Latin-1" or "UTF-8" for encoding, I don't really know if there are ftp servers that do anything with non-ASCII characters or encodings.  Maybe adding the encoding as an option would be useful.
msg52897 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2007-07-17 20:45
I've checked in minimal changes that make ftplib work along those lines.
History
Date User Action Args
2022-04-11 14:56:25adminsetgithub: 45213
2008-01-06 22:29:45adminsetkeywords: - py3k
versions: + Python 3.0
2007-07-17 00:46:10amaury.forgeotdarccreate