Jason R. Coombs <jar...@jaraco.com> added the comment:

> Changing readlink to always return the correct path was deliberate.

Understood. However, this statement assumes the "correct path" is the most 
precise path to resolve the target. If you instead define "correct path" as the 
one that would be most friendly to the user who created the path, readlink no 
longer honors that expectation. With this change, the following invariant holds 
on every platform except Python 3.8 on Windows (at least in the general case):

>>> os.symlink(x, y)
>>> assert os.readlink(y) == x

More importantly, AFAIK, Python provides no function to transform `x` into what 
one can expect as the result of `os.readlink(y)`. In other words, what value of 
`f` would make this invariant pass?

>>> os.symlink(x, y)
>>> assert os.readlink(y) == f(x)

Or put another way, is "C:\Users\jaraco\temp" an "incorrect path"?


Python tracker <rep...@bugs.python.org>
Python-bugs-list mailing list

Reply via email to