Skip to content

Commit 5713b2a

Browse files
author
georg.brandl
committed
#5144: document that PySys_SetArgv prepends the script directory (or the empty string) to sys.path.
git-svn-id: http://svn.python.org/projects/python/trunk@69289 6015fed2-1504-0410-9fe1-9d1591cc4771
1 parent c8f3438 commit 5713b2a

1 file changed

Lines changed: 11 additions & 7 deletions

File tree

Doc/c-api/init.rst

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -353,13 +353,17 @@ Initialization, Finalization, and Threads
353353
single: Py_FatalError()
354354
single: argv (in module sys)
355355

356-
Set ``sys.argv`` based on *argc* and *argv*. These parameters are similar to
357-
those passed to the program's :cfunc:`main` function with the difference that
358-
the first entry should refer to the script file to be executed rather than the
359-
executable hosting the Python interpreter. If there isn't a script that will be
360-
run, the first entry in *argv* can be an empty string. If this function fails
361-
to initialize ``sys.argv``, a fatal condition is signalled using
362-
:cfunc:`Py_FatalError`.
356+
Set :data:`sys.argv` based on *argc* and *argv*. These parameters are
357+
similar to those passed to the program's :cfunc:`main` function with the
358+
difference that the first entry should refer to the script file to be
359+
executed rather than the executable hosting the Python interpreter. If there
360+
isn't a script that will be run, the first entry in *argv* can be an empty
361+
string. If this function fails to initialize :data:`sys.argv`, a fatal
362+
condition is signalled using :cfunc:`Py_FatalError`.
363+
364+
This function also prepends the executed script's path to :data:`sys.path`.
365+
If no script is executed (in the case of calling ``python -c`` or just the
366+
interactive interpreter), the empty string is used instead.
363367

364368
.. XXX impl. doesn't seem consistent in allowing 0/NULL for the params;
365369
check w/ Guido.

0 commit comments

Comments
 (0)