This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author zach.ware
Recipients BreamoreBoy, christian.heimes, eckhardt, ezio.melotti, jorend, mdengler, mhammond, r.david.murray, serhiy.storchaka, terry.reedy, tim.golden, zach.ware
Date 2014-10-11.00:47:27
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1412988448.52.0.563922922856.issue1669539@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2014-10-11 00:47:28zach.waresetrecipients: + 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:28zach.waresetmessageid: <1412988448.52.0.563922922856.issue1669539@psf.upfronthosting.co.za>
2014-10-11 00:47:28zach.warelinkissue1669539 messages
2014-10-11 00:47:27zach.warecreate