Skip to content

🐛 fix(powershell): restore the original pydoc function - #3529

Merged
gaborbernat merged 2 commits into
pypa:mainfrom
subotac:fix/restore-powershell-pydoc
Nov 16, 2026
Merged

gaborbernat merged 2 commits into
pypa:mainfrom
subotac:fix/restore-powershell-pydoc

Conversation

@subotac

@subotac subotac commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

PowerShell activation replaced a pydoc function the user had already defined and deleted it on deactivation, so their own pydoc was gone for the rest of the session. 🐛 Deactivation now puts the original function back, including after activating the same environment twice or switching to another one, and removes the activation wrapper when no function existed before.

Activation saves the existing function after it cleans up the previously active environment, and deactivation restores it from that saved value. The outside input is the user's own PowerShell function: its script block is stored and assigned back as a function value, so no source string is evaluated or interpolated into generated code.

  • ran the linter to address style issues (tox -e fix)
  • wrote descriptive pull request text
  • ensured there are test(s) validating the fix
  • added a docs/changelog/+short-description.<type>.rst fragment for each user-facing change, or applied skip news
  • updated/extended the documentation
  • for changes to activation scripts, pyvenv.cfg, wheel downloads, app-data or release workflows: explained in the PR text which outside input the change handles and how it stops that input from running as code
  • ran tests on Python 3.9 and 3.15 (tox run -e 3.9,3.15)
  • linked upstream issues beside any temporary interpreter overrides
  • kept the PR in draft until CI passes

subotac and others added 2 commits November 8, 2026 17:08
simplint rejects branching inside a test body, so the pydoc cases become
parameters and the script prints the function body, which tells an absent
function, the user's function and the activation wrapper apart.
@gaborbernat gaborbernat changed the title fix(powershell): restore the original pydoc function 🐛 fix(powershell): restore the original pydoc function Nov 16, 2026
@gaborbernat
gaborbernat marked this pull request as ready for review November 16, 2026 22:04
@gaborbernat
gaborbernat merged commit a06b2ab into pypa:main Nov 16, 2026
82 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants