diff options
author | R. David Murray <rdmurray@bitdance.com> | 2010-08-01 01:53:52 (GMT) |
---|---|---|
committer | R. David Murray <rdmurray@bitdance.com> | 2010-08-01 01:53:52 (GMT) |
commit | 2b112a6bb3911b07b9b45404edaf99c0150124e5 (patch) | |
tree | b6a2624dcae717a94f778088409914083f856901 | |
parent | 1d978df33f9a3ec598230c2f158f66bbe2ad94b8 (diff) | |
download | cpython-2b112a6bb3911b07b9b45404edaf99c0150124e5.zip cpython-2b112a6bb3911b07b9b45404edaf99c0150124e5.tar.gz cpython-2b112a6bb3911b07b9b45404edaf99c0150124e5.tar.bz2 |
Merged revisions 75659 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
Only the try/except was backported; owner and group were added in 2.7,
as was the test file.
........
r75659 | tarek.ziade | 2009-10-24 09:29:44 -0400 (Sat, 24 Oct 2009) | 1 line
#7066 - Fixed distutils.archive_util.make_archive behavior so it restores the cwd
........
-rw-r--r-- | Lib/distutils/archive_util.py | 9 | ||||
-rw-r--r-- | Misc/NEWS | 3 |
2 files changed, 9 insertions, 3 deletions
diff --git a/Lib/distutils/archive_util.py b/Lib/distutils/archive_util.py index 264e66f..251c0df 100644 --- a/Lib/distutils/archive_util.py +++ b/Lib/distutils/archive_util.py @@ -162,9 +162,12 @@ def make_archive (base_name, format, kwargs[arg] = val filename = apply(func, (base_name, base_dir), kwargs) - if root_dir is not None: - log.debug("changing back to '%s'", save_cwd) - os.chdir(save_cwd) + try: + filename = func(base_name, base_dir, **kwargs) + finally: + if root_dir is not None: + log.debug("changing back to '%s'", save_cwd) + os.chdir(save_cwd) return filename @@ -84,6 +84,9 @@ C-API Library ------- +- Issue #7066: archive_util.make_archive now restores the cwd if an error is + raised. Initial patch by Ezio Melotti. + - Issue #5006: Better handling of unicode byte-order marks (BOM) in the io library. This means, for example, that opening an UTF-16 text file in append mode doesn't add a BOM at the end of the file if the file isn't empty. |