Skip to content

3.5.2 breaks config parsing in flake8 on python 2.7 #27

Closed

Description

@harkylton

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.

Activity

  1. gvangool commented on Jan 25, 2019

    @gvangool

    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.

  2. harkylton commented on Jan 25, 2019

    @harkylton
    Author

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

  3. hashar commented on Jan 25, 2019

    @hashar

    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!

  4. added a commit that references this issue on Jan 25, 2019
  5. jaraco commented on Jan 25, 2019

    @jaraco
    Owner

    Will have a fix shortly.

  6. jaraco commented on Jan 25, 2019

    @jaraco
    Owner

    Fix released as 3.5.3.

  7. added a commit that references this issue on Jan 25, 2019
  8. added a commit that references this issue on Feb 28, 2021
    2667241
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions