New submission from Luna Chen <[email protected]>:
In `configparser.ConfigParser.read()`, it allows us to pass in either a single
filepath or a list of filepath.
As python3 supports pathlib Path. We can potentially pass in a `PosixPath` to
`configparser.ConfigParser.read()`, especially when passing in a list of
`PosixPath` is allowed.
However, passing in a single `PosixPath` causes it to raise an exception:
File "/Users/bnmetrics/workspace/cpython/Lib/configparser.py", line 694, in
read
for filename in filenames:
TypeError: 'PosixPath' object is not iterable
This issue had been addressed with later version of python by checking if the
filepath passed in is an instance of `os.Pathlike`.
I thought it would be nice if we can pass in a single PosixPath object to
`configparser.ConfigParser.read()`.
----------
messages: 327842
nosy: BNMetrics, gvanrossum, vinay.sajip
priority: normal
severity: normal
status: open
title: Potential bug in ConfigParser.read() in python3.6, before os.Pathlike
was introduced
type: behavior
versions: Python 3.6
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue35002>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com