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
0b09c42f
Commit
0b09c42f
authored
May 24, 2009
by
Martin v. Löwis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #6050: Don't fail extracting a directory from a zipfile if
the directory already exists.
parent
53b578eb
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
1 deletion
+10
-1
Lib/test/test_zipfile.py
Lib/test/test_zipfile.py
+5
-0
Lib/zipfile.py
Lib/zipfile.py
+2
-1
Misc/NEWS
Misc/NEWS
+3
-0
No files found.
Lib/test/test_zipfile.py
View file @
0b09c42f
...
...
@@ -1023,6 +1023,11 @@ class TestWithDirectory(unittest.TestCase):
self
.
assertTrue
(
os
.
path
.
isdir
(
os
.
path
.
join
(
TESTFN2
,
"a"
,
"b"
)))
self
.
assertTrue
(
os
.
path
.
exists
(
os
.
path
.
join
(
TESTFN2
,
"a"
,
"b"
,
"c"
)))
def
test_bug_6050
(
self
):
# Extraction should succeed if directories already exist
os
.
mkdir
(
os
.
path
.
join
(
TESTFN2
,
"a"
))
self
.
testExtractDir
()
def
testStoreDir
(
self
):
os
.
mkdir
(
os
.
path
.
join
(
TESTFN2
,
"x"
))
zipf
=
zipfile
.
ZipFile
(
TESTFN
,
"w"
)
...
...
Lib/zipfile.py
View file @
0b09c42f
...
...
@@ -971,7 +971,8 @@ class ZipFile:
os
.
makedirs
(
upperdirs
)
if
member
.
filename
[
-
1
]
==
'/'
:
os
.
mkdir
(
targetpath
)
if
not
os
.
path
.
isdir
(
targetpath
):
os
.
mkdir
(
targetpath
)
return
targetpath
source
=
self
.
open
(
member
,
pwd
=
pwd
)
...
...
Misc/NEWS
View file @
0b09c42f
...
...
@@ -302,6 +302,9 @@ Core and Builtins
Library
-------
- Issue #6050: Don't fail extracting a directory from a zipfile if
the directory already exists.
- Issue #5311: bdist_msi can now build packages that do not depend on a
specific Python version.
...
...
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