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
a7ba6fc5
Kaydet (Commit)
a7ba6fc5
authored
Ara 27, 2006
tarafından
Lars Gustäbel
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Patch #1504073: Fix tarfile.open() for mode "r" with a fileobj argument.
Will backport to 2.5.
üst
71662323
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
0 deletions
+17
-0
tarfile.py
Lib/tarfile.py
+4
-0
test_tarfile.py
Lib/test/test_tarfile.py
+11
-0
NEWS
Misc/NEWS
+2
-0
No files found.
Lib/tarfile.py
Dosyayı görüntüle @
a7ba6fc5
...
@@ -1141,9 +1141,13 @@ class TarFile(object):
...
@@ -1141,9 +1141,13 @@ class TarFile(object):
# Find out which *open() is appropriate for opening the file.
# Find out which *open() is appropriate for opening the file.
for
comptype
in
cls
.
OPEN_METH
:
for
comptype
in
cls
.
OPEN_METH
:
func
=
getattr
(
cls
,
cls
.
OPEN_METH
[
comptype
])
func
=
getattr
(
cls
,
cls
.
OPEN_METH
[
comptype
])
if
fileobj
is
not
None
:
saved_pos
=
fileobj
.
tell
()
try
:
try
:
return
func
(
name
,
"r"
,
fileobj
)
return
func
(
name
,
"r"
,
fileobj
)
except
(
ReadError
,
CompressionError
):
except
(
ReadError
,
CompressionError
):
if
fileobj
is
not
None
:
fileobj
.
seek
(
saved_pos
)
continue
continue
raise
ReadError
(
"file could not be opened successfully"
)
raise
ReadError
(
"file could not be opened successfully"
)
...
...
Lib/test/test_tarfile.py
Dosyayı görüntüle @
a7ba6fc5
...
@@ -648,6 +648,16 @@ class HeaderErrorTest(unittest.TestCase):
...
@@ -648,6 +648,16 @@ class HeaderErrorTest(unittest.TestCase):
b
=
"a"
+
buf
[
1
:]
# manipulate the buffer, so checksum won't match.
b
=
"a"
+
buf
[
1
:]
# manipulate the buffer, so checksum won't match.
self
.
assertRaises
(
tarfile
.
HeaderError
,
tarfile
.
TarInfo
.
frombuf
,
b
)
self
.
assertRaises
(
tarfile
.
HeaderError
,
tarfile
.
TarInfo
.
frombuf
,
b
)
class
OpenFileobjTest
(
BaseTest
):
# Test for SF bug #1496501.
def
test_opener
(
self
):
fobj
=
StringIO
.
StringIO
(
"foo
\n
"
)
try
:
tarfile
.
open
(
""
,
"r"
,
fileobj
=
fobj
)
except
tarfile
.
ReadError
:
self
.
assertEqual
(
fobj
.
tell
(),
0
,
"fileobj's position has moved"
)
if
bz2
:
if
bz2
:
# Bzip2 TestCases
# Bzip2 TestCases
class
ReadTestBzip2
(
ReadTestGzip
):
class
ReadTestBzip2
(
ReadTestGzip
):
...
@@ -693,6 +703,7 @@ def test_main():
...
@@ -693,6 +703,7 @@ def test_main():
tests
=
[
tests
=
[
FileModeTest
,
FileModeTest
,
HeaderErrorTest
,
HeaderErrorTest
,
OpenFileobjTest
,
ReadTest
,
ReadTest
,
ReadStreamTest
,
ReadStreamTest
,
ReadDetectTest
,
ReadDetectTest
,
...
...
Misc/NEWS
Dosyayı görüntüle @
a7ba6fc5
...
@@ -103,6 +103,8 @@ Core and builtins
...
@@ -103,6 +103,8 @@ Core and builtins
Library
Library
-------
-------
-
Patch
#
1504073
:
Fix
tarfile
.
open
()
for
mode
"r"
with
a
fileobj
argument
.
-
Patch
#
1182394
from
Shane
Holloway
:
speed
up
HMAC
.
hexdigest
.
-
Patch
#
1182394
from
Shane
Holloway
:
speed
up
HMAC
.
hexdigest
.
-
Patch
#
1262036
:
Prevent
TarFiles
from
being
added
to
themselves
under
-
Patch
#
1262036
:
Prevent
TarFiles
from
being
added
to
themselves
under
...
...
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