Fix #12084. os.stat on Windows wasn't working properly with relative symlinks.

Use of DeviceIoControl to obtain the symlink path via the reparse tag was
removed. The code now uses GetFinalPathNameByHandle in the case of a
symbolic link and works properly given the added test which creates a symbolic
link and calls os.stat on it from multiple locations.

Victor Stinner also noticed an issue with os.lstat following the os.stat
code path when being passed bytes. The posix_lstat function was adjusted to
properly hook up win32_lstat instead of the previous STAT macro (win32_stat).
This commit is contained in:
Brian Curtin 2011-06-13 15:16:04 -05:00
parent 5b52f95797
commit d25aef55c8
4 changed files with 194 additions and 99 deletions

View file

@ -1490,7 +1490,7 @@ def can_symlink():
try:
os.symlink(TESTFN, TESTFN + "can_symlink")
can = True
except (OSError, NotImplementedError):
except (OSError, NotImplementedError, AttributeError):
can = False
_can_symlink = can
return can