Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
d1a10713
Kaydet (Commit)
d1a10713
authored
Şub 11, 2012
tarafından
Nadeem Vawda
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
Merge: #13989: Document that GzipFile does not support text mode.
üst
f4bdf4e4
30d94b7a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
7 deletions
+15
-7
gzip.rst
Doc/library/gzip.rst
+5
-3
gzip.py
Lib/gzip.py
+7
-4
NEWS
Misc/NEWS
+3
-0
No files found.
Doc/library/gzip.rst
Dosyayı görüntüle @
d1a10713
...
...
@@ -44,9 +44,11 @@ The module defines the following items:
The *mode* argument can be any of ``'r'``, ``'rb'``, ``'a'``, ``'ab'``, ``'w'``,
or ``'wb'``, depending on whether the file will be read or written. The default
is the mode of *fileobj* if discernible; otherwise, the default is ``'rb'``. If
not given, the 'b' flag will be added to the mode to ensure the file is opened
in binary mode for cross-platform portability.
is the mode of *fileobj* if discernible; otherwise, the default is ``'rb'``.
Note that the file is always opened in binary mode; text mode is not
supported. If you need to read a compressed file in text mode, wrap your
:class:`GzipFile` with an :class:`io.TextIOWrapper`.
The *compresslevel* argument is an integer from ``1`` to ``9`` controlling the
level of compression; ``1`` is fastest and produces the least compression, and
...
...
Lib/gzip.py
Dosyayı görüntüle @
d1a10713
...
...
@@ -93,6 +93,9 @@ class GzipFile(io.BufferedIOBase):
"""The GzipFile class simulates most of the methods of a file object with
the exception of the readinto() and truncate() methods.
This class only supports opening files in binary mode. If you need to open a
compressed file in text mode, wrap your GzipFile with an io.TextIOWrapper.
"""
myfileobj
=
None
...
...
@@ -119,8 +122,8 @@ class GzipFile(io.BufferedIOBase):
The mode argument can be any of 'r', 'rb', 'a', 'ab', 'w', or 'wb',
depending on whether the file will be read or written. The default
is the mode of fileobj if discernible; otherwise, the default is 'rb'.
Be aware that only the 'rb', 'ab', and 'wb' values should be use
d
for cross-platform portability
.
A mode of 'r' is equivalent to one of 'rb', and similarly for 'w' an
d
'wb', and 'a' and 'ab'
.
The compresslevel argument is an integer from 1 to 9 controlling the
level of compression; 1 is fastest and produces the least compression,
...
...
@@ -137,8 +140,8 @@ class GzipFile(io.BufferedIOBase):
"""
# guarantee the file is opened in binary mode on platforms
# that care about that sort of thing
if
mode
and
(
't'
in
mode
or
'U'
in
mode
):
raise
IOError
(
"Mode "
+
mode
+
" not supported"
)
if
mode
and
'b'
not
in
mode
:
mode
+=
'b'
if
fileobj
is
None
:
...
...
Misc/NEWS
Dosyayı görüntüle @
d1a10713
...
...
@@ -466,6 +466,9 @@ Core and Builtins
Library
-------
-
Issue
#
13989
:
Document
that
GzipFile
does
not
support
text
mode
,
and
give
a
more
helpful
error
message
when
opened
with
an
invalid
mode
string
.
-
Issue
#
13590
:
On
OS
X
10.7
and
10.6
with
Xcode
4.2
,
building
Distutils
-
based
packages
with
C
extension
modules
may
fail
because
Apple
has
removed
gcc
-
4.2
,
the
version
used
to
build
python
.
org
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment