Patches item #992750, was opened at 2004-07-17 09:45 Message generated for change (Comment added) made by loewis You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=305470&aid=992750&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.3 >Status: Closed >Resolution: Out of Date Priority: 5 Private: No Submitted By: Keyphrene (keyphrene) Assigned to: Nobody/Anonymous (nobody) Summary: zipfile and big zipped file Initial Comment: 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. ---------------------------------------------------------------------- >Comment By: Martin v. Löwis (loewis) Date: 2007-02-13 10:01 Message: Logged In: YES user_id=21627 Originator: NO It seems that this patch was superceded by 1121142, so closing it as out-of-date. ---------------------------------------------------------------------- Comment By: Alan McIntyre (alanmcintyre) Date: 2005-02-11 02:32 Message: 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? ---------------------------------------------------------------------- Comment By: Alan McIntyre (alanmcintyre) Date: 2005-02-09 23:29 Message: 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. ---------------------------------------------------------------------- Comment By: Martin v. Löwis (loewis) Date: 2004-08-18 15:13 Message: 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? ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=305470&aid=992750&group_id=5470 _______________________________________________ Patches mailing list Patches@python.org http://mail.python.org/mailman/listinfo/patches