summaryrefslogtreecommitdiffstats
path: root/Modules/_lzmamodule.c
Commit message (Collapse)AuthorAgeFilesLines
* bpo-46541: Remove usage of _Py_IDENTIFIER from lzma module (GH-31683)Dong-hee Na2022-03-041-10/+10
|
* bpo-46541: Replace core use of _Py_IDENTIFIER() with statically initialized ↵Eric Snow2022-02-081-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | global objects. (gh-30928) We're no longer using _Py_IDENTIFIER() (or _Py_static_string()) in any core CPython code. It is still used in a number of non-builtin stdlib modules. The replacement is: PyUnicodeObject (not pointer) fields under _PyRuntimeState, statically initialized as part of _PyRuntime. A new _Py_GET_GLOBAL_IDENTIFIER() macro facilitates lookup of the fields (along with _Py_GET_GLOBAL_STRING() for non-identifier strings). https://bugs.python.org/issue46541#msg411799 explains the rationale for this change. The core of the change is in: * (new) Include/internal/pycore_global_strings.h - the declarations for the global strings, along with the macros * Include/internal/pycore_runtime_init.h - added the static initializers for the global strings * Include/internal/pycore_global_objects.h - where the struct in pycore_global_strings.h is hooked into _PyRuntimeState * Tools/scripts/generate_global_objects.py - added generation of the global string declarations and static initializers I've also added a --check flag to generate_global_objects.py (along with make check-global-objects) to check for unused global strings. That check is added to the PR CI config. The remainder of this change updates the core code to use _Py_GET_GLOBAL_IDENTIFIER() instead of _Py_IDENTIFIER() and the related _Py*Id functions (likewise for _Py_GET_GLOBAL_STRING() instead of _Py_static_string()). This includes adding a few functions where there wasn't already an alternative to _Py*Id(), replacing the _Py_Identifier * parameter with PyObject *. The following are not changed (yet): * stop using _Py_IDENTIFIER() in the stdlib modules * (maybe) get rid of _Py_IDENTIFIER(), etc. entirely -- this may not be doable as at least one package on PyPI using this (private) API * (maybe) intern the strings during runtime init https://bugs.python.org/issue46541
* bpo-45434: pyport.h no longer includes <stdlib.h> (GH-28914)Victor Stinner2021-10-131-0/+1
| | | | | Include <stdlib.h> explicitly in C files. Python.h includes <wchar.h>.
* bpo-45434: bytearrayobject.h no longer includes <stdarg.h> (GH-28913)Victor Stinner2021-10-131-1/+0
| | | | bytearrayobject.h and _lzmamodule.c don't use va_list and so don't need to include <stdarg.h>.
* bpo-43908: Make heap types converted during 3.10 alpha immutable (GH-26351)Erlend Egeberg Aasland2021-06-171-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Make functools types immutable * Multibyte codec types are now immutable * pyexpat.xmlparser is now immutable * array.arrayiterator is now immutable * _thread types are now immutable * _csv types are now immutable * _queue.SimpleQueue is now immutable * mmap.mmap is now immutable * unicodedata.UCD is now immutable * sqlite3 types are now immutable * _lsprof.Profiler is now immutable * _overlapped.Overlapped is now immutable * _operator types are now immutable * winapi__overlapped.Overlapped is now immutable * _lzma types are now immutable * _bz2 types are now immutable * _dbm.dbm and _gdbm.gdbm are now immutable
* bpo-41486: Fix initial buffer size can't > UINT32_MAX in zlib module (GH-25738)Ma Lin2021-04-301-16/+16
| | | | | | | | | | | | | | | | * Fix initial buffer size can't > UINT32_MAX in zlib module After commit f9bedb630e8a0b7d94e1c7e609b20dfaa2b22231, in 64-bit build, if the initial buffer size > UINT32_MAX, ValueError will be raised. These two functions are affected: 1. zlib.decompress(data, /, wbits=MAX_WBITS, bufsize=DEF_BUF_SIZE) 2. zlib.Decompress.flush([length]) This commit re-allows the size > UINT32_MAX. * adds curly braces per PEP 7. * Renames `Buffer_*` to `OutputBuffer_*` for clarity
* bpo-41486: Faster bz2/lzma/zlib via new output buffering (GH-21740)Ma Lin2021-04-281-63/+81
| | | | | | | | | Faster bz2/lzma/zlib via new output buffering. Also adds .readall() function to _compression.DecompressReader class to take best advantage of this in the consume-all-output at once scenario. Often a 5-20% speedup in common scenarios due to less data copying. Contributed by Ma Lin.
* bpo-41052: Fix pickling heap types implemented in C with protocols 0 and 1 ↵Serhiy Storchaka2020-10-241-30/+0
| | | | (GH-22870)
* bpo-1635741: Port _lzma module to multiphase initialization (GH-19382)Dong-hee Na2020-06-221-264/+429
|
* bpo-40268: Remove unused structmember.h includes (GH-19530)Victor Stinner2020-04-151-1/+1
| | | | | | If only offsetof() is needed: include stddef.h instead. When structmember.h is used, add a comment explaining that PyMemberDef is used.
* bpo-40268: Remove explicit pythread.h includes (#19529)Victor Stinner2020-04-151-1/+0
| | | | Remove explicit pythread.h includes: it is always included by Python.h.
* Use calloc-based functions, not malloc. (GH-19152)Andy Lester2020-03-251-6/+3
|
* bpo-40024: Add PyModule_AddType() helper function (GH-19088)Dong-hee Na2020-03-221-10/+4
|
* bpo-21872: fix lzma library decompresses data incompletely (GH-14048)animalize2019-09-121-6/+22
| | | | | | | * 1. add test case with wrong behavior * 2. fix bug when max_length == -1 * 3. allow b"" as valid input data for decompress_buf() * 4. when max_length >= 0, let needs_input mechanism works * add more asserts to test case
* bpo-36974: tp_print -> tp_vectorcall_offset and tp_reserved -> tp_as_async ↵Jeroen Demeyer2019-05-311-4/+4
| | | | | | | | | (GH-13464) Automatically replace tp_print -> tp_vectorcall_offset tp_compare -> tp_as_async tp_reserved -> tp_as_async
* bpo-36254: Fix invalid uses of %d in format strings in C. (GH-12264)Serhiy Storchaka2019-03-131-2/+2
|
* bpo-33138: Change standard error message for non-pickleable and non-copyable ↵Serhiy Storchaka2018-10-311-18/+0
| | | | types. (GH-6239)
* bpo-35090: Fix potential division by zero in allocator wrappers (GH-10174)Alexey Izbyshev2018-10-281-1/+1
| | | | | | | * Fix potential division by zero in BZ2_Malloc() * Avoid division by zero in PyLzma_Malloc() * Avoid division by zero and integer overflow in PyZlib_Malloc() Reported by Svace static analyzer.
* bpo-33916: Fix bz2 and lzma init when called twice (GH-7843)Victor Stinner2018-06-231-2/+6
| | | | bz2, lzma: When Decompressor.__init__() is called twice, free the old lock to not leak memory.
* bpo-31787: Prevent refleaks when calling __init__() more than once (GH-3995)Oren Milman2018-02-131-1/+1
|
* bpo-31370: Remove support for threads-less builds (#3385)Antoine Pitrou2017-09-071-23/+0
| | | | | | * Remove Setup.config * Always define WITH_THREAD for compatibility.
* Spelling fixes (#2902)Ville Skyttä2017-08-031-1/+1
|
* Issue #27517: LZMA compressor and decompressor no longer raise exceptions ifSerhiy Storchaka2016-10-311-0/+5
|\ | | | | | | given empty data twice. Patch by Benjamin Fogle.
| * Issue #27517: LZMA compressor and decompressor no longer raise exceptions ifSerhiy Storchaka2016-10-311-0/+5
| | | | | | | | given empty data twice. Patch by Benjamin Fogle.
* | Issue #28275: Fixed possible use adter free in LZMADecompressor.decompress().Serhiy Storchaka2016-09-271-1/+3
|\ \ | |/ | | | | Original patch by John Leitch.
| * Issue #28275: Fixed possible use adter free in LZMADecompressor.decompress().Serhiy Storchaka2016-09-271-1/+3
| | | | | | | | Original patch by John Leitch.
* | replace PY_LONG_LONG with long longBenjamin Peterson2016-09-061-11/+5
| |
* | - Issue #27332: Fixed the type of the first argument of module-level functionsSerhiy Storchaka2016-07-071-6/+6
|\ \ | |/ | | | | generated by Argument Clinic. Patch by Petr Viktorin.
| * Issue #27332: Fixed the type of the first argument of module-level functionsSerhiy Storchaka2016-07-071-6/+6
| | | | | | | | generated by Argument Clinic. Patch by Petr Viktorin.
* | Issue #27171: Merge typo fixes from 3.5Martin Panter2016-06-021-1/+1
|\ \ | |/
| * Issue #27171: Fix typos in documentation, comments, and test function namesMartin Panter2016-06-021-1/+1
| |
* | Got rid of redundand "self" parameter declarations.Serhiy Storchaka2016-05-021-10/+4
|/ | | | Argument Clinic is now able to infer all needed information.
* Issue #22570: Renamed Py_SETREF to Py_XSETREF.Serhiy Storchaka2016-04-061-1/+1
|
* Issue #20440: Applied yet one patch for using Py_SETREF.Serhiy Storchaka2015-12-271-3/+2
| | | | The patch is automatically generated, it replaces the code that uses Py_CLEAR.
* Issue #23944: Argument Clinic now wraps long impl prototypes at column 78.Larry Hastings2015-04-141-6/+9
|
* Issue #23501: Argumen Clinic now generates code into separate files by default.Serhiy Storchaka2015-04-031-2/+1
|
* Removed unintentional trailing spaces in non-external and non-generated C files.Serhiy Storchaka2015-03-181-10/+10
|
* Regenerated Argument Clinic checksums.Serhiy Storchaka2015-02-201-1/+1
|
* Issue #15955: Add an option to limit output size when decompressing LZMA data.Antoine Pitrou2015-01-171-39/+179
| | | | Patch by Nikolaus Rath and Martin Panter.
* Issue #22207: Fix "comparison between signed and unsigned integers" warning inVictor Stinner2014-08-171-2/+2
| | | | | test checking for integer overflow on Py_ssize_t type: cast explicitly to size_t.
* Issue #20326: Argument Clinic now uses a simple, unique signature toLarry Hastings2014-01-281-9/+9
| | | | | | | | | | annotate text signatures in docstrings, resulting in fewer false positives. "self" parameters are also explicitly marked, allowing inspect.Signature() to authoritatively detect (and skip) said parameters. Issue #20326: Argument Clinic now generates separate checksums for the input and output sections of the block, allowing external tools to verify that the input has not changed (and thus the output is not out-of-date).
* Fix for catestrophic errors in previous checkin (Argument Clinic rollup patch).Larry Hastings2014-01-261-0/+1389
|
* Issue #20390: Small fixes and improvements for Argument Clinic.Larry Hastings2014-01-261-1389/+0
|
* Issue #20193: The _lzma module now uses Argument Clinic.Serhiy Storchaka2014-01-251-146/+203
| | | | LZMACompressor.__init__ is left not converted.
* #19395: Raise exception when pickling a (BZ2|LZMA)(Compressor|Decompressor).Nadeem Vawda2013-10-281-0/+18
|\ | | | | | | | | | | | | The underlying C libraries provide no mechanism for serializing compressor and decompressor objects, so actually pickling these classes is impractical. Previously, these objects would be pickled without error, but attempting to use a deserialized instance would segfault the interpreter.
| * #19395: Raise exception when pickling a (BZ2|LZMA)(Compressor|Decompressor).Nadeem Vawda2013-10-281-0/+18
| | | | | | | | | | | | | | The underlying C libraries provide no mechanism for serializing compressor and decompressor objects, so actually pickling these classes is impractical. Previously, these objects would be pickled without error, but attempting to use a deserialized instance would segfault the interpreter.
* | Issue #18227: "Free" function of bz2, lzma and zlib modules has no return ↵Victor Stinner2013-07-071-1/+1
| | | | | | | | value (void)
* | Issue #18227: Use PyMem_RawAlloc() in bz2, lzma and zlib modulesVictor Stinner2013-07-071-0/+28
|/
* Make lzma.{encode,decode}_filter_properties private.Nadeem Vawda2012-06-211-20/+14
| | | | | | | | These functions were originally added to support LZMA compression in the zipfile module, and are not of interest for the majority of users. They can be made public in 3.4 if there is user interest, but in the meanwhile, I've opted to present a smaller, simpler API for the module's initial release.
* Silence VS 2010 warning on loss of precision (_int64 -> _int32).Martin v. Löwis2012-05-151-1/+1
| | | | This is safe because the actual value is already range-checked.