summaryrefslogtreecommitdiffstats
path: root/Modules/zlibmodule.c
Commit message (Collapse)AuthorAgeFilesLines
* Issue #8681: Make the zlib module's error messages more informative whenAntoine Pitrou2010-05-111-4/+17
| | | | the zlib itself doesn't give any detailed explanation.
* Untabify C files. Will watch buildbots.Antoine Pitrou2010-05-091-237/+237
|
* Issue #8571: Fix an internal error when compressing or decompressing aAntoine Pitrou2010-05-071-3/+4
| | | | | chunk larger than 1GB with the zlib module's compressor and decompressor objects.
* This reverts r63675 based on the discussion in this thread:Gregory P. Smith2008-06-091-32/+32
| | | | | | | http://mail.python.org/pipermail/python-dev/2008-June/079988.html Python 2.6 should stick with PyString_* in its codebase. The PyBytes_* names in the spirit of 3.0 are available via a #define only. See the email thread.
* Renamed PyString to PyBytesChristian Heimes2008-05-261-32/+32
|
* Fix zlib crash from zlib.decompressobj().flush(val) when val was not positive.Gregory P. Smith2008-04-091-0/+4
| | | | It tried to allocate negative or zero memory. That fails.
* Use a 32-bit unsigned int here, a long is not needed.Gregory P. Smith2008-03-251-4/+4
|
* replace calls to get the initial values with the raw constants.Gregory P. Smith2008-03-231-2/+2
|
* Revert r61779 - It undid correct code and caused test_zlib to fail on allGregory P. Smith2008-03-231-4/+2
| | | | | | | | | | | platforms with a 64-bit long. The Alpha/Tru64 test problem is a problem in either tarfile or test_tarfile, not zlib. crc32 and adler32 return 32-bit values. by using a long thats larger than 32-bits in these functions they were prevented from wrapping around to their signed 32-bit value that we want them to return in python 2.x.
* Fix test_tarfile failures on Alpha (Tru64). The problem was caused in r61449Neal Norwitz2008-03-231-2/+4
| | | | | | | which made the return value signed. On the Alpha that also lost data since sizeof(int) != sizeof(long) and apparently adler32/crc32 return 64 bits of data. This change keeps the signedness and continues to store the data in a long rather than an int as was the case before r61449.
* Force zlib.crc32 and zlib.adler32 to return a signed integer on all platformsGregory P. Smith2008-03-171-8/+17
| | | | | | | | | regardless of the native sizeof(long) used in the integer object. This somewhat odd behavior of returning a signed is maintained in 2.x for compatibility reasons of always returning an integer rather than a long object. Fixes Issue1202 for Python 2.6
* #1629: Renamed Py_Size, Py_Type and Py_Refcnt to Py_SIZE, Py_TYPE and ↵Christian Heimes2007-12-191-2/+2
| | | | Py_REFCNT. Macros for b/w compatibility are available.
* Fixed #1372: zlibmodule.c: int overflow in PyZlib_decompressChristian Heimes2007-11-211-2/+3
|
* PEP 3123: Provide forward compatibility with Python 3.0, while keepingMartin v. Löwis2007-07-211-6/+4
| | | | | backwards compatibility. Add Py_Refcnt, Py_Type, Py_Size, and PyVarObject_HEAD_INIT.
* Patch #1503046, Conditional compilation of zlib.(de)compressobj.copyNeal Norwitz2006-06-121-0/+6
| | | | | copy is only in newer versions of zlib. This should allow zlibmodule to work with older versions like the Tru64 buildbot.
* PyZlib_copy(), PyZlib_uncopy(): Repair leaks on the normal-case path.Tim Peters2006-05-171-5/+9
|
* Patch #1435422: zlib's compress and decompress objects now have aGeorg Brandl2006-05-161-0/+102
| | | | copy() method.
* Patch #1459631: documnent zlib.Decompress.flush() length parameter.Georg Brandl2006-04-011-1/+3
|
* Check return result from Py_InitModule*(). This API can fail.Neal Norwitz2006-01-191-0/+2
| | | | Probably should be backported.
* [Patch #1350573] zlib.crc32 doesn't handle 0xffffffff seed. Add tests and ↵Andrew M. Kuchling2005-11-221-2/+2
| | | | bugfix. Bug reported by John Schmidt; bugfix by Danny Yoo.
* [Bug #1083110] calling .flush() on decompress objects causes a segfault due ↵Andrew M. Kuchling2004-12-281-1/+5
| | | | to an uninitialized pointer: fixes the problem and adds a test case
* - Thanks to Scott David Daniels, a subtle bug in how the zlibGuido van Rossum2003-02-031-12/+45
| | | | | | | | extension implemented flush() was fixed. Scott also rewrite the zlib test suite using the unittest module. (SF bug #640230 and patch #678531.) Backport candidate I think.
* Replace DL_IMPORT with PyMODINIT_FUNC and remove "/export:init..." linkMark Hammond2002-07-231-1/+1
| | | | | command line for Windows builds. This should allow MSVC to import and build the Python MSVC6 project files without error.
* Removed more stray instances of statichere, but left _sre.c alone.Tim Peters2002-07-171-2/+2
|
* staticforward bites the dust.Jeremy Hylton2002-07-171-2/+2
| | | | | | | | | | | | | | | The staticforward define was needed to support certain broken C compilers (notably SCO ODT 3.0, perhaps early AIX as well) botched the static keyword when it was used with a forward declaration of a static initialized structure. Standard C allows the forward declaration with static, and we've decided to stop catering to broken C compilers. (In fact, we expect that the compilers are all fixed eight years later.) I'm leaving staticforward and statichere defined in object.h as static. This is only for backwards compatibility with C extensions that might still use it. XXX I haven't updated the documentation.
* Patch #568124: Add doc string macros.Martin v. Löwis2002-06-131-22/+22
|
* Repair widespread misuse of _PyString_Resize. Since it's clear peopleTim Peters2002-04-271-18/+7
| | | | | | | | | | | | | | | | | | | | | | don't understand how this function works, also beefed up the docs. The most common usage error is of this form (often spread out across gotos): if (_PyString_Resize(&s, n) < 0) { Py_DECREF(s); s = NULL; goto outtahere; } The error is that if _PyString_Resize runs out of memory, it automatically decrefs the input string object s (which also deallocates it, since its refcount must be 1 upon entry), and sets s to NULL. So if the "if" branch ever triggers, it's an error to call Py_DECREF(s): s is already NULL! A correct way to write the above is the simpler (and intended) if (_PyString_Resize(&s, n) < 0) goto outtahere; Bugfix candidate.
* Fix SF #544995 (zlib crash on second flush call)Jeremy Hylton2002-04-191-0/+1
| | | | | | Bug fix by mhammond. Bug fix candidate for 2.2, not present in 2.1.
* Use the PyModule_Add*() APIs instead of manipulating the module dictFred Drake2002-04-011-9/+8
| | | | directly.
* Changed C++ comment into standard comment.Sjoerd Mullender2002-03-111-1/+1
|
* Patch supplied by Burton Radons for his own SF bug #487390: ModifyingGuido van Rossum2001-12-081-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.
* Added missing cast.Jack Jansen2001-10-231-1/+1
|
* Remove unused convenience routine.Jeremy Hylton2001-10-171-19/+0
|
* Simplify and regularize docstrings. Also reformat so that each docstringTim Peters2001-10-171-52/+47
| | | | line fits in reasonable screen width.
* Trimmed trailing whitespace.Tim Peters2001-10-171-62/+62
|
* Removed more comments that didn't make much sense.Tim Peters2001-10-171-17/+1
| | | | Made the presence/absence of a semicolon after macros consistent.
* Removed obsolete comments about confused string refcount tricks (JeremyTim Peters2001-10-171-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).
* Undo needless INCREF chicanery introduced by SF patch #450702.Jeremy Hylton2001-10-161-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>.
* Simplify and fix error handling for most cases.Jeremy Hylton2001-10-161-167/+113
| | | | | | | | | | | | | | | | | | 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.
* More reformatting.Jeremy Hylton2001-10-161-51/+50
|
* Add zlib_error() helper.Jeremy Hylton2001-10-161-92/+25
| | | | | It sets a ZlibError exception, using the msg from the z_stream pointer if one is available.
* Remove many calls to set MemoryError exceptions.Jeremy Hylton2001-10-161-28/+4
| | | | | When PyString_FromStringAndSize() and _PyString_Resize() fail, they set an exception. There's no need to set a new exception.
* Reformat!Jeremy Hylton2001-10-161-586/+576
| | | | | | Consistently indent 4 spaces. Use whitespace around operators. Put braces in the right places.
* [ #403753 ] zlib decompress; uncontrollable memory usageJeremy Hylton2001-10-161-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.
* Update URL. Fixes bug #468118.Martin v. Löwis2001-10-091-1/+1
|
* Silence warnings about passing unsigned char** as char**.Martin v. Löwis2001-09-081-4/+4
|
* Patch #450702: allow threads when calling into zlib, protect usage ofMartin v. Löwis2001-09-071-114/+350
| | | | the module in multiple threads with a global lock.
* Patch #103926: fix two warnings from Tru64's compilerAndrew M. Kuchling2001-02-221-1/+1
|
* Patch #103373 from Donovan Baarda: This patch:Andrew M. Kuchling2001-02-211-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
* Docs for new Windows zlib build procedure.Tim Peters2001-01-311-8/+1
|