Make `:PymodeRun` execute with the activated virtualenv interpreter by Copilot · Pull Request #1200 · python-mode/python-mode
Copilot
AI
changed the title
[WIP] Fix virtual environment activation issue in Pymode
Make :PymodeRun execute with the activated virtualenv interpreter
- Set __file__ correctly in subprocess so user code referencing it sees the real source path instead of a temp file path - Rewrite temp file paths in subprocess tracebacks to the real source file - Add explicit UTF-8 encoding to subprocess Popen call - Add g:pymode_run_timeout support with TimeoutExpired handling to prevent Vim from hanging on non-terminating scripts - Restore sys.stdout/sys.stderr before returning on SystemExit with non-false exit code (pre-existing leak) - Fix test: use fnameescape() instead of string() for PymodeVirtualenv argument (string() wraps in quotes, producing a malformed path) - Save and restore g:pymode_virtualenv_enabled/g:pymode_virtualenv in the test to avoid polluting subsequent tests - Remove misleading Assert 1 "skip" patterns; drop unreachable else branches so cleanup runs unconditionally Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
This was referenced
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters