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
065f0c8a
Kaydet (Commit)
065f0c8a
authored
Kas 12, 2006
tarafından
Martin v. Löwis
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Patch #1355023: support whence argument for GzipFile.seek.
üst
040a927c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
1 deletion
+19
-1
gzip.py
Lib/gzip.py
+6
-1
test_gzip.py
Lib/test/test_gzip.py
+11
-0
NEWS
Misc/NEWS
+2
-0
No files found.
Lib/gzip.py
Dosyayı görüntüle @
065f0c8a
...
...
@@ -371,7 +371,12 @@ class GzipFile:
self
.
extrasize
=
0
self
.
offset
=
0
def
seek
(
self
,
offset
):
def
seek
(
self
,
offset
,
whence
=
0
):
if
whence
:
if
whence
==
1
:
offset
=
self
.
offset
+
offset
else
:
raise
ValueError
(
'Seek from end not supported'
)
if
self
.
mode
==
WRITE
:
if
offset
<
self
.
offset
:
raise
IOError
(
'Negative seek in write mode'
)
...
...
Lib/test/test_gzip.py
Dosyayı görüntüle @
065f0c8a
...
...
@@ -128,6 +128,17 @@ class TestGzip(unittest.TestCase):
f
.
seek
(
newpos
)
# positive seek
f
.
close
()
def
test_seek_whence
(
self
):
self
.
test_write
()
# Try seek(whence=1), read test
f
=
gzip
.
GzipFile
(
self
.
filename
)
f
.
read
(
10
)
f
.
seek
(
10
,
whence
=
1
)
y
=
f
.
read
(
10
)
f
.
close
()
self
.
assertEquals
(
y
,
data1
[
20
:
30
])
def
test_seek_write
(
self
):
# Try seek, write test
f
=
gzip
.
GzipFile
(
self
.
filename
,
'w'
)
...
...
Misc/NEWS
Dosyayı görüntüle @
065f0c8a
...
...
@@ -96,6 +96,8 @@ Core and builtins
Library
-------
- Patch #1355023: support whence argument for GzipFile.seek.
- Patch #1065257: Support passing open files as body in
HTTPConnection.request().
...
...
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