Message229053
To kick this along a bit, do the following testcases seem like the right behavior to others, based on Mark Hammond's roadmap in msg51983? If there's some agreement, I'll work on getting a modernized patch put together.
# currently (3.4)
assertTrue(ntpath.isabs(r"\driveless\halfbreed"))
assertFalse(ntpath.isabs(r"D:rived\halfbreed"))
assertTrue(ntpath.isabs(r"\\any\UNC\path"))
assertTrue(ntpath.isabs(r"O:\bviously\absolute"))
assertFalse(ntpath.isabs(r"obviously\relative"))
# 3.5
# Halfbreeds are not relative, keep same isabs behavior but warn
with assertWarnsRegex(FutureWarning, "will return False in 3.6"):
assertTrue(ntpath.isabs(r"\driveless\halfbreed"))
# same behavior
assertFalse(ntpath.isabs(r"D:rived\halfbreed"))
assertTrue(ntpath.isabs(r"\\any\UNC\path"))
assertTrue(ntpath.isabs(r"O:\bviously\absolute"))
assertFalse(ntpath.isabs(r"obviously\relative"))
# new functions
assertFalse(ntpath.isrelative(r"\driveless\halfbreed"))
assertFalse(ntpath.isrelative(r"D:rived\halfbreed"))
assertFalse(ntpath.isrelative(r"\\any\UNC\path"))
assertFalse(ntpath.isrelative(r"O:\bviously\absolute"))
assertTrue(ntpath.isrelative(r"obviously\relative"))
assertTrue(posixpath.isrelative("foo/bar"))
assertTrue(macpath.isrelative(":foo:bar"))
assertTrue(macpath.isrelative("foobar"))
# 3.6
assertFalse(ntpath.isabs(r"\driveless\halfbreed"))
# all else the same
I'll note that this is a bit extra complicated by the fact that MS calls r"\driveless\halfbreed" an "absolute path", see http://msdn.microsoft.com/en-us/library/windows/desktop/aa365247%28v=vs.100%29.aspx#fully_qualified_vs._relative_paths
That gives me the impression that Windows has notions of "fully qualified" paths (r"C:\foo", "C:\\", r"\\any\UNC\path"), absolute paths (r"\foo", etc.), and relative paths (r"foo\bar", "C:foo", and annoyingly, "C:\foo\..\bar"). My opinion is that we should just declare "we don't quite agree with MS on this one" and go with the semantics outlined above, though we're currently mostly in agreement with them. |
|
Date |
User |
Action |
Args |
2014-10-11 00:47:28 | zach.ware | set | recipients:
+ zach.ware, mhammond, terry.reedy, jorend, christian.heimes, tim.golden, ezio.melotti, eckhardt, r.david.murray, BreamoreBoy, serhiy.storchaka, mdengler |
2014-10-11 00:47:28 | zach.ware | set | messageid: <1412988448.52.0.563922922856.issue1669539@psf.upfronthosting.co.za> |
2014-10-11 00:47:28 | zach.ware | link | issue1669539 messages |
2014-10-11 00:47:27 | zach.ware | create | |
|