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
abf202d7
Commit
abf202d7
authored
Mar 16, 2011
by
Nick Coghlan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Close #11548: Correctly handle format argument in shutil.unpack_archive
parent
a78e4e6d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
2 deletions
+10
-2
Lib/shutil.py
Lib/shutil.py
+2
-2
Lib/test/test_shutil.py
Lib/test/test_shutil.py
+8
-0
No files found.
Lib/shutil.py
View file @
abf202d7
...
@@ -737,8 +737,8 @@ def unpack_archive(filename, extract_dir=None, format=None):
...
@@ -737,8 +737,8 @@ def unpack_archive(filename, extract_dir=None, format=None):
except
KeyError
:
except
KeyError
:
raise
ValueError
(
"Unknown unpack format '{0}'"
.
format
(
format
))
raise
ValueError
(
"Unknown unpack format '{0}'"
.
format
(
format
))
func
=
format_info
[
0
]
func
=
format_info
[
1
]
func
(
filename
,
extract_dir
,
**
dict
(
format_info
[
1
]))
func
(
filename
,
extract_dir
,
**
dict
(
format_info
[
2
]))
else
:
else
:
# we need to look at the registered unpackers supported extensions
# we need to look at the registered unpackers supported extensions
format
=
_find_unpack_format
(
filename
)
format
=
_find_unpack_format
(
filename
)
...
...
Lib/test/test_shutil.py
View file @
abf202d7
...
@@ -645,6 +645,14 @@ class TestShutil(unittest.TestCase):
...
@@ -645,6 +645,14 @@ class TestShutil(unittest.TestCase):
diff
=
self
.
_compare_dirs
(
tmpdir
,
tmpdir2
)
diff
=
self
.
_compare_dirs
(
tmpdir
,
tmpdir2
)
self
.
assertEqual
(
diff
,
[])
self
.
assertEqual
(
diff
,
[])
# and again, this time with the format specified
tmpdir3
=
self
.
mkdtemp
()
unpack_archive
(
filename
,
tmpdir3
,
format
=
format
)
diff
=
self
.
_compare_dirs
(
tmpdir
,
tmpdir3
)
self
.
assertEqual
(
diff
,
[])
self
.
assertRaises
(
shutil
.
ReadError
,
unpack_archive
,
TESTFN
)
self
.
assertRaises
(
ValueError
,
unpack_archive
,
TESTFN
,
format
=
'xxx'
)
def
test_unpack_registery
(
self
):
def
test_unpack_registery
(
self
):
formats
=
get_unpack_formats
()
formats
=
get_unpack_formats
()
...
...
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