Message286585
| Author | eryksun |
|---|
| Recipients | eryksun, paul.moore, steve.dower, tim.golden, zach.ware |
|---|
| Date | 2017-02-01.03:06:19 |
|---|
| SpamBayes Score | -1.0 |
|---|
| Marked as misclassified | Yes |
|---|
| Message-id | <1485918380.71.0.564330613462.issue29409@psf.upfronthosting.co.za> |
|---|
| In-reply-to | |
|---|
| Content |
|---|
PEP 529 isn't implemented for io.FileIO, and I think it should be. If a UTF-8 path is passed to open(), it ends up calling C _open instead of decoding the path and calling C _wopen. Also, if a pathlike object is passed to io.FileIO, it calls PyUnicode_FSConverter on it, converting it to UTF-8 and then passing it to _open. For example: >>> p = r'C:\Temp\αβψδ' >>> os.path.exists(p) True >>> open(p.encode()) Traceback (most recent call last): File "<stdin>", line 1, in <module> FileNotFoundError: [Errno 2] No such file or directory: b'C:\\Temp\\\xce\xb1\xce\xb2\xcf\x88\xce\xb4' >>> io.FileIO(pathlib.Path(p)) Traceback (most recent call last): File "<stdin>", line 1, in <module> FileNotFoundError: [Errno 2] No such file or directory: WindowsPath('C:/Temp/αβψδ')The Windows implementation should mirror the POSIX implementation via PyUnicode_FSDecoder. |
|