python / python/cpython

`sys.orig_argv` is not original, at least on some systems

Open
#125,006 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

OS-mac type-bug
Dominant language
Python
Stars
77.2k
Forks
35.9k
PR merge metrics
PR metrics pending

Description

In an OSX .venv the "original" sys.orig_argv is not really original...

(.venv) % cat orig.py
import sys

print(sys.orig_argv)

(.venv) % python orig.py 
['/opt/homebrew/Cellar/python@3.11/3.11.10/Frameworks/Python.framework/Versions/3.11/Resources/Python.app/Contents/MacOS/Python', 'orig.py']

(.venv) % which python
/Users/user/git/project/.venv/bin/python

I can use os.environ["_"] but it's a workaround.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the report with orig.py in an OSX .venv and compare sys.orig_argv with the path returned by which python. Trace how CPython populates sys.orig_argv on that startup path; done means establishing the expected behavior for the reported setup and covering it with a regression test.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.