Commit Graph

75 Commits

Author SHA1 Message Date
Hai Shi bb0424b122
bpo-40275: Use new test.support helper submodules in tests (GH-21451) 2020-08-03 18:47:42 +02:00
Serhiy Storchaka 700cfa8c90
bpo-41069: Make TESTFN and the CWD for tests containing non-ascii characters. (GH-21035) 2020-06-25 17:56:31 +03:00
William Chargin eab3b3f1c6 bpo-39389: gzip: fix compression level metadata (GH-18077)
As described in RFC 1952, section 2.3.1, the XFL (eXtra FLags) byte of a
gzip member header should indicate whether the DEFLATE algorithm was
tuned for speed or compression ratio. Prior to this patch, archives
emitted by the `gzip` module always indicated maximum compression.
2020-01-21 13:25:24 +02:00
Serhiy Storchaka a0652328a2
bpo-28286: Deprecate opening GzipFile for writing implicitly. (GH-16417)
Always specify the mode argument for writing.
2019-11-16 18:56:57 +02:00
Zackery Spytz cf599f6f6f bpo-6584: Add a BadGzipFile exception to the gzip module. (GH-13022)
Co-Authored-By: Filip Gruszczyński <gruszczy@gmail.com>
Co-Authored-By: Michele Orrù <maker@tumbolandia.net>
2019-05-13 10:50:52 +03:00
Gregory P. Smith cd466559c4
bpo-16079: fix duplicate test method name in test_gzip. (GH-12827) 2019-04-14 10:32:07 -07:00
guoci 0e7497cb46 bpo-34898: Add mtime parameter to gzip.compress(). (GH-9704)
Without setting mtime, time.time() will be used as the timestamp which will
end up in the compressed data and each invocation of the compress() function
will vary over time.
2018-11-07 11:50:23 +02:00
Stéphane Wirtel 3e28eed9ec bpo-34969: Add --fast, --best on the gzip CLI (GH-9833) 2018-11-03 16:24:23 +01:00
Stéphane Wirtel 84eec11995 bpo-23596: Add unit tests for the command line for the gzip module (GH-9775)
Add unit tests for the command line for the gzip module
2018-10-09 23:16:43 +02:00
Serhiy Storchaka bcbdd2f8db bpo-28286: Add tests for the mode argument of GzipFile. (#4074) 2017-10-22 13:18:21 +03:00
Berker Peksag 03020cfa97 Issue #28227: gzip now supports pathlib
Patch by Ethan Furman.
2016-10-02 13:47:58 +03:00
Serhiy Storchaka 5f1a5187f7 Use sequence repetition instead of bytes constructor with integer argument. 2016-09-11 14:41:02 +03:00
Martin Panter e99e97762c Issue #25626: Change zlib to accept Py_ssize_t and cap to UINT_MAX
The underlying zlib library stores sizes in “unsigned int”. The corresponding
Python parameters are all sizes of buffers filled in by zlib, so it is okay
to reduce higher values to the UINT_MAX internal cap. OverflowError is still
raised for sizes that do not fit in Py_ssize_t.

Sizes are now limited to Py_ssize_t rather than unsigned long, because Python
byte strings cannot be larger than Py_ssize_t. Previously this could result
in a SystemError on 32-bit platforms.

This resolves a regression in the gzip module when reading more than UINT_MAX
or LONG_MAX bytes in one call, introduced by revision 62723172412c.
2015-11-20 08:13:35 +00:00
Antoine Pitrou 2dbc6e6bce Issue #23529: Limit the size of decompressed data when reading from
GzipFile, BZ2File or LZMAFile.  This defeats denial of service attacks
using compressed bombs (i.e. compressed payloads which decompress to a huge
size).

Patch by Martin Panter and Nikolaus Rath.
2015-04-11 00:31:01 +02:00
Serhiy Storchaka bca63b362d Issue #23688: Added support of arbitrary bytes-like objects and avoided
unnecessary copying of memoryview in gzip.GzipFile.write().
Original patch by Wolfgang Maier.
2015-03-23 14:59:48 +02:00
Ned Deily e5127299c8 Issue #20875: Merge from 3.3 2014-03-09 14:47:58 -07:00
Ned Deily 6120739f0c Issue #20875: Prevent possible gzip "'read' is not defined" NameError.
Patch by Claudiu Popa.
2014-03-09 14:44:34 -07:00
Serhiy Storchaka 7f470d0f9c Issue #19936: Remove executable bits from C source files and several forgotten
test files.
2014-01-16 18:48:45 +02:00
Serhiy Storchaka 8f8ec92de8 Issue #19936: Added executable bits or shebang lines to Python scripts which
requires them.  Disable executable bits and shebang lines in test and
benchmark files in order to prevent using a random system python, and in
source files of modules which don't provide command line interface.  Fixed
shebang lines in the unittestgui and checkpip scripts.
2014-01-16 17:33:23 +02:00
Serhiy Storchaka b992a0e102 Issue #19936: Added executable bits or shebang lines to Python scripts which
requires them.  Disable executable bits and shebang lines in test and
benchmark files in order to prevent using a random system python, and in
source files of modules which don't provide command line interface.  Fixed
shebang line to use python3 executable in the unittestgui script.
2014-01-16 17:15:49 +02:00
Nadeem Vawda ee1be99e05 Issue #19222: Add support for the 'x' mode to the gzip module.
Original patch by Tim Heaney.
2013-10-19 00:11:13 +02:00
Georg Brandl b3bd624a55 Back out patch for #1159051, which caused backwards compatibility problems. 2013-05-12 11:57:26 +02:00
Serhiy Storchaka 7e69f0085e Close #17666: Fix reading gzip files with an extra field. 2013-04-08 22:35:02 +03:00
Serhiy Storchaka 57f9b7a124 Issue #1159051: GzipFile now raises EOFError when reading a corrupted file
with truncated header or footer.
Added tests for reading truncated gzip, bzip2, and lzma files.
2013-01-22 17:07:49 +02:00
Serhiy Storchaka 7c3922f44c Issue #1159051: GzipFile now raises EOFError when reading a corrupted file
with truncated header or footer.
Added tests for reading truncated gzip and bzip2 files.
2013-01-22 17:01:59 +02:00
Nadeem Vawda 10c8791978 Fix GzipFile's handling of filenames given as bytes objects.
Add relevant tests for GzipFile, and also for BZ2File and LZMAFile.
2012-06-20 01:48:50 +02:00
Nadeem Vawda 103e8113e4 Fix GzipFile's handling of filenames given as bytes objects. 2012-06-20 01:35:22 +02:00
Nadeem Vawda 68721019ef Add fileobj support to gzip.open(). 2012-06-04 23:21:38 +02:00
Nadeem Vawda 11328e4437 Really fix test_gzip failures on Windows. 2012-05-06 19:24:18 +02:00
Nadeem Vawda 9d9dc8eba0 Fix test_gzip failures on Windows. 2012-05-06 16:25:35 +02:00
Nadeem Vawda 1b8a14d3f0 Separate tests for gzip.GzipFile and gzip.open. 2012-05-06 15:17:52 +02:00
Nadeem Vawda 7e126205e6 Closes #13989: Add support for text modes to gzip.open().
Also, add tests for gzip.open().
2012-05-06 15:04:01 +02:00
Nadeem Vawda 50a4d5debb Merge: #13781: Fix GzipFile to work with os.fdopen()'d file objects. 2012-01-18 09:32:25 +02:00
Nadeem Vawda 892b0b928d Issue #13781: Fix GzipFile to work with os.fdopen()'d file objects. 2012-01-18 09:25:58 +02:00
Ezio Melotti d8b509b192 #13012: use splitlines(keepends=True/False) instead of splitlines(0/1). 2011-09-28 17:37:55 +03:00
Antoine Pitrou 4ec4b0c041 Issue #10791: Implement missing method GzipFile.read1(), allowing GzipFile
to be wrapped in a TextIOWrapper.  Patch by Nadeem Vawda.
2011-04-04 21:00:37 +02:00
Ezio Melotti b3aedd4862 #9424: Replace deprecated assert* methods in the Python test suite. 2010-11-20 19:04:17 +00:00
Georg Brandl 9f1c1dcde3 #10465: fix broken delegation in __getattr__ of _PaddedFile. 2010-11-20 11:25:01 +00:00
Brian Curtin 28f96b5b26 Implement #7944. Use `with` throughout the test suite. 2010-10-13 02:21:42 +00:00
Antoine Pitrou 7980eaa98d Issue #9759: GzipFile now raises ValueError when an operation is attempted
after the file is closed.  Patch by Jeffrey Finkelstein.
2010-10-06 21:21:18 +00:00
Antoine Pitrou c3ed2e7f83 Issue #9962: GzipFile now has the peek() method. 2010-09-29 10:49:46 +00:00
Antoine Pitrou 7b9698435d Issue #1675951: Allow GzipFile to work with unseekable file objects.
Patch by Florian Festi.
2010-09-23 16:22:51 +00:00
Antoine Pitrou 79c5ef11d5 Issue #3488: Provide convenient shorthand functions `gzip.compress`
and `gzip.decompress`.  Original patch by Anand B. Pillai.
2010-08-17 21:10:05 +00:00
Benjamin Peterson 90f5ba538b convert shebang lines: python -> python3 2010-03-11 22:53:45 +00:00
Antoine Pitrou 8e33fd78c4 Merged revisions 77472-77473 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r77472 | antoine.pitrou | 2010-01-13 15:32:10 +0100 (mer., 13 janv. 2010) | 5 lines

  Issue #2846: Add support for gzip.GzipFile reading zero-padded files.
  Patch by Brian Curtin.
........
  r77473 | antoine.pitrou | 2010-01-13 15:32:51 +0100 (mer., 13 janv. 2010) | 3 lines

  Add ACKS entry for r77472.
........
2010-01-13 14:37:26 +00:00
Antoine Pitrou b1f8835b21 Merged revisions 77288 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r77288 | antoine.pitrou | 2010-01-03 23:29:56 +0100 (dim., 03 janv. 2010) | 5 lines

  Issue #7471: Improve the performance of GzipFile's buffering mechanism,
  and make it implement the `io.BufferedIOBase` ABC to allow for further
  speedups by wrapping it in an `io.BufferedReader`.  Patch by Nir Aides.
........
2010-01-03 22:37:40 +00:00
Ezio Melotti 78ea2023d8 Merged revisions 74754 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r74754 | ezio.melotti | 2009-09-12 17:43:43 +0300 (Sat, 12 Sep 2009) | 1 line

  #6026 - fix tests that failed without zlib
........
2009-09-12 18:41:20 +00:00
Benjamin Peterson c9c0f201fe convert old fail* assertions to assert* 2009-06-30 23:06:06 +00:00
Antoine Pitrou 308705e4fa Merged revisions 68484-68485 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r68484 | antoine.pitrou | 2009-01-10 17:13:45 +0100 (sam., 10 janv. 2009) | 3 lines

  Issue #3860: GzipFile and BZ2File now support the context manager protocol.
........
  r68485 | antoine.pitrou | 2009-01-10 17:15:24 +0100 (sam., 10 janv. 2009) | 1 line

  Add NEWS entry for r68484.
........
2009-01-10 16:22:51 +00:00
Antoine Pitrou 42db3efd36 Merged revisions 68319 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r68319 | antoine.pitrou | 2009-01-04 22:29:23 +0100 (dim., 04 janv. 2009) | 3 lines

  Issue #4272: Add an optional argument to the GzipFile constructor to override the timestamp in the gzip stream.
........
2009-01-04 21:37:59 +00:00