[issue26039] More flexibility in zipfile interface

2016-03-27 Thread Марк Коренберг
Марк Коренберг added the comment: Also, Python have problems with streaming READ of zip archive. I mean ability to read (in some form iterate over) archive when seeking is not available. I mean iteration like one in TAR archives. -- ___ Python

[issue26039] More flexibility in zipfile interface

2016-03-27 Thread Марк Коренберг
Марк Коренберг added the comment: I have the same problem, and make monkey-patch by myself BEFORE seeing this issue (!) Example how I can do that is attached under name "socketpair.py". It will be nice if you take my idea. And after that streaming of zip files would be possible. --

[issue26039] More flexibility in zipfile interface

2016-03-08 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Yes, using the lock in write() or writestr() is equally compatible. -- ___ Python tracker ___

[issue26039] More flexibility in zipfile interface

2016-03-07 Thread Martin Panter
Martin Panter added the comment: Acquiring a lock in open(mode="w") and releasing it in close() doesn’t seem like a particularly useful feature to me. Maybe it would be better (and equally compatible?) to just use the lock in the internal write() or writestr() implementations. --

[issue26039] More flexibility in zipfile interface

2016-03-03 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Sorry for the delay Thomas. This is complex and important to me issue and I want to be attentive to it. I think we should preserve long existing behavior even if it is not documented (documenting or deprecating it is other issue). Concurrent reading and

[issue26039] More flexibility in zipfile interface

2016-03-03 Thread Thomas Kluyver
Thomas Kluyver added the comment: Serhiy, have you had a chance to look at what the zf.open(mode='w') patch does with the lock? -- ___ Python tracker

[issue26039] More flexibility in zipfile interface

2016-02-25 Thread Martin Panter
Martin Panter added the comment: When you say concurrent writes should be impossible, I guess that only applies to a single-threaded program. There is no lock protecting the “self._fileRefCnt > 1” check and related manipulation (not that I am saying there should be). For serializing

[issue26039] More flexibility in zipfile interface

2016-02-24 Thread Thomas Kluyver
Thomas Kluyver added the comment: Oh, I see test_interleaved now, which does test overlapping reads of two files from the same zip file. Do you want that clarified in the docs - which don't currently mention the lock at all - or in a comment in the module? --

[issue26039] More flexibility in zipfile interface

2016-02-24 Thread Thomas Kluyver
Thomas Kluyver added the comment: My initial patch would have allowed passing a readable file-like object into zipfile. I was persuaded that allowing ZipFile.open() to return a writable object was a more intuitive and flexible API. Concurrent writes with zf.open(mode='w') should be

[issue26039] More flexibility in zipfile interface

2016-02-23 Thread Martin Panter
Martin Panter added the comment: Thanks for the pointer Dhiraj. I prefer the open(mode="w") version proposed here, as being more flexible. This way you could wrap the writer object in e.g. TextIOWrapper. The other patch requires passing in a file reader object. Having another look at

[issue26039] More flexibility in zipfile interface

2016-02-23 Thread Dhiraj
Dhiraj added the comment: Please ha Look on issue 11980 http://bugs.python.org/issue11980 Already have been Patched -- nosy: +DhirajMishra ___ Python tracker

[issue26039] More flexibility in zipfile interface

2016-02-23 Thread Thomas Kluyver
Thomas Kluyver added the comment: Ping! ;-) -- ___ Python tracker ___ ___ Python-bugs-list mailing list

[issue26039] More flexibility in zipfile interface

2016-02-15 Thread Thomas Kluyver
Thomas Kluyver added the comment: Hi Serhiy, any more comments on the zf.open() patch? -- ___ Python tracker ___

[issue26039] More flexibility in zipfile interface

2016-02-08 Thread Thomas Kluyver
Thomas Kluyver added the comment: Thanks Serhiy! I'll keep an eye out for comments on the other patch. -- ___ Python tracker ___

[issue26039] More flexibility in zipfile interface

