mirror of
https://github.com/python/cpython.git
synced 2025-08-24 10:45:53 +00:00
bpo-30432: FileInput doesn't accept PathLike objects for file names (#1732)
* Allow FileInput to accept a single PathLike object as a parameter for `files` Fixes bpo-30432: FileInput doesn't accept PathLike objects for file names * Address comments from @ambv
This commit is contained in:
parent
d618c8c6d3
commit
002665a9da
2 changed files with 17 additions and 0 deletions
|
@ -189,6 +189,8 @@ class FileInput:
|
|||
mode="r", openhook=None):
|
||||
if isinstance(files, str):
|
||||
files = (files,)
|
||||
elif isinstance(files, os.PathLike):
|
||||
files = (os.fspath(files), )
|
||||
else:
|
||||
if files is None:
|
||||
files = sys.argv[1:]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue