summaryrefslogtreecommitdiff
path: root/Modules/zlibmodule.c
AgeCommit message (Collapse)AuthorLines
2002-04-19[backport bug fix from the trunk]Jeremy Hylton-0/+1
Fix SF #544995 (zlib crash on second flush call) Bug fix by mhammond. Bug fix candidate for 2.2, not present in 2.1.
2001-12-08Patch supplied by Burton Radons for his own SF bug #487390: ModifyingGuido van Rossum-2/+2
type.__module__ behavior. This adds the module name and a dot in front of the type name in every type object initializer, except for built-in types (and those that already had this). Note that it touches lots of Mac modules -- I have no way to test these but the changes look right. Apologies if they're not. This also touches the weakref docs, which contains a sample type object initializer. It also touches the mmap test output, because the mmap type's repr is included in that output. It touches object.h to put the correct description in a comment.
2001-10-23Added missing cast.Jack Jansen-1/+1
2001-10-17Remove unused convenience routine.Jeremy Hylton-19/+0
2001-10-17Simplify and regularize docstrings. Also reformat so that each docstringTim Peters-52/+47
line fits in reasonable screen width.
2001-10-17Trimmed trailing whitespace.Tim Peters-62/+62
2001-10-17Removed more comments that didn't make much sense.Tim Peters-17/+1
Made the presence/absence of a semicolon after macros consistent.
2001-10-17Removed obsolete comments about confused string refcount tricks (JeremyTim Peters-9/+4
removed the tricks). Changed the ENTER/LEAVE_ZLIB macros so as not to create a new block (a new block is neither necessary nor helpful).
2001-10-16Undo needless INCREF chicanery introduced by SF patch #450702.Jeremy Hylton-47/+15
Apparently this patch (rev 2.41) replaced all the good old "s#" formats in PyArg_ParseTuple() with "S". Then it did PyString_FromStringAndSize() to get back the values setup by the "s#" format. It also incref'd and decref'd the string obtained by "S" even though the argument tuple had a reference to it. Replace PyString_AsString() calls with PyString_AS_STRING(). A good rule of thumb -- if you never check the return value of PyString_AsString() to see if it's NULL, you ought to be using the macro <wink>.
2001-10-16Simplify and fix error handling for most cases.Jeremy Hylton-166/+112
Many functions used a local variable called return_error, which was initialized to zero. If an error occurred, it was set to true. Most of the code paths checked were only executed if return_error was false. goto is clearer. The code also seemed to be written under the curious assumption that calling Py_DECREF() on a local variable would assign the variable to NULL. As a result, more of the error-exit code paths returned an object that had a reference count of zero instead of just returning NULL. Fixed the code to explicitly assign NULL after the DECREF. A bit more reformatting, but not much. XXX Need a much better test suite for zlib, since it the current tests don't exercise any of this broken code.
2001-10-16More reformatting.Jeremy Hylton-49/+48
2001-10-16Add zlib_error() helper.Jeremy Hylton-92/+25
It sets a ZlibError exception, using the msg from the z_stream pointer if one is available.
2001-10-16Remove many calls to set MemoryError exceptions.Jeremy Hylton-28/+4
When PyString_FromStringAndSize() and _PyString_Resize() fail, they set an exception. There's no need to set a new exception.
2001-10-16Reformat!Jeremy Hylton-572/+562
Consistently indent 4 spaces. Use whitespace around operators. Put braces in the right places.
2001-10-16[ #403753 ] zlib decompress; uncontrollable memory usageJeremy Hylton-10/+64
Mostly by Toby Dickenson and Titus Brown. Add an optional argument to a decompression object's decompress() method. The argument specifies the maximum length of the return value. If the uncompressed data exceeds this length, the excess data is stored as the unconsumed_tail attribute. (Not to be confused with unused_data, which is a separate issue.) Difference from SF patch: Default value for unconsumed_tail is "" rather than None. It's simpler if the attribute is always a string.
2001-10-09Update URL. Fixes bug #468118.Martin v. Löwis-1/+1
2001-09-08Silence warnings about passing unsigned char** as char**.Martin v. Löwis-4/+4
2001-09-07Patch #450702: allow threads when calling into zlib, protect usage ofMartin v. Löwis-114/+350
the module in multiple threads with a global lock.
2001-02-22Patch #103926: fix two warnings from Tru64's compilerAndrew M. Kuchling-1/+1
2001-02-21Patch #103373 from Donovan Baarda: This patch:Andrew M. Kuchling-194/+131
* fixes the zlib decompress sync flush bug as reported in bug #124981 * avoids repeat calls to (in|de)flateEnd when destroying (de)compression objects * raises exception when allocating unused_data fails * fixes memory leak when allocating unused_data fails * raises exception when allocating decompress data fails * removes vestigial code from decompress flush now that decompression returns all available data * tidies code so object compress/decompress/flush routines are consistent
2001-01-31Docs for new Windows zlib build procedure.Tim Peters-8/+1
2001-01-31Fix [ Bug #129293 ] zlib library used for binary win32 distribution can crashMark Hammond-2/+11
This involves changing the zlib build process to build zlib itself from sources, then use that library. Also updated are the comments to reflect the new official home of zlib, and add Windows specific notes regarding the build process.
2000-10-09Patch #101810: check whether zst.avail_out is non-zero when gettingAndrew M. Kuchling-1/+15
a Z_BUF_ERROR while decompressing. If it is, assume that this means the data being decompressed is bad and raise an exception, instead of just assuming that Z_BUF_ERROR always means that more space is required.
2000-08-03Use METH_VARARGS instead of numeric constant 1Andrew M. Kuchling-12/+22
2000-07-21Bunch of minor ANSIfications: 'void initfunc()' -> 'void initfunc(void)',Thomas Wouters-1/+1
and a couple of functions that were missed in the previous batches. Not terribly tested, but very carefully scrutinized, three times. All these were found by the little findkrc.py that I posted to python-dev, which means there might be more lurking. Cases such as this: long func(a, b) long a; long b; /* flagword */ { and other cases where the last ; in the argument list isn't followed by a newline and an opening curly bracket. Regexps to catch all are welcome, of course ;)
2000-07-10ANSI-ficationPeter Schneider-Kamp-44/+16
2000-05-03Vladimir Marangozov's long-awaited malloc restructuring.Guido van Rossum-3/+3
For more comments, read the patches@python.org archives. For documentation read the comments in mymalloc.h and objimpl.h. (This is not exactly what Vladimir posted to the patches list; I've made a few changes, and Vladimir sent me a fix in private email for a problem that only occurs in debug mode. I'm also holding back on his change to main.c, which seems unnecessary to me.)
2000-04-06Windows: Since we're not using ZLIB.DLL any more, don't define ZLIB_DLL.Guido van Rossum-3/+0
(Mark Hammond.)
2000-02-29Massive patch by Skip Montanaro to add ":name" to as manyGuido van Rossum-9/+9
PyArg_ParseTuple() format string arguments as possible.
1999-12-22For ZlibError and ZLIB_VERSION, only attempt to add entry to theFred Drake-3/+6
module dict if the inserted object isn't NULL (basic defensive programming!).
1999-12-20Fix typo in docstring: wbites -> wbitsAndrew M. Kuchling-1/+1
1999-04-12Cast added by Jack Jansen (for Mac port).Guido van Rossum-1/+2
1999-04-07Patch by Andrew Kuchling to unflush() (flush() for deflating).Guido van Rossum-4/+8
Without this, if inflate() returned Z_BUF_ERROR asking for more output space, we would report the error; now, we increase the buffer size and try again, just as for Z_OK.
1999-03-25Add an .unused_data attribute to decompressor objects. If .unused_dataAndrew M. Kuchling-0/+22
is not an empty string, this means that you have arrived at the end of the stream of compressed data, and the contents of .unused_data are whatever follows the compressed stream.
1999-03-22Fixed the flush() method of compression objects; the test forAndrew M. Kuchling-12/+29
the end of loop was incorrect, and failed when the flushmode != Z_FINISH. Logic cleaned up and commented.
1999-01-29Added missing DECREF's in the error branches when creating a compressor orAndrew M. Kuchling-1/+12
decompressor object. This required adding a flag to the struct which is true if initialisation was completed; on object destruction, deflateEnd() is only called if the flag is true.
1999-01-28PyInit_zlib(): Plug a small memory leak. Jeremy is looking into theBarry Warsaw-0/+1
more severe ones.
1999-01-06fix bug in PyZlib_flush.Jeremy Hylton-4/+4
patch from Grzegorz Makarewicz & Rafal Smotrzyk.
1998-12-21replace missing zalloc initialization (test_zlib now runsJeremy Hylton-0/+1
successfully)
1998-12-21remove debugging fprintf (should have checked this before previousJeremy Hylton-2/+0
checkin)
1998-12-18patches from AndrewJeremy Hylton-23/+51
NOTE: There is still a bug of some sort in the behavior of zlib. In at least one case, inflate returns Z_OK (which is typically interpreted to mean that more output space is needed) when it has finished inflating a buffer. This has been reported as a bug to the zlib maintainers; we may need to change the Python interface.
1998-12-18When _PyString_Resize() reports failure, the variable referring to theFred Drake-5/+0
string we wanted to resize is set to NULL. Don't Py_DECREF() those variables! (5 places)
1998-12-04Add DL_EXPORT() to all modules that could possibly be usedGuido van Rossum-1/+1
on BeOS or Windows.
1998-07-07Fix benign problems found by a picky SGI compiler (unreachable breakGuido van Rossum-11/+0
after a return).
1998-05-08Added URLs for zlib's home page and the Windows DLL's home page .Guido van Rossum-0/+2
1998-04-23Tiny patch for zlib 1.1.2Guido van Rossum-0/+1
1997-12-18Win32 treatment.Guido van Rossum-2/+7
1997-10-01Apply two changes, systematically:Guido van Rossum-4/+1
(1) Use PyErr_NewException("module.class", NULL, NULL) to create the exception object. (2) Remove all calls to Py_FatalError(); instead, return or ignore the errors -- the import code now checks PyErr_Occurred() after calling a module's init function, so it's no longer a fatal error for the initialization to fail. Also did some small cleanups, e.g. removed unnecessary test for "already initialized" from initfpectl(), and unified initposix()/initnt(). I haven't checked this very thoroughly, so while the changes are pretty trivial -- beware of untested code!
1997-09-04Several changes:Jeremy Hylton-125/+188
1. Fix bug in (de)compression objects. The final string resize used zst.total_out to determine the length of the string, but the (de)compression object will output data a little bit at a time, which means total_out is not the string size. Fix: save original value of total_out at the start of the call. 2. Be sure to Py_DECREF the result value if you exit with an exception. 3. Use PyInt_FromLong instead of Py_BuildValue 4. include more constants from the zlib header file 5. Use PyErr_Format instead of using a local buffer and sprintf.
1997-09-03Plug small leaks: the [de]compress object itself was never freed.Guido van Rossum-0/+2