Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

False positive unspecified-encoding for Path objects opened in binary mode #5017

Closed
jacobtylerwalls opened this issue Sep 16, 2021 · 2 comments · Fixed by #5020
Closed

False positive unspecified-encoding for Path objects opened in binary mode #5017

jacobtylerwalls opened this issue Sep 16, 2021 · 2 comments · Fixed by #5020
Assignees
Labels
Bug 🪲 False Positive 🦟 A message is emitted but nothing is wrong with the code
Milestone

Comments

@jacobtylerwalls
Copy link
Member

jacobtylerwalls commented Sep 16, 2021

Bug description

'''
This snippet raises no warnings in previous versions, but raises unspecified-encoding in 2.11.0
Opening in binary mode -- either 'wb' or 'rb'.
'''
import pathlib
fp = pathlib.Path(__file__)
with fp.open('rb') as f:
    pass

Configuration

No response

Command used

pylint a.py

Pylint output

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

Expected behavior

none

Pylint version

pylint 2.11.0
astroid 2.8.0
Python 3.9.6 (v3.9.6:db3ff76da1, Jun 28 2021, 11:49:53) 
[Clang 6.0 (clang-600.0.57)]

OS / Environment

macOS

Additional dependencies

No response

@jacobtylerwalls jacobtylerwalls added Bug 🪲 Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling labels Sep 16, 2021
@jacobtylerwalls jacobtylerwalls changed the title False positive unspecified-encoding for Path.open('wb') in 2.11.0 False positive unspecified-encoding for Path.open('rb') in 2.11.0 Sep 16, 2021
@jacobtylerwalls jacobtylerwalls changed the title False positive unspecified-encoding for Path.open('rb') in 2.11.0 False positive unspecified-encoding for Path objects opened in binary mode Sep 16, 2021
@Pierre-Sassoulas Pierre-Sassoulas added False Positive 🦟 A message is emitted but nothing is wrong with the code and removed Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling labels Sep 16, 2021
@Pierre-Sassoulas
Copy link
Member

@DanielNoord do you want to handle this ?

@DanielNoord
Copy link
Collaborator

Yeah, you can assign me!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug 🪲 False Positive 🦟 A message is emitted but nothing is wrong with the code
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants