Skip to content

False positive unspecified-encoding when passing encoding as kwarg #8719

@jamesbraza

Description

@jamesbraza

Bug description

When passing an encoding as a kwarg to open, I get unspecified-encoding thrown.

CSV_KWARGS = {"newline": "", "encoding": "utf-8"} with open("foo.csv", **CSV_KWARGS): pass

Configuration

No response

Command used

pylint --score=false a.py

Pylint output

************* Module quick_play a.py:2:5: W1514: Using open without explicitly specifying an encoding (unspecified-encoding)

Expected behavior

I think it would be cool if pylint wouldn't throw unspecified-encoding in this case.

Pylint version

pylint 2.17.4 astroid 2.15.4 Python 3.10.10 (main, Feb 19 2023, 17:57:18) [Clang 14.0.0 (clang-1400.0.29.102)]

OS / Environment

macOS Monterey v12.6

Additional dependencies

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    False Positive 🦟A message is emitted but nothing is wrong with the codeNeeds PRThis issue is accepted, sufficiently specified and now needs an implementationperformance

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions