Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-91349: Adjust default compression level to 6 (down from 9) in gzip and tarfile#131470

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
morotti wants to merge1 commit intopython:main
base:main
Choose a base branch
Loading
fromman-group:rmorotti-compresion-level
Open
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletionsDoc/library/gzip.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -26,7 +26,7 @@ Note that additional file formats which can be decompressed by the
The module defines the following items:


.. function:: open(filename, mode='rb', compresslevel=9, encoding=None, errors=None, newline=None)
.. function:: open(filename, mode='rb', compresslevel=6, encoding=None, errors=None, newline=None)

Open a gzip-compressed file in binary or text mode, returning a :term:`file
object`.
Expand DownExpand Up@@ -67,7 +67,7 @@ The module defines the following items:

.. versionadded:: 3.8

.. class:: GzipFile(filename=None, mode=None, compresslevel=9, fileobj=None, mtime=None)
.. class:: GzipFile(filename=None, mode=None, compresslevel=6, fileobj=None, mtime=None)

Constructor for the :class:`GzipFile` class, which simulates most of the
methods of a :term:`file object`, with the exception of the :meth:`~io.IOBase.truncate`
Expand DownExpand Up@@ -184,7 +184,7 @@ The module defines the following items:
attribute instead.


.. function:: compress(data, compresslevel=9, *, mtime=0)
.. function:: compress(data, compresslevel=6, *, mtime=0)

Compress the *data*, returning a :class:`bytes` object containing
the compressed data. *compresslevel* and *mtime* have the same meaning as in
Expand Down
4 changes: 2 additions & 2 deletionsLib/tarfile.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -1911,7 +1911,7 @@ def taropen(cls, name, mode="r", fileobj=None, **kwargs):
return cls(name, mode, fileobj, **kwargs)

@classmethod
def gzopen(cls, name, mode="r", fileobj=None, compresslevel=9, **kwargs):
def gzopen(cls, name, mode="r", fileobj=None, compresslevel=6, **kwargs):
"""Open gzip compressed tar archive name for reading or writing.
Appending is not allowed.
"""
Expand DownExpand Up@@ -1944,7 +1944,7 @@ def gzopen(cls, name, mode="r", fileobj=None, compresslevel=9, **kwargs):
return t

@classmethod
def bz2open(cls, name, mode="r", fileobj=None, compresslevel=9, **kwargs):
def bz2open(cls, name, mode="r", fileobj=None, compresslevel=6, **kwargs):
"""Open bzip2 compressed tar archive name for reading or writing.
Appending is not allowed.
"""
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
Adjust default compression level to 6 (down from 9) in gzip and tarfile.
It is the default level used by most compression tools and a better
tradeoff between speed and performance.
Loading

[8]ページ先頭

©2009-2025 Movatter.jp