Skip to content

Improve pip config set error when PIP_CONFIG_FILE is non-regular#13790

Open
gcomneno wants to merge 8 commits intopypa:mainfrom
gcomneno:contrib/issue-11880-config-set-devnull
Open

Improve pip config set error when PIP_CONFIG_FILE is non-regular#13790
gcomneno wants to merge 8 commits intopypa:mainfrom
gcomneno:contrib/issue-11880-config-set-devnull

Conversation

@gcomneno
Copy link
Contributor

@gcomneno gcomneno commented Feb 7, 2026

Fixes #11880.

When PIP_CONFIG_FILE points to a non-regular file (e.g. /dev/null), pip config set
previously failed with "Fatal Internal error [id=2]". This change reports a clear,
actionable ConfigurationError instead, and adds a functional test covering the case.

Tests:

  • nox -s test-3.12 -- tests/functional/test_configuration.py

@gcomneno
Copy link
Contributor Author

gcomneno commented Feb 7, 2026

Repro: PIP_CONFIG_FILE=/dev/null pip config set ... previously produced “Fatal Internal error [id=2]”.
This PR turns that into a clear ConfigurationError and adds functional coverage.

Tests: nox -s test-3.12 -- tests/functional/test_configuration.py

@gcomneno
Copy link
Contributor Author

gcomneno commented Feb 7, 2026

Minor wording tweak to align with pip-style error messages.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we not make the test work on windows using the equivalent windows special file (NUL)?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gcomneno
Copy link
Contributor Author

gcomneno commented Feb 7, 2026

I tried making the test cross-platform: instead of skipping Windows due to hardcoded /dev/null, use os.devnull ("/dev/null" on POSIX, "nul" on Windows) and drop the skip.

Patch is ready on my fork: commit a58ede1 (branch pr-13790).

To apply:

git fetch https://github.com/gcomneno/pip.git pr-13790
git cherry-pick a58ede1fc

Rationale: avoids hardcoding /dev/null and the Windows skip while keeping the intent of the test (non-regular PIP_CONFIG_FILE -> human-friendly error).

@gcomneno
Copy link
Contributor Author

Quick follow-up: I have a small commit that makes the functional test cross-platform by using os.devnull instead of hardcoding /dev/null (commit a58ede1). Happy to push it directly onto this PR if you prefer.

@gcomneno
Copy link
Contributor Author

I pushed the cross-platform test tweak (use os.devnull instead of hardcoding /dev/null) onto the PR branch, so no cherry-pick is needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

pip config set causes error when PIP_CONFIG_FILE="/dev/null"

3 participants

Comments