summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2012-01-24 08:05:18 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2012-01-24 08:05:18 (GMT)
commit91ecea24f53b99aa190f6b17c2b51d95cb09d233 (patch)
tree223a4b5fa95e535f8fa16560cea1eaa748e8ef7d /Lib
parent09406023a8c19febb3358008ddeabe4450c21b79 (diff)
parent5311c1d7ab24f862b9b0bb272a9aee9c4f4ac023 (diff)
downloadcpython-91ecea24f53b99aa190f6b17c2b51d95cb09d233.zip
cpython-91ecea24f53b99aa190f6b17c2b51d95cb09d233.tar.gz
cpython-91ecea24f53b99aa190f6b17c2b51d95cb09d233.tar.bz2
Issue #13772: In os.symlink() under Windows, do not try to guess the link
target's type (file or directory). The detection was buggy and made the call non-atomic (therefore prone to race conditions).
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_os.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py
index 79e66fb..e78db48 100644
--- a/Lib/test/test_os.py
+++ b/Lib/test/test_os.py
@@ -500,7 +500,12 @@ class WalkTests(unittest.TestCase):
f.write("I'm " + path + " and proud of it. Blame test_os.\n")
f.close()
if support.can_symlink():
- os.symlink(os.path.abspath(t2_path), link_path)
+ if os.name == 'nt':
+ def symlink_to_dir(src, dest):
+ os.symlink(src, dest, True)
+ else:
+ symlink_to_dir = os.symlink
+ symlink_to_dir(os.path.abspath(t2_path), link_path)
sub2_tree = (sub2_path, ["link"], ["tmp3"])
else:
sub2_tree = (sub2_path, [], ["tmp3"])
@@ -1131,7 +1136,7 @@ class Win32SymlinkTests(unittest.TestCase):
os.remove(self.missing_link)
def test_directory_link(self):
- os.symlink(self.dirlink_target, self.dirlink)
+ os.symlink(self.dirlink_target, self.dirlink, True)
self.assertTrue(os.path.exists(self.dirlink))
self.assertTrue(os.path.isdir(self.dirlink))
self.assertTrue(os.path.islink(self.dirlink))