Issue30432
Created on 2017-05-22 18:51 by Roy Williams, last changed 2022-04-11 14:58 by admin. This issue is now closed.
Pull Requests |
|
|
|
URL |
Status |
Linked |
Edit |
PR 1732 |
merged |
Roy Williams,2017-05-22 23:07 |
|
Messages (4) |
|
|
msg294169 - (view) |
Author: Roy Williams (Roy Williams) * |
Date: 2017-05-22 18:51 |
``` from fileinput import FileInput from pathlib import Path p = Path('.') FileInput(p) ``` Results in: Traceback (most recent call last): File "", line 1, in File "/usr/local/Cellar/python3/3.6.0/Frameworks/Python.framework/Versions/3.6/lib/python3.6/fileinput.py", line 198, in __init__ files = tuple(files) TypeError: 'PosixPath' object is not iterable |
|
|
msg294185 - (view) |
Author: Alex Perry (arp11) * |
Date: 2017-05-22 21:16 |
You seem to be skipping a step, this is nothing to do with FileInput: >>> [n for n in Path('.')] Traceback (most recent call last): File "", line 1, in TypeError: 'PosixPath' object is not iterable >>> [n for n in Path('.').iterdir()] [PosixPath('build'), PosixPath('install-sh'), ...] Are you proposing a feature that the Path instance should be implicitly iterable for the directory contents? |
|
|
msg294199 - (view) |
Author: Roy Williams (Roy Williams) * |
Date: 2017-05-22 23:16 |
@arp11 sorry for the too-minimal repro :D - the issue is with FileInput attempting to cast `files` to a tuple. Instead, if passed a PathLike object FileInput should set `files` to a tuple just as it does with a str. |
|
|
msg294224 - (view) |
Author: Łukasz Langa (lukasz.langa) *  |
Date: 2017-05-23 05:24 |
New changeset 002665a9da3a2924c4a08511ede62ff4d1dabc48 by Łukasz Langa (Roy Williams) in branch 'master': bpo-30432: FileInput doesn't accept PathLike objects for file names (#1732) https://github.com/python/cpython/commit/002665a9da3a2924c4a08511ede62ff4d1dabc48 |
|
|
History |
|
|
|
Date |
User |
Action |
Args |
2022-04-11 14:58:46 |
admin |
set |
github: 74617 |
2017-05-23 05:36:55 |
lukasz.langa |
set |
status: open -> closedresolution: fixedstage: resolved |
2017-05-23 05:24:19 |
lukasz.langa |
set |
nosy: + lukasz.langamessages: + |
2017-05-22 23:16:29 |
Roy Williams |
set |
messages: + |
2017-05-22 23:07:53 |
Roy Williams |
set |
pull_requests: + <pull%5Frequest1822> |
2017-05-22 21:16:17 |
arp11 |
set |
nosy: + arp11messages: + |
2017-05-22 18:51:08 |
Roy Williams |
create |
|