Author steve.dower
Recipients Kevin.Norris, eryksun, pitrou, steve.dower, tim.golden, zach.ware
Date 2014-09-06.15:00:41
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1410015641.91.0.573084494547.issue22299@psf.upfronthosting.co.za>
In-reply-to
Content
Actually, I'd be inclined to never use the prefix within pathlib and then add it on if necessary when converting to a string. That would also solve a problem like:

>>> p = Path("C:\\") / ('a'*150) / ('a'*150)
>>> p.stat()
FileNotFoundError: [WinError 3] The system cannot find the path specified: ...
>>> p2 = Path("\\\\?\\" + str(p))
>>> p2.stat()
os.stat_result(...)

The hardest part about this is knowing with certainty whether it's needed. We can certainly detect most cases automatically.

Maybe we also need an extra method or a format character to force a str() with prefix? Or maybe having an obvious enough function that people can monkey-patch if necessary - the "\\?\" prefix is an edge case for most people already, and checking the total length would bring that to >99% IME.
History
Date User Action Args
2014-09-06 15:00:41steve.dowersetrecipients: + steve.dower, pitrou, tim.golden, zach.ware, eryksun, Kevin.Norris
2014-09-06 15:00:41steve.dowersetmessageid: <1410015641.91.0.573084494547.issue22299@psf.upfronthosting.co.za>
2014-09-06 15:00:41steve.dowerlinkissue22299 messages
2014-09-06 15:00:41steve.dowercreate