Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
c234a524
Commit
c234a524
authored
Aug 22, 2004
by
Martin v. Löwis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Flush bz2 data even if nothing had been written so far. Fixes #1013882.
Will backport to 2.3.
parent
70aa1f20
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
3 deletions
+9
-3
Lib/tarfile.py
Lib/tarfile.py
+2
-2
Lib/test/test_tarfile.py
Lib/test/test_tarfile.py
+7
-1
No files found.
Lib/tarfile.py
View file @
c234a524
...
@@ -350,9 +350,9 @@ class _Stream:
...
@@ -350,9 +350,9 @@ class _Stream:
if
self
.
closed
:
if
self
.
closed
:
return
return
if
self
.
mode
==
"w"
and
self
.
type
!=
"tar"
:
self
.
buf
+=
self
.
cmp
.
flush
()
if
self
.
mode
==
"w"
and
self
.
buf
:
if
self
.
mode
==
"w"
and
self
.
buf
:
if
self
.
type
!=
"tar"
:
self
.
buf
+=
self
.
cmp
.
flush
()
self
.
fileobj
.
write
(
self
.
buf
)
self
.
fileobj
.
write
(
self
.
buf
)
self
.
buf
=
""
self
.
buf
=
""
if
self
.
type
==
"gz"
:
if
self
.
type
==
"gz"
:
...
...
Lib/test/test_tarfile.py
View file @
c234a524
...
@@ -177,7 +177,8 @@ class WriteTest(BaseTest):
...
@@ -177,7 +177,8 @@ class WriteTest(BaseTest):
def
setUp
(
self
):
def
setUp
(
self
):
mode
=
self
.
mode
+
self
.
sep
+
self
.
comp
mode
=
self
.
mode
+
self
.
sep
+
self
.
comp
self
.
src
=
tarfile
.
open
(
tarname
(
self
.
comp
),
'r'
)
self
.
src
=
tarfile
.
open
(
tarname
(
self
.
comp
),
'r'
)
self
.
dst
=
tarfile
.
open
(
tmpname
(),
mode
)
self
.
dstname
=
tmpname
()
self
.
dst
=
tarfile
.
open
(
self
.
dstname
,
mode
)
def
tearDown
(
self
):
def
tearDown
(
self
):
self
.
src
.
close
()
self
.
src
.
close
()
...
@@ -191,6 +192,11 @@ class WriteTest(BaseTest):
...
@@ -191,6 +192,11 @@ class WriteTest(BaseTest):
self
.
dst
.
posix
=
0
self
.
dst
.
posix
=
0
self
.
_test
()
self
.
_test
()
def
test_small
(
self
):
self
.
dst
.
add
(
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
"cfgparser.1"
))
self
.
dst
.
close
()
self
.
assertNotEqual
(
os
.
stat
(
self
.
dstname
).
st_size
,
0
)
def
_test
(
self
):
def
_test
(
self
):
for
tarinfo
in
self
.
src
:
for
tarinfo
in
self
.
src
:
if
not
tarinfo
.
isreg
():
if
not
tarinfo
.
isreg
():
...
...
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