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
e08e3d06
Kaydet (Commit)
e08e3d06
authored
May 25, 2008
tarafından
Georg Brandl
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
#2959: allow multiple close() calls for GzipFile.
üst
ecd0ad3c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
3 deletions
+12
-3
gzip.py
Lib/gzip.py
+2
-0
test_gzip.py
Lib/test/test_gzip.py
+6
-3
NEWS
Misc/NEWS
+4
-0
No files found.
Lib/gzip.py
Dosyayı görüntüle @
e08e3d06
...
@@ -306,6 +306,8 @@ class GzipFile:
...
@@ -306,6 +306,8 @@ class GzipFile:
raise
IOError
,
"Incorrect length of data produced"
raise
IOError
,
"Incorrect length of data produced"
def
close
(
self
):
def
close
(
self
):
if
self
.
fileobj
is
None
:
return
if
self
.
mode
==
WRITE
:
if
self
.
mode
==
WRITE
:
self
.
fileobj
.
write
(
self
.
compress
.
flush
())
self
.
fileobj
.
write
(
self
.
compress
.
flush
())
write32u
(
self
.
fileobj
,
self
.
crc
)
write32u
(
self
.
fileobj
,
self
.
crc
)
...
...
Lib/test/test_gzip.py
Dosyayı görüntüle @
e08e3d06
...
@@ -24,14 +24,14 @@ data2 = """/* zlibmodule.c -- gzip-compatible data compression */
...
@@ -24,14 +24,14 @@ data2 = """/* zlibmodule.c -- gzip-compatible data compression */
class
TestGzip
(
unittest
.
TestCase
):
class
TestGzip
(
unittest
.
TestCase
):
filename
=
test_support
.
TESTFN
filename
=
test_support
.
TESTFN
def
setUp
(
self
):
def
setUp
(
self
):
test_support
.
unlink
(
self
.
filename
)
test_support
.
unlink
(
self
.
filename
)
def
tearDown
(
self
):
def
tearDown
(
self
):
test_support
.
unlink
(
self
.
filename
)
test_support
.
unlink
(
self
.
filename
)
def
test_write
(
self
):
def
test_write
(
self
):
f
=
gzip
.
GzipFile
(
self
.
filename
,
'wb'
)
;
f
.
write
(
data1
*
50
)
f
=
gzip
.
GzipFile
(
self
.
filename
,
'wb'
)
;
f
.
write
(
data1
*
50
)
# Try flush and fileno.
# Try flush and fileno.
...
@@ -41,6 +41,9 @@ class TestGzip(unittest.TestCase):
...
@@ -41,6 +41,9 @@ class TestGzip(unittest.TestCase):
os
.
fsync
(
f
.
fileno
())
os
.
fsync
(
f
.
fileno
())
f
.
close
()
f
.
close
()
# Test multiple close() calls.
f
.
close
()
def
test_read
(
self
):
def
test_read
(
self
):
self
.
test_write
()
self
.
test_write
()
# Try reading.
# Try reading.
...
...
Misc/NEWS
Dosyayı görüntüle @
e08e3d06
...
@@ -59,6 +59,10 @@ Extension Modules
...
@@ -59,6 +59,10 @@ Extension Modules
Library
Library
-------
-------
- Issue #2959: For consistency with other file-like objects, gzip's
GzipFile.close() can now be called multiple times without raising
an exception.
- Issue #1390: Raise ValueError in toxml when an invalid comment would
- Issue #1390: Raise ValueError in toxml when an invalid comment would
otherwise be produced.
otherwise be produced.
...
...
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