New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Zlib compress/decompress functions returning bytearray #47742
Comments
>>> import zlib
>>> s='This is a string'
>>> sc=zlib.compress(s)
>>> sc
bytearray(b'x\x9c\x0b\xc9\xc8,V\x00\xa2D\x85\xe2\x92\xa2\xcc\xbct\x00/\xc2\x05\xcd')
>>> zlib.decompress(sc)
bytearray(b'This is a string')
>>> This is wrong behavior as compress functions should return byte |
Hi, I have a patch ready for this to be applied to zlibmodule.c. The |
Could you submit unified diff--i.e., with 'diff -u' or 'svn diff'? Also, could you add tests for this fix? |
Uploading svn diff for zlibmodule.c. Btw, how do I add unit tests for a |
Ok. I added two tests for checking the type of the returned object for Btw, my code uses assertEqual(type(...), bytes). Is this the proper way Attaching the svn diff for test_zlib.py . |
Any updates ? The py3k list is also very silent since the week-end...Thanks! |
Your two patches look good, I suppose either Alexandre or I will commit |
Thanks. Will this make into beta3 ? |
this is a very simple patch and makes sense to me. marking it a release in general IO input functions elsewhere return bytes(). zlib should as |
+1 for committing. |
Two remarks:
|
Correct, zipimport required fixing in order for this to work. The newly review at http://codereview.appspot.com/4454 I haven't had a chance to look at the other modules Amaury mentioned but |
Does py3k list/barry have this bug in their radar for rc2 ? |
On Thu, Sep 4, 2008 at 4:59 PM, Amaury Forgeot d'Arc
Hmmm...but AFAIK zlib changes only affect zipimport directly. I wonder |
Patch looks good to me (I've only looked at the patch - not the other |
We must definitely clean up other uses of bytearray in the extension |
fixed in r66266 along with bpo-3790. leaving this open and assigned to me while i investigate the other uses IMHO, its fine if we fix any remaining bytearray uses up for rc2. |
issue bpo-3797 has been opened to track the other files mentioned. |
Hi Gregory,
patches on various platforms. Regards, --Anand |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: