Issue992750
Created on 2004年07月17日 07:45 by keyphrene, last changed 2022年04月11日 14:56 by admin. This issue is now closed.
| Files |
| File name |
Uploaded |
Description |
Edit |
|
zipfile.py.diff
|
keyphrene,
2004年07月17日 07:45
|
readFile |
| Messages (5) |
|
msg46379 - (view) |
Author: Keyphrene (keyphrene) |
Date: 2004年07月17日 07:45 |
read method decompress the zipped files, but this
method returns bytes, more the file is big, more the
bytes array is big. readFile method allows to send the
bytes in a file.
|
|
msg46380 - (view) |
Author: Martin v. Löwis (loewis) * (Python committer) |
Date: 2004年08月18日 13:13 |
Logged In: YES
user_id=21627
The patch is unacceptable in its current form. It duplicates
too much code; read and readfile should really share the
common code (e.g. by read falling back to readfile).
Also, as this really copies the data to fileobj, it probably
is better called copyfile, instead of readfile.
Finally, I would much prefer if zipfile would have an .open
method, returning a file-like object. Then you would have
such implementations
def read(self, name):
return self.open(name, "r").read()
def readfile(self, name, dest):
import shutil
shutil.copyfileobj(self.open(name,"r"), dest)
I would then probably leave the last method out, and
encourage users to invoke shutil.copyfileobj directly if
desired.
Are you willing to make changes in this direction?
|
|
msg46381 - (view) |
Author: Alan McIntyre (alanmcintyre) * (Python committer) |
Date: 2005年02月09日 22:29 |
Logged In: YES
user_id=1115903
The current behavior of ZipFile.read is an occasional
annoyance for me. I will make the changes described in
loewis' comments and submit the updated patch, unless
somebody is already working on it.
|
|
msg46382 - (view) |
Author: Alan McIntyre (alanmcintyre) * (Python committer) |
Date: 2005年02月11日 01:32 |
Logged In: YES
user_id=1115903
Ok, I ended up just starting from scratch and implementing a
file-like class - it just implements read([size]) right now
- and an instance of this class is returned when you call
ZipFile.open. ZipFile.read was modified to use open(), as
loewis suggested. I also added some code to test_zipfile.py
to check the new open function, and tried using it to
extract a 690MB file from a ZIP with copyfileobj. It seems
to be working ok.
Since I can't get into CVS at the moment, I don't have diff
files to post. Even if I did, I don't see an option for me
to post them to this patch. Should I post them as a new patch?
|
|
msg46383 - (view) |
Author: Martin v. Löwis (loewis) * (Python committer) |
Date: 2007年02月13日 09:01 |
It seems that this patch was superceded by 1121142, so closing it as out-of-date.
|
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2022年04月11日 14:56:05 | admin | set | github: 40586 |
| 2004年07月17日 07:45:39 | keyphrene | create |