[Python-Dev] Pondering some changes to python.c...
Guido van Rossum
Mon, 08 Apr 2002 16:51:57 -0400
> >-1 on making it the default -- there are programs relying on this.
> Interesting point... One of the main reasons that I wanted this was that
> some programs rely on it *NOT* being there. Like "killall", etc...
When I run a Python script that has a #! directly, ps doesn't show me
the "python" part -- only the script name. This is in Linux (Red Hat
7.2). Maybe it's different for you?
I think that it's totally acceptable that when you say "python foo.py"
that argv is seen by ps to be "python".
> >+1 on providing a sys module interface for this so that programs
> >can choose the name on their own.
> Yeah, I was thinking about that one. It's kind of complicated,
> unfortunately. To do it right, you need to muck around with the original
> argv and envp arguments. So, it will cause side-effects to any code
> calling the main Python entry point if we do it in there... Besides, we
> really end the envp anyway (which Py_Main doesn't take).
> So, I'm thinking there would need to be a new entry point like
> "Py_ArgsSetup(int argc, char ***argv, char ***envp)", which would need to be
> called to set this up. You'd call "Py_ArgsSetup(argc, &argv, &envp)", and
> it would re-allocate argv and envp, and use the original data space for
> storing the process string.
I'm not sure I understand. If you have the argc/argv/environ set, why
do you need to know &argc and &argv?
--Guido van Rossum (home page: http://www.python.org/~guido/)