The attached patch adds a copy() method to zlib's compressobj and decompressobj. Copying a (de)compression object allows a developer to store the state of the (de)compressor at a certain point of the input stream in order to more efficiently compress data sharing some identical header, or to more efficiently seek inside compressed data. Doc/lib/libzlib.tex is updated with descriptions for the new methods. Lib/test/test_zlib.py is updated to test the new functionality. The patch is against revision 42524 in http://svn.python.org/projects/python/trunk
Logged In: YES user_id=33168 You need to check the return result of newcompobject(). This would crash if it returns NULL. You also need to change METH_VARARGS to METH_NOARGS since these methods don't take any arguments. The doc should contain \versionadded{2.5} before the end markers for new methods.
Logged In: YES user_id=186532 New patch attached with the mentioned changes made. I noticed that PyZlib_unflush() takes an argument, but that its use is not documented. Should the docs be updated to explain what that argument is for?