[issue6975] symlinks incorrectly resolved on POSIX platforms

Antoine Pitrou report at bugs.python.org
Sun Jan 13 18:51:28 CET 2013


Antoine Pitrou added the comment:

I don't really understand your algorithm. Why do you need a stack? It should be simply iterative:
- if the symlink is relative, prepend the symlink target to the rest
- if the symlink is absolute, discard the current path and prepend the symlink target to the rest

Here is how pathlib does it:
https://bitbucket.org/pitrou/pathlib/src/67a2524b057f1af5b3cba26370b1353e73cdda16/pathlib.py?at=default#cl-227

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue6975>
_______________________________________


More information about the Python-bugs-list mailing list