[Python-checkins] [Python-Dev] r85839 - python/branches/py3k/Python/sysmodule.c

Stefan Krah stefan-usenet at bytereef.org
Mon Oct 25 21:01:21 CEST 2010


Antoine Pitrou <solipsis at pitrou.net> wrote:
> On Mon, 25 Oct 2010 19:37:23 +0200 (CEST)
> victor.stinner <python-checkins at python.org> wrote:
> >  
> > -    if (argc == 0)
> > -        return;
> >      argv0 = argv[0];
> 
> Well, are you sure argv[0] is valid when argc is 0?
> 

After r85295 sys.path did not contain the empty string, so I asked
Victor to change it back (thanks!). As far as I can see, the behavior
now is the same as before r85295, and sys.path contains the empty
string again.

argv[0] contains NULL argc is 0, later on PyUnicode_FromWideChar apparently
can handle NULL if size is also 0. The logic is not very optimal though.
Code blocks that could fail are protected by _HAVE_SCRIPT_ARGUMENT and
the fact that nr is still 0 and p is still NULL if _HAVE_SCRIPT_ARGUMENT
is false.


Stefan




More information about the Python-checkins mailing list