jaraco/configparser

3.5.2 breaks config parsing in flake8 on python 2.7

harkylton opened this issue · 7 comments

In the line if PY2 and isinstance(filenames, bytes) and sys.py3kwarning:, the addition of and sys.py3kwarning makes it so flake8 can't read config files. sys.py3kwarning seems to only be True if you pass -3 to the python interpreter, and this is not set by default in flake8.

I have created a patch for this, https://github.com/gvangool/configparser/tree/fix-regression-in-3.5.2. But the current master is already updated to match the Python 3.7 release.

@gvangool Thanks. I've downgraded to 3.5.1 for now, just wanted to highlight the issue before it propagates to other projects.

if PY2 and isinstance(filenames, bytes) and sys.py3kwarning:
warnings.warn(something)
filenames = [filenames]

When sys.py3kwarning is false (which is the default on at least my python2.7) the condition check is always false and filename is not converted to a list.

I would recommend to just revert 884b8e6 which is obviously wrong and craft another patch that move the sys.py3kwarning to its own guard:

 if PY2 and isinstance(filenames, bytes)
     if sys.py3kwarning:
        warnings.warn(something)

    filenames = [filenames]

Thx!

Well hello there

Will have a fix shortly.

Fix released as 3.5.3.