[issue23427] Python should expose command when invoked with -c

Jan-Philip Gehrcke report at bugs.python.org
Tue Feb 10 12:25:44 CET 2015


Jan-Philip Gehrcke added the comment:

Victor,

I support the idea of sys.command. However, it would be unpopulated most of the time (e.g. set to None by default). Now, is that something we should push forward or not? I would work on a patch, but we should have an agreement first, I guess.


Mihail,

the original argv becomes modified in the very early bootstrap phase, and the command gets lost within that process: it gets *overwritten* with "-c", which is exactly why you are observing two "-c". This happens here:

https://hg.python.org/cpython/file/default/Modules/main.c#l684

So, no, without a code change in main.c there will be no way to retain the command for later usage.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue23427>
_______________________________________


More information about the Python-bugs-list mailing list