summaryrefslogtreecommitdiffstats
path: root/Lib/fileinput.py
diff options
context:
space:
mode:
authorRoy Williams <roy.williams.iii@gmail.com>2017-05-23 05:24:17 (GMT)
committerƁukasz Langa <lukasz@langa.pl>2017-05-23 05:24:17 (GMT)
commit002665a9da3a2924c4a08511ede62ff4d1dabc48 (patch)
tree1b8d492d97e6251d2c9b84b0433e594985e5a88c /Lib/fileinput.py
parentd618c8c6d31b9b288f8a070417683974eb98e3ba (diff)
downloadcpython-002665a9da3a2924c4a08511ede62ff4d1dabc48.zip
cpython-002665a9da3a2924c4a08511ede62ff4d1dabc48.tar.gz
cpython-002665a9da3a2924c4a08511ede62ff4d1dabc48.tar.bz2
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
Diffstat (limited to 'Lib/fileinput.py')
-rw-r--r--Lib/fileinput.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/Lib/fileinput.py b/Lib/fileinput.py
index 721fe9c..363c241 100644
--- a/Lib/fileinput.py
+++ b/Lib/fileinput.py
@@ -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:]