Message226492
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. |
|
Date |
User |
Action |
Args |
2014-09-06 15:00:41 | steve.dower | set | recipients:
+ steve.dower, pitrou, tim.golden, zach.ware, eryksun, Kevin.Norris |
2014-09-06 15:00:41 | steve.dower | set | messageid: <1410015641.91.0.573084494547.issue22299@psf.upfronthosting.co.za> |
2014-09-06 15:00:41 | steve.dower | link | issue22299 messages |
2014-09-06 15:00:41 | steve.dower | create | |
|