[issue5863] bz2.BZ2File should accept other file-like objects. (issue4274045)

2011-04-07 Thread Jesús Cea Avión
Changes by Jesús Cea Avión j...@jcea.es: -- nosy: +jcea ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5863 ___ ___ Python-bugs-list mailing list

[issue5863] bz2.BZ2File should accept other file-like objects. (issue4274045)

2011-04-03 Thread Roundup Robot
Roundup Robot devnull@devnull added the comment: New changeset 2cb07a46f4b5 by Antoine Pitrou in branch 'default': Issue #5863: Rewrite BZ2File in pure Python, and allow it to accept http://hg.python.org/cpython/rev/2cb07a46f4b5 -- nosy: +python-dev

[issue5863] bz2.BZ2File should accept other file-like objects. (issue4274045)

2011-04-03 Thread Antoine Pitrou
Antoine Pitrou pit...@free.fr added the comment: Thank you very much, Nadeem. The patch is now in. -- resolution: - fixed stage: patch review - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org

[issue5863] bz2.BZ2File should accept other file-like objects. (issue4274045)

2011-04-03 Thread Oliver Deppert
Oliver Deppert oliver.depp...@stud.tu-darmstadt.de added the comment: Hi, thanks for the patch. Could you also publish a version for older python 2.x ? regards, Olli -- nosy: +Kontr-Olli ___ Python tracker rep...@bugs.python.org

[issue5863] bz2.BZ2File should accept other file-like objects. (issue4274045)

2011-04-03 Thread Éric Araujo
Éric Araujo mer...@netwok.org added the comment: As a new feature, this can’t go into older versions. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5863 ___

[issue5863] bz2.BZ2File should accept other file-like objects. (issue4274045)

2011-04-02 Thread Nadeem Vawda
Nadeem Vawda nadeem.va...@gmail.com added the comment: Here is an updated patch that adds read1() to BZ2File. This should fix things for issue10791 from the bz2 side. I also took the opportunity to clean up _read_block() to be more readable. As per Martin's suggestion on python-dev, I put the

[issue5863] bz2.BZ2File should accept other file-like objects. (issue4274045)

2011-04-02 Thread Nadeem Vawda
Nadeem Vawda nadeem.va...@gmail.com added the comment: Updated documentation. -- Added file: http://bugs.python.org/file21503/bz2-v5-doc.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5863

[issue5863] bz2.BZ2File should accept other file-like objects. (issue4274045)

2011-04-02 Thread Antoine Pitrou
Antoine Pitrou pit...@free.fr added the comment: Here is an updated patch that adds read1() to BZ2File. This should fix things for issue10791 from the bz2 side. I also took the opportunity to clean up _read_block() to be more readable. As per Martin's suggestion on python-dev, I put the

[issue5863] bz2.BZ2File should accept other file-like objects. (issue4274045)

2011-04-02 Thread Nadeem Vawda
Nadeem Vawda nadeem.va...@gmail.com added the comment: Thanks for the review. I've made most of the changes you suggested, but there's one thing I wanted to check about: - instead of int(size), use size = size.__index__() so as to forbid floats The tests for readline() and readlines() expect

[issue5863] bz2.BZ2File should accept other file-like objects. (issue4274045)

2011-04-02 Thread Antoine Pitrou
Antoine Pitrou pit...@free.fr added the comment: The tests for readline() and readlines() expect a TypeError if size is None. Calling size.__index__() in this case raises an AttributeError instead. Should I change the tests to expect an AttributeError? Alternatively, something like this

[issue5863] bz2.BZ2File should accept other file-like objects. (issue4274045)

2011-04-02 Thread Nadeem Vawda
Nadeem Vawda nadeem.va...@gmail.com added the comment: Here's the updated patch. -- Added file: http://bugs.python.org/file21507/bz2-v6.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5863

[issue5863] bz2.BZ2File should accept other file-like objects. (issue4274045)

