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.

Author pitrou
Recipients MizardX, antlong, eric.araujo, nadeem.vawda, niemeyer, pitrou, rhettinger, wrobell, xuanji
Date 2011-03-13.17:39:54
SpamBayes Score 5.2502447e-13
Marked as misclassified No
Message-id <>
Reviewers: nadeem vawda <>,
File Lib/ (right):
Lib/ class BZ2File:
Is there any reason it doesn't inherit io.BufferedIOBase?
(it should also bring you a couple of methods implemented for free:
readlines, writelines, __iter__, __next__, __enter__, __exit__)

You should probably also implement fileno() (simply return
self.fp.fileno()) and the `closed` property.
Lib/ class BZ2Compressor:
I don't think there's a point in a Python wrapper, since the wrapper is
so trivial. Just do the lock operations in C.
Same for BZ2Decompressor.
File Modules/_bz2module.c (left):
Modules/_bz2module.c:123: #ifdef WITH_THREAD
As mentioned in Lib/, I would keep the lock on the C side since it
isn't significantly more complicated, and it avoids having to write a
Python wrapper around the compressor and decompressor types.
File Modules/_bz2module.c (right):
Modules/_bz2module.c:3: #include "Python.h"
Since this is a new start, perhaps we should add
   #define PY_SSIZE_T_CLEAN
before including "Python.h"?
This will ensure no code in the module will rely on the old behaviour.
Modules/_bz2module.c:48: "libbzip2 was not compiled correctly");
Just a nit, but I'm not sure there's any point in renaming "the bz2
library" to "libbzip2"?
(also, under Windows I'm not sure the library naming convention is the
same as under Unix)
Modules/_bz2module.c:78: "Unrecognized error from libbzip2: %d",
Out of curiousity, did you encounter this condition?
Modules/_bz2module.c:122: c->bzs.avail_out = PyBytes_GET_SIZE(result);
Do note that avail_in and avail_out are 32-bit ints, and therefore this
is not 64-bit clean. I guess you're just copying the old code here, but
that would deserve a separate patch later. Perhaps add a comment in the
Modules/_bz2module.c:209: "Provide a block of data to the compressor."},
You could instead re-use the old, more precise docstrings. Also, using
PyDoc_STRVAR is preferred so as to make it easier to modify multi-line
File (right): exts.append( Extension('_bz2', ['_bz2module.c'],
The Windows build files probably need updating as well. Can you do it?
Otherwise I'll have a try.

Please review this at

Affected files:
   A Lib/
   M Lib/test/
   M Modules/_bz2module.c
Date User Action Args
2011-03-13 17:39:55pitrousetrecipients: + pitrou, rhettinger, niemeyer, wrobell, eric.araujo, MizardX, antlong, xuanji
2011-03-13 17:39:54pitroulinkissue5863 messages
2011-03-13 17:39:54pitroucreate