Description
See #102496 for full discussion, but in brief, we should partially normalize ntpath.join calls. This will ensure that in situations where the path is going to be used literally (such as a symlink target or with a \\?\ prefix), there is a much higher likelihood of it being valid.
For example, currently forward slashes are left alone, but should be transformed. This is probably best done with .replace(altsep, sep) on each argument.
# Current behaviour
>>> ntpath.join("spam", "eggs/toast")
"spam\\eggs/toast"
# Desired
"spam\\eggs\\toast"
In cases where the final path is absolute, we could process .. and . segments. This is probably best done with a call to normpath after processing, but only when isabs returns True.
# Current behaviour
>>> ntpath.join("C:\\spam", "../eggs")
"C:\\spam\\../eggs"
# Desired
"C:\\eggs"
(Relative paths may traverse outside of the amount of path we can see, or across reparse points, so it's best to leave them alone. If the Python user combines them with a root, they'll be normalised then.)
Cases that may break are where callers are deliberately constructing abnormal paths. Our contention is that far more callers are using POSIX-based code without realising that the behaviour may be different on Windows, and it's best to smooth over these differences.