Index: Lib/tarfile.py =================================================================== --- Lib/tarfile.py (revision 82729) +++ Lib/tarfile.py (working copy) @@ -55,6 +55,13 @@ except ImportError: grp = pwd = None +def is_symlink_exception(e): + # AttributeError if no os.symlink + # NotImplementedError if on Windows XP + # WindowsError (1314) if the required privilege is not held by the client + return isinstance(e, (AttributeError, NotImplementedError)) or \ + e.__class__.__name__ == 'WindowsError' + # from tarfile import * __all__ = ["TarFile", "TarInfo", "is_tarfile", "TarError"] @@ -2283,10 +2290,8 @@ os.link(tarinfo._link_target, targetpath) else: self._extract_mem - except (AttributeError, NotImplementedError, WindowsError): - # AttributeError if no os.symlink - # NotImplementedError if on Windows XP - # WindowsError (1314) if the required privilege is not held by the client + except Exception as e: + if not is_symlink_exception(e): raise if tarinfo.issym(): linkpath = os.path.join(os.path.dirname(tarinfo.name),tarinfo.linkname) else: Index: Lib/test/test_posixpath.py =================================================================== --- Lib/test/test_posixpath.py (revision 82729) +++ Lib/test/test_posixpath.py (working copy) @@ -208,6 +208,7 @@ def test_samestat_on_links(self): test_fn1 = support.TESTFN + "1" test_fn2 = support.TESTFN + "2" + self._create_file(test_fn1) test_fns = (test_fn1, test_fn2) os.symlink(*test_fns) stats = map(os.stat, test_fns)