2011-04-02 Thread Nadeem Vawda
Nadeem Vawda nadeem.va...@gmail.com added the comment: ... and the corresponding updated documentation patch. -- Added file: http://bugs.python.org/file21508/bz2-v6-doc.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5863

[issue5863] bz2.BZ2File should accept other file-like objects. (issue4274045)

2011-03-30 Thread Antoine Pitrou
Antoine Pitrou pit...@free.fr added the comment: Nadeem, Can I ask that you not commit this patch until the CA has been submitted? I will need to clear it with my employer, and it might complicate things if the code in question has already been committed. Apparently the PSF has received

[issue5863] bz2.BZ2File should accept other file-like objects. (issue4274045)

2011-03-30 Thread Nadeem Vawda
Nadeem Vawda nadeem.va...@gmail.com added the comment: Apparently the PSF has received your contributor agreement. Great; I was just about to send them an email to check. Does it mean the situation is cleared? I plan to do a review of your latest patch. Yes, everything's sorted out. Go

[issue5863] bz2.BZ2File should accept other file-like objects. (issue4274045)

2011-03-24 Thread Andrew Svetlov
Changes by Andrew Svetlov andrew.svet...@gmail.com: -- nosy: +asvetlov ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5863 ___ ___ Python-bugs-list

[issue5863] bz2.BZ2File should accept other file-like objects. (issue4274045)

2011-03-21 Thread Nadeem Vawda
Nadeem Vawda nadeem.va...@gmail.com added the comment: From the discussion on python-dev, it seems that I will need to submit a Contributor Agreement to the PSF. Can I ask that you not commit this patch until the CA has been submitted? I will need to clear it with my employer, and it might

[issue5863] bz2.BZ2File should accept other file-like objects. (issue4274045)

2011-03-21 Thread Antoine Pitrou
Antoine Pitrou pit...@free.fr added the comment: From the discussion on python-dev, it seems that I will need to submit a Contributor Agreement to the PSF. Can I ask that you not commit this patch until the CA has been submitted? I will need to clear it with my employer, and it might

[issue5863] bz2.BZ2File should accept other file-like objects. (issue4274045)

2011-03-20 Thread Nadeem Vawda
Nadeem Vawda nadeem.va...@gmail.com added the comment: Here is an updated patch, incorporating the feedback from your review. The new patch no longer checks for errors in bz2CompressEnd()/bz2DecompressEnd() in the dealloc functions for BZ2Compressor/BZ2Decompressor. I found that calling

[issue5863] bz2.BZ2File should accept other file-like objects. (issue4274045)

2011-03-20 Thread Nadeem Vawda
Nadeem Vawda nadeem.va...@gmail.com added the comment: Corresponding patch for the module docs. -- Added file: http://bugs.python.org/file21315/bz2-v4-doc.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5863

[issue5863] bz2.BZ2File should accept other file-like objects. (issue4274045)

2011-03-19 Thread Antoine Pitrou
Antoine Pitrou pit...@free.fr added the comment: Given the absence of response on python-dev, I'd say simply remove the obsolete copyright notice. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5863

[issue5863] bz2.BZ2File should accept other file-like objects. (issue4274045)

2011-03-14 Thread Michiel de Hoon
Michiel de Hoon mdeh...@users.sourceforge.net added the comment: Would it be possible to add an open() function to the bz2 module? Currently gzip has such a function, but bz2 does not: import gzip gzip.open function open at 0x781f0 import bz2 bz2.open Traceback (most recent call last):

[issue5863] bz2.BZ2File should accept other file-like objects. (issue4274045)

2011-03-14 Thread Antoine Pitrou
Antoine Pitrou pit...@free.fr added the comment: Would it be possible to add an open() function to the bz2 module? Currently gzip has such a function, but bz2 does not: Well, it could be a topic for a separate issue. -- ___ Python tracker

[issue5863] bz2.BZ2File should accept other file-like objects. (issue4274045)

2011-03-14 Thread Nadeem Vawda
Nadeem Vawda nadeem.va...@gmail.com added the comment: Would it be possible to add an open() function to the bz2 module? Yes, it would be quite trivial, though I don't think it would be worthwhile - all it would do is provide a direct alias for the BZ2File constructor. But as Antoine said,

[issue5863] bz2.BZ2File should accept other file-like objects. (issue4274045)

2011-03-14 Thread Antoine Pitrou
Antoine Pitrou pit...@free.fr added the comment: Regarding the use of PY_SSIZE_T_CLEAN, I assume that Py_ssize_t is to be preferred over plain ssize_t. Is this correct? Yes, ssize_t doesn't exist everywhere AFAIK. (size_t does, or at least we assume it does) Also, I was wondering whether I

[issue5863] bz2.BZ2File should accept other file-like objects. (issue4274045)

2011-03-14 Thread Nadeem Vawda
Nadeem Vawda nadeem.va...@gmail.com added the comment: Well, I would personally advocate not re-adding a license boilerplate, since it doesn't serve a purpose (nearly all of Python is freely usable under the PSF License, and the authors are documented by version control). That sounds

[issue5863] bz2.BZ2File should accept other file-like objects.

2011-03-13 Thread Antoine Pitrou
Antoine Pitrou pit...@free.fr added the comment: Review posted at http://codereview.appspot.com/4274045/ -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5863 ___

[issue5863] bz2.BZ2File should accept other file-like objects. (issue4274045)

2011-03-13 Thread Antoine Pitrou
Antoine Pitrou pit...@free.fr added the comment: Reviewers: nadeem vawda nadeem.vawda_gmail.com, http://codereview.appspot.com/4274045/diff/1/Lib/bz2.py File Lib/bz2.py (right): http://codereview.appspot.com/4274045/diff/1/Lib/bz2.py#newcode25 Lib/bz2.py:25: class BZ2File: Is there any reason

[issue5863] bz2.BZ2File should accept other file-like objects. (issue4274045)

2011-03-13 Thread Nadeem Vawda
Nadeem Vawda nadeem.va...@gmail.com added the comment: Thanks for the review. I'll try and have an updated patch ready by next weekend. Regarding your comments: Is there any reason it doesn't inherit io.BufferedIOBase? No, there isn't; I'll fix that in my revised patch. Since this is a new

[issue5863] bz2.BZ2File should accept other file-like objects.

2011-03-11 Thread Antoine Pitrou
Antoine Pitrou pit...@free.fr added the comment: Patch posted for review at http://codereview.appspot.com/4274045/. Still have to do a review though :) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5863

[issue5863] bz2.BZ2File should accept other file-like objects.

2011-02-08 Thread Nadeem Vawda
Nadeem Vawda nadeem.va...@gmail.com added the comment: Here's a revised version of bz2-v3.diff, with docstrings that are more consistent with the updated documentation. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5863

[issue5863] bz2.BZ2File should accept other file-like objects.

2011-02-08 Thread Nadeem Vawda
Nadeem Vawda nadeem.va...@gmail.com added the comment: Weird, the patch didn't upload... -- Added file: http://bugs.python.org/file20721/bz2-v3b.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5863

[issue5863] bz2.BZ2File should accept other file-like objects.

2011-02-05 Thread Nadeem Vawda
Nadeem Vawda nadeem.va...@gmail.com added the comment: Here's an update to the documentation for the bz2 module. -- Added file: http://bugs.python.org/file20692/bz2-doc.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5863

[issue5863] bz2.BZ2File should accept other file-like objects.

2011-01-30 Thread Nadeem Vawda
Nadeem Vawda nadeem.va...@gmail.com added the comment: OK, I've rewritten the whole bz2 module (patch attached), and I think it is now ready for review. The BZ2File implementation is a cleaned-up version of the one from my previous patch, with some further additions. I've factored out the

[issue5863] bz2.BZ2File should accept other file-like objects.

2011-01-26 Thread Antoine Pitrou
Antoine Pitrou pit...@free.fr added the comment: * The read*() methods are implemented very inefficiently. Since they have to deal with the bytes objects returned by BZ2Decompressor.decompress(), a large read results in lots of allocations that weren't necessary in the C implementation. It

[issue5863] bz2.BZ2File should accept other file-like objects.

2011-01-26 Thread Nadeem Vawda
Nadeem Vawda nadeem.va...@gmail.com added the comment: * The read*() methods are implemented very inefficiently. Since they have to deal with the bytes objects returned by BZ2Decompressor.decompress(), a large read results in lots of allocations that weren't necessary in the C

[issue5863] bz2.BZ2File should accept other file-like objects.

2011-01-25 Thread Antoine Pitrou
Antoine Pitrou pit...@free.fr added the comment: Interesting! If you are motivated, a further approach would be to expose the compressor and decompressor objects from the C extension, and write the file object in Python (as in Lib/gzip.py). One thing I was unsure of is how to handle

[issue5863] bz2.BZ2File should accept other file-like objects.

2011-01-25 Thread Nadeem Vawda
Nadeem Vawda nadeem.va...@gmail.com added the comment: Interesting! If you are motivated, a further approach would be to expose the compressor and decompressor objects from the C extension, and write the file object in Python (as in Lib/gzip.py). I had initially considered doing something

[issue5863] bz2.BZ2File should accept other file-like objects.

2011-01-25 Thread Nadeem Vawda
Nadeem Vawda nadeem.va...@gmail.com added the comment: * I had initially considered doing something *like* that -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5863 ___

[issue5863] bz2.BZ2File should accept other file-like objects.

2011-01-25 Thread Antoine Pitrou
Antoine Pitrou pit...@free.fr added the comment: How would I go about doing this? Would it be sufficient to raise a DeprecationWarning if the argument is provided by the caller, and add a note to the docstring and documentation? Yes, totally. --

[issue5863] bz2.BZ2File should accept other file-like objects.

2011-01-25 Thread Nadeem Vawda
Nadeem Vawda nadeem.va...@gmail.com added the comment: Here is a quick-and-dirty reimplementation of BZ2File in Python, on top of the existing C implementation of BZ2Compressor and BZ2Decompressor. There are a couple of issues with this code that need to be fixed: * BZ2Decompressor doesn't

[issue5863] bz2.BZ2File should accept other file-like objects.

2011-01-24 Thread Nadeem Vawda
Nadeem Vawda nadeem.va...@gmail.com added the comment: Here is a patch that rewrites BZ2File to implement the requested feature, and adds some tests using BytesIO objects. Some notes: * iteration and the read*() method now use the same buffering machinery, so they can be mixed freely. The

[issue5863] bz2.BZ2File should accept other file-like objects.

2011-01-24 Thread Anthony Long
Anthony Long antl...@gmail.com added the comment: Are there tests for this? -- nosy: +antlong ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5863 ___

[issue5863] bz2.BZ2File should accept other file-like objects.

2011-01-24 Thread Nadeem Vawda
Nadeem Vawda nadeem.va...@gmail.com added the comment: Yes, see bz2module-v1.diff. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5863 ___ ___

[issue5863] bz2.BZ2File should accept other file-like objects.

2011-01-21 Thread Nadeem Vawda
Nadeem Vawda nadeem.va...@gmail.com added the comment: I have been working on a patch for this issue. I've implemented everything except for readline(), readlines() and the iterator protocol. In the existing implementation, the reading methods seem to interact weirdly - iternext() uses a

[issue5863] bz2.BZ2File should accept other file-like objects.

2011-01-13 Thread wrobell
wrobell wrob...@pld-linux.org added the comment: A use case wget -O http://planet.openstreetmap.org/planet-110112.osm.bz2 | tee planet.bz2 | osm2sql | psql osm planet-*osm.bz2 files are 14GB at the moment. it would be great to read them from stdin while downloading from a server and

[issue5863] bz2.BZ2File should accept other file-like objects.

2011-01-13 Thread Éric Araujo
Éric Araujo mer...@netwok.org added the comment: We’ve already agreed the feature is desirable; what’s missing is a patch, not user stories :) -- nosy: +niemeyer versions: +Python 3.3 -Python 3.2 ___ Python tracker rep...@bugs.python.org

[issue5863] bz2.BZ2File should accept other file-like objects.

2011-01-13 Thread wrobell
wrobell wrob...@pld-linux.org added the comment: OK! :) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5863 ___ ___ Python-bugs-list mailing

[issue5863] bz2.BZ2File should accept other file-like objects.

2010-12-14 Thread Xuanji Li
Xuanji Li xua...@gmail.com added the comment: Sorry, I'm giving up. The copyright notice for bz2module.c lists Gustavo Niemeyer as one of the holders, is he the maintainer? Maybe he should be notified of this bug. -- ___ Python tracker

[issue5863] bz2.BZ2File should accept other file-like objects.

2010-12-14 Thread Antoine Pitrou
Antoine Pitrou pit...@free.fr added the comment: Sorry, I'm giving up. Indeed, I think only an extensive rewrite could fulfill the feature request here. The copyright notice for bz2module.c lists Gustavo Niemeyer as one of the holders, is he the maintainer? Maybe he should be notified of

[issue5863] bz2.BZ2File should accept other file-like objects.

2010-12-04 Thread Xuanji Li
Xuanji Li xua...@gmail.com added the comment: I'll try working on a patch. -- nosy: +xuanji ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5863 ___

[issue5863] bz2.BZ2File should accept other file-like objects.

2010-11-29 Thread MizardX
MizardX miza...@gmail.com added the comment: Would if I could. But, No. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5863 ___ ___

[issue5863] bz2.BZ2File should accept other file-like objects.

2010-11-29 Thread Éric Araujo
Éric Araujo mer...@netwok.org added the comment: That’s a perfectly fine reply. Someone will see this feature request and propose a patch eventually. Another way to help is to write tests, since those are in Python. -- ___ Python tracker

[issue5863] bz2.BZ2File should accept other file-like objects.

2010-11-29 Thread Antoine Pitrou
Antoine Pitrou pit...@free.fr added the comment: For the record, this will need a comprehensive rewrite of bz2module, since it uses FILE pointers right now. -- nosy: +pitrou ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5863

[issue5863] bz2.BZ2File should accept other file-like objects.

2010-11-29 Thread Raymond Hettinger
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: Without a patch and compelling use cases, this has no chance. Recommend closing. -- nosy: +rhettinger ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5863

[issue5863] bz2.BZ2File should accept other file-like objects.

2010-11-29 Thread Nadeem Vawda
Changes by Nadeem Vawda nadeem.va...@gmail.com: -- nosy: +nvawda ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5863 ___ ___ Python-bugs-list

[issue5863] bz2.BZ2File should accept other file-like objects.

2010-11-27 Thread Éric Araujo
Éric Araujo mer...@netwok.org added the comment: Do you want to work on patch? -- components: +Extension Modules -IO, Library (Lib) nosy: +eric.araujo stage: unit test needed - needs patch ___ Python tracker rep...@bugs.python.org

[issue5863] bz2.BZ2File should accept other file-like objects.

2010-07-10 Thread Mark Lawrence
Changes by Mark Lawrence breamore...@yahoo.co.uk: -- stage: - unit test needed versions: +Python 3.2 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5863 ___

[issue5863] bz2.BZ2File should accept other file-like objects.

2009-04-27 Thread MizardX
New submission from MizardX miza...@gmail.com: bz2.BZ2File should, like gzip.GzipFile, accept a fileobj argument. If implemented, you could much more easily pipe BZ2-data from other sources, such as stdin or a socket. -- components: IO, Library (Lib) messages: 86716 nosy: MizardX