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
f9a2c63c
Kaydet (Commit)
f9a2c63c
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.
Backport from rev. 53161.
üst
12e087a1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
0 deletions
+16
-0
tarfile.py
Lib/tarfile.py
+4
-0
test_tarfile.py
Lib/test/test_tarfile.py
+10
-0
NEWS
Misc/NEWS
+2
-0
No files found.
Lib/tarfile.py
Dosyayı görüntüle @
f9a2c63c
...
...
@@ -1133,9 +1133,13 @@ class TarFile(object):
# Find out which *open() is appropriate for opening the file.
for
comptype
in
cls
.
OPEN_METH
:
func
=
getattr
(
cls
,
cls
.
OPEN_METH
[
comptype
])
if
fileobj
is
not
None
:
saved_pos
=
fileobj
.
tell
()
try
:
return
func
(
name
,
"r"
,
fileobj
)
except
(
ReadError
,
CompressionError
):
if
fileobj
is
not
None
:
fileobj
.
seek
(
saved_pos
)
continue
raise
ReadError
(
"file could not be opened successfully"
)
...
...
Lib/test/test_tarfile.py
Dosyayı görüntüle @
f9a2c63c
...
...
@@ -625,6 +625,15 @@ class FileModeTest(unittest.TestCase):
self
.
assertEqual
(
tarfile
.
filemode
(
0755
),
'-rwxr-xr-x'
)
self
.
assertEqual
(
tarfile
.
filemode
(
07111
),
'---s--s--t'
)
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
:
# Bzip2 TestCases
...
...
@@ -670,6 +679,7 @@ def test_main():
tests
=
[
FileModeTest
,
OpenFileobjTest
,
ReadTest
,
ReadStreamTest
,
ReadDetectTest
,
...
...
Misc/NEWS
Dosyayı görüntüle @
f9a2c63c
...
...
@@ -122,6 +122,8 @@ Extension Modules
Library
-------
-
Patch
#
1504073
:
Fix
tarfile
.
open
()
for
mode
"r"
with
a
fileobj
argument
.
-
Patch
#
1262036
:
Prevent
TarFiles
from
being
added
to
themselves
under
certain
conditions
.
...
...
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