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

EncodingWarnings in configuration.py and utils/subprocess.py #12386

Closed
1 task done
bluetech opened this issue Nov 4, 2023 · 4 comments
Closed
1 task done

EncodingWarnings in configuration.py and utils/subprocess.py #12386

bluetech opened this issue Nov 4, 2023 · 4 comments
Labels
resolution: duplicate Duplicate of an existing issue/PR type: bug A confirmed bug or unintended behavior

Comments

@bluetech
Copy link
Contributor

bluetech commented Nov 4, 2023

Description

Some projects I'm working on (e.g. black, pytest) have started setting PYTHONWARNDEFAULTENCODING=1 in their tox configurations (see PEP 597 – Add optional EncodingWarning). It affects pip as well, and pip is not clean from these warnings:

black/.tox/py311/lib/python3.11/site-packages/pip/_internal/configuration.py:284: EncodingWarning: UTF-8 Mode affects locale.getpreferredencoding(). Consider locale.getencoding() instead.
  locale_encoding = locale.getpreferredencoding(False)
black/.tox/py311/lib/python3.11/site-packages/pip/_internal/configuration.py:284: EncodingWarning: UTF-8 Mode affects locale.getpreferredencoding(). Consider locale.getencoding() instead.
  locale_encoding = locale.getpreferredencoding(False)
Obtaining file:///home/ran/src/black
black/.tox/py311/lib/python3.11/site-packages/pip/_internal/utils/subprocess.py:141: EncodingWarning: 'encoding' argument not specified.
  proc = subprocess.Popen(

The "Consider locale.getencoding() instead" warning is explained by PEP 686 – Make UTF-8 mode default.

Expected behavior

No warnings under PYTHONWARNDEFAULTENCODING=1.

pip version

23.2.1

Python version

3.11

OS

Linux

How to Reproduce

Running PYTHONWARNDEFAULTENCODING=1 pip is sufficient for the first two warnings.

The subprocess warning I get when doing PYTHONWARNDEFAULTENCODING=1 pip install -e . in black repo (trying to mimic what tox does).

Output

No response

Code of Conduct

@bluetech bluetech added S: needs triage Issues/PRs that need to be triaged type: bug A confirmed bug or unintended behavior labels Nov 4, 2023
@notatallshaw
Copy link
Member

I beleive this is a duplicate of #10590?

Unless there's something extra about the subprocess?

@bluetech
Copy link
Contributor Author

bluetech commented Nov 4, 2023

If I understand correctly, the warnings reported in #10590 were fixed in #10593. The subprocess warning is maybe new or was missed. And the UTF-8 Mode warnings I believe didn't exist back then.

@Avasam
Copy link

Avasam commented Feb 24, 2024

The utils/subprocess.py report would be a duplicate of #12070

@jaraco
Copy link
Member

jaraco commented May 20, 2024

Closing as a duplicate of #10590 and #12070.

@jaraco jaraco closed this as completed May 20, 2024
@jaraco jaraco added resolution: duplicate Duplicate of an existing issue/PR and removed S: needs triage Issues/PRs that need to be triaged labels May 20, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 20, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
resolution: duplicate Duplicate of an existing issue/PR type: bug A confirmed bug or unintended behavior
Projects
None yet
Development

No branches or pull requests

4 participants