[Python-checkins] r72896 - in python/branches/release30-maint: Lib/test/test_zipfile.py Lib/zipfile.py Misc/NEWS

martin.v.loewis python-checkins at python.org
Sun May 24 21:53:34 CEST 2009


Author: martin.v.loewis
Date: Sun May 24 21:53:33 2009
New Revision: 72896
Log:
Merged revisions 72895 via svnmerge from 
svn+ssh://pythondev@svn.python.org/python/branches/py3k
................
 r72895 | martin.v.loewis | 2009年05月24日 21:47:22 +0200 (So, 24 Mai 2009) | 10 lines
 
 Merged revisions 72893 via svnmerge from 
 svn+ssh://pythondev@svn.python.org/python/trunk
 
 ........
 r72893 | martin.v.loewis | 2009年05月24日 21:30:52 +0200 (So, 24 Mai 2009) | 3 lines
 
 Issue #6050: Don't fail extracting a directory from a zipfile if
 the directory already exists.
 ........
................
Modified:
 python/branches/release30-maint/ (props changed)
 python/branches/release30-maint/Lib/test/test_zipfile.py
 python/branches/release30-maint/Lib/zipfile.py
 python/branches/release30-maint/Misc/NEWS
Modified: python/branches/release30-maint/Lib/test/test_zipfile.py
==============================================================================
--- python/branches/release30-maint/Lib/test/test_zipfile.py	(original)
+++ python/branches/release30-maint/Lib/test/test_zipfile.py	Sun May 24 21:53:33 2009
@@ -983,6 +983,11 @@
 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")
Modified: python/branches/release30-maint/Lib/zipfile.py
==============================================================================
--- python/branches/release30-maint/Lib/zipfile.py	(original)
+++ python/branches/release30-maint/Lib/zipfile.py	Sun May 24 21:53:33 2009
@@ -964,7 +964,8 @@
 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)
Modified: python/branches/release30-maint/Misc/NEWS
==============================================================================
--- python/branches/release30-maint/Misc/NEWS	(original)
+++ python/branches/release30-maint/Misc/NEWS	Sun May 24 21:53:33 2009
@@ -65,6 +65,9 @@
 Library
 -------
 
+- Issue #6050: Don't fail extracting a directory from a zipfile if
+ the directory already exists.
+
 - Issue #5259: smtplib plain auth login no longer gives a traceback. Fix
 by Musashi Tamura, tests by Marcin Bachry.
 


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /