[Python-Dev] Pondering some changes to python.c...

Guido van Rossum guido@python.org
Mon, 08 Apr 2002 20:32:45 -0400


> >Sigh.  The more I hear about this, the more I think, too ugly, this
> >doesn't belong in Python.
> 
> It's easier if we make the following restrictions:
> 
>    You can only set the process title to something the length of the
>    original command-line or shorter (should work fine for simply deleting
>    the "python" at the beginning).

This sounds awfully ill-defined.  Do you know how this is accomplished
on various Unix variants besides Linux?  What if there's some platform
where the rule is that the new length must be *exactly* the original
length?  Or where the limit is the original size minus 2 bytes?  Does
it work on Linux as an accident of the implementation, or is it
guaranteed to work as Linux is upgraded?  I'd hate to hear the
complaints from users when they upgrade their kernel and find that it
breaks Python, despite ABI compatibility promises.

>    After calling sys.setproctitle(), C code which has ahold of argv
>    will no longer have the original argv data.  We should be able to
>    have a copy of the original argv for regular python code.

What code would have a hold of argv, except main() which just calls
Py_Main()?

> Are these reasonable restrictions to place on the setting of the
> process title?

I presume the 2nd restriction could be a problem for C apps embedding
Python.  Maybe this should only be allowed when Python is the main
interpreter; I wouldn't want a Python script to be able to change my
argv[0] anyway if I were a large app (say Mozilla :-) embedding
Python.

--Guido van Rossum (home page: http://www.python.org/~guido/)