GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-159498: Fix PowerShell venv activation for paths containing brackets by repzakske · Pull Request #159499 · python/cpython

Conversation

@repzakske

@repzakske repzakske commented Oct 15, 2026 •
edited by bedevere-app Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Fixes #159498.

PowerShell interprets square brackets in the activation script's path and config path as wildcard syntax. This can prevent activation under project [2026]/.venv, or make venv[1] select a sibling directory named venv1.

Use literal lookups for the script directory and pyvenv.cfg, constructing the config path without wildcard resolution.

The regression test activates an environment named venv[1] in each available PowerShell implementation and checks the active environment, configured prompt, and selected interpreter using the existing subprocess helper.

Validation

  • The regression test fails against the original script and when each corrected lookup is independently reverted, in both shells.
  • Built CPython main locally and ran python -m test -v -u cpu test_venv: 54 tests, 9 platform skips, no failures.
  • Tested with PowerShell 7.6.5 and Windows PowerShell 5.1 on Windows.
  • Applicable pre-commit hooks and patchcheck passed.
  • Full CPython test-suite and upstream CI results remain pending.

Please consider backports to 3.14 and 3.15.

  • Issue: PowerShell venv activation treats square brackets in paths as wildcards #159498

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
repzakske added 2 commits October 16, 2026 01:49
@repzakske
pythongh-159498: Fix PowerShell venv activation for paths containing …
a7b667a
…brackets
@repzakske
test: focus the PowerShell regression on one bracketed path
1c2557e
@repzakske
repzakske requested review from FFY00 and vsajip as code owners October 15, 2026 23:59
@python-cla-bot

python-cla-bot Bot commented Oct 15, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

All commit authors signed the Contributor License Agreement.

CLA signed

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app bedevere-app Bot mentioned this pull request Oct 15, 2026
PowerShell venv activation treats square brackets in paths as wildcards #159498
Open
@bedevere-app bedevere-app Bot added the awaiting review label Oct 15, 2026
repzakske added 4 commits October 17, 2026 17:13
@repzakske
Merge branch 'main' into fix/venv-powershell-literal-paths
2d4ffda
@repzakske
Merge branch 'main' into fix/venv-powershell-literal-paths
65b76d0
@repzakske
Merge branch 'main' into fix/venv-powershell-literal-paths
493e180
@repzakske
Merge branch 'main' into fix/venv-powershell-literal-paths
1ecf719
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@vsajip vsajip Awaiting requested review from vsajip vsajip is a code owner
@FFY00 FFY00 Awaiting requested review from FFY00 FFY00 is a code owner

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

awaiting review

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

PowerShell venv activation treats square brackets in paths as wildcards

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@repzakske
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.