[Python-Dev] r85028 - in python/branches/py3k: Doc/c-api/init.rst Include/pythonrun.h Modules/getpath.c PC/getpathp.c

Georg Brandl g.brandl at gmx.net
Mon Sep 27 16:57:40 CEST 2010


Am 27.09.2010 07:32, schrieb kristjan.jonsson:
> Author: kristjan.jonsson
> Date: Mon Sep 27 07:32:54 2010
> New Revision: 85028
> 
> Log:
> issue 9910
> Add a Py_SetPath api to override magic path computations when starting up python.
> 
> Modified:
>    python/branches/py3k/Doc/c-api/init.rst
>    python/branches/py3k/Include/pythonrun.h
>    python/branches/py3k/Modules/getpath.c
>    python/branches/py3k/PC/getpathp.c
> 
> Modified: python/branches/py3k/Doc/c-api/init.rst

> +.. cfunction::  void Py_SetPath(const wchar_t *)
> +
> +   .. index::
> +      triple: module; search; path
> +      single: path (in module sys)
> +      single: Py_GetPath()
> +
> +   Set the default module search path.  If this function is called before
> +   :cfunc: `Py_Initialize` then :cfunc: Py_GetPath won't attempt to compute
> +   a default serarch path but uses the provided one in stead.  This is useful
> +   if Python is being embedded by an application that has full knowledge
> +   of the location of all modules.  The path components should be separated
> +   by semicolons.
> +
> +   This also causes `sys.executable` to be set only to the raw program name
> +   (see :cfunc:`Py_SetProgramName`) and `for sys.prefix` and
> +   `sys.exec_prefix` to be empty.  It is up to the caller to modify these if
> +   required after calling :cfunc: `Py_Initialize`.
> +

This needs a versionadded.

Georg

-- 
Thus spake the Lord: Thou shalt indent with four spaces. No more, no less.
Four shall be the number of spaces thou shalt indent, and the number of thy
indenting shall be four. Eight shalt thou not indent, nor either indent thou
two, excepting that thou then proceed to four. Tabs are right out.



More information about the Python-Dev mailing list