2016-02-07 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Committed zipinfo-from-file5.patch. Now I'm starting to review zipfile-open-w4.patch (I concurred with most Martin's comments for previous patches). -- ___ Python tracker

[issue26039] More flexibility in zipfile interface

2016-02-07 Thread Roundup Robot
Roundup Robot added the comment: New changeset 7fea2cebc604 by Serhiy Storchaka in branch 'default': Issue #26039: Added zipfile.ZipInfo.from_file() and zipinfo.ZipInfo.is_dir(). https://hg.python.org/cpython/rev/7fea2cebc604 -- nosy: +python-dev ___

[issue26039] More flexibility in zipfile interface

2016-02-04 Thread Thomas Kluyver
Thomas Kluyver added the comment: Is there anything more I should be doing with either of these patches? I think I've incorporated all review comments I've seen. Thanks! -- ___ Python tracker

[issue26039] More flexibility in zipfile interface

2016-01-30 Thread Thomas Kluyver
Thomas Kluyver added the comment: Updated version of the ZipInfo.from_file() patch attached. -- Added file: http://bugs.python.org/file41758/zipinfo-from-file5.patch ___ Python tracker

[issue26039] More flexibility in zipfile interface

2016-01-29 Thread Thomas Kluyver
Thomas Kluyver added the comment: Here's a new version of the zf.open() patch following Martin's review (thanks Martin!). I agree that it feels a bit awkward having two completely different actions for zf.open(), but it is a familiar interface, and since the mode parameter is already there,

[issue26039] More flexibility in zipfile interface

2016-01-29 Thread Thomas Kluyver
Changes by Thomas Kluyver : Added file: http://bugs.python.org/file41753/zipinfo-from-file3.patch ___ Python tracker ___

[issue26039] More flexibility in zipfile interface

2016-01-29 Thread Thomas Kluyver
Thomas Kluyver added the comment: Thanks Serhiy for review comments. -- Added file: http://bugs.python.org/file41754/zipinfo-from-file4.patch ___ Python tracker

[issue26039] More flexibility in zipfile interface

2016-01-27 Thread Thomas Kluyver
Thomas Kluyver added the comment: The '2' versions of the two different patches include some docs and tests for these new features. -- Added file: http://bugs.python.org/file41726/zipfile-open-w2.patch ___ Python tracker

[issue26039] More flexibility in zipfile interface

2016-01-26 Thread Thomas Kluyver
Thomas Kluyver added the comment: Serhiy, any chance you'd have some time to review my patch(es)? Or is there someone else interested in zipfile I might interest? Thanks :-) -- ___ Python tracker

[issue26039] More flexibility in zipfile interface

2016-01-26 Thread Thomas Kluyver
Thomas Kluyver added the comment: Thanks! I will work on docs and tests. -- ___ Python tracker ___ ___

[issue26039] More flexibility in zipfile interface

2016-01-26 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Your patches are great Thomas! This is just what I want to implement. It will take some time to make a careful review. Besides possible corrections I think these features will be added in 3.6. But new features need tests and documenting. --

[issue26039] More flexibility in zipfile interface

2016-01-26 Thread Thomas Kluyver
Changes by Thomas Kluyver : Added file: http://bugs.python.org/file41722/zipinfo-from-file2.patch ___ Python tracker ___

[issue26039] More flexibility in zipfile interface

2016-01-17 Thread Thomas Kluyver
Thomas Kluyver added the comment: zipinfo-from-file.patch has an orthogonal but related change: the code in ZipFile.write() to construct a ZipInfo object from a filesystem file is pulled out to a classmethod ZipInfo.from_file(). Together, these changes make it much easier to control how a

[issue26039] More flexibility in zipfile interface

2016-01-15 Thread Thomas Kluyver
Thomas Kluyver added the comment: Attached is a first go at a patch enabling zipfile.open(blah, mode='w') Files must be written sequentially, so you have to close one writing handle before opening another. If you try to open a second one before closing the first, it will raise RuntimeError. I