Note that this check is wrong for incomplete UNC paths such as "//", "//spam", "//?/UNC/", and "//?/UNC/spam". Such paths lack a root and don't even have an implicit root. However, they're still absolute because they don't depend on the current working directory. I don't know how or whether you want to handle this edge case.
ntpath.isabs() gets this case right, but it's still wrong for rooted paths such as "/spam".
Activity
pythonGH-44626, pythonGH-105476: Fix `ntpath.isabs()` handling of par…
pythonGH-44626, pythonGH-105476: Fix `ntpath.isabs()` handling of par…
GH-44626, GH-105476: Fix `ntpath.isabs()` handling of part-absolute p…
barneygale commented on Jan 13, 2024
Fixed in 3.13+ / e4ff131 / #113829
pythonGH-44626, pythonGH-105476: Fix `ntpath.isabs()` handling of par…
pythonGH-44626, pythonGH-105476: Fix `ntpath.isabs()` handling of par…
pythonGH-44626, pythonGH-105476: Fix `ntpath.isabs()` handling of par…