cpython: 94d0e842b9ea (original) (raw)

Mercurial > cpython

changeset 91954:94d0e842b9ea

Issue #18395, #22108: Update embedded Python examples to decode correctly command line parameters: use Py_DecodeLocale() and PyUnicode_DecodeFSDefault(). [#18395]

Victor Stinner victor.stinner@gmail.com
date Fri, 01 Aug 2014 12:28:49 +0200
parents 93a798c7f270
children 118d6f49d6d6
files Doc/c-api/init.rst Doc/extending/embedding.rst Doc/extending/extending.rst Doc/includes/run-func.c
diffstat 4 files changed, 40 insertions(+), 9 deletions(-)[+] [-] Doc/c-api/init.rst 15 Doc/extending/embedding.rst 20 Doc/extending/extending.rst 12 Doc/includes/run-func.c 2

line wrap: on

line diff

--- a/Doc/c-api/init.rst +++ b/Doc/c-api/init.rst @@ -134,6 +134,9 @@ Process-wide parameters change for the duration of the program's execution. No code in the Python interpreter will change the contents of this storage.

.. c:function:: wchar* Py_GetProgramName() @@ -243,6 +246,9 @@ Process-wide parameters :data:sys.exec_prefix to be empty. It is up to the caller to modify these if required after calling :c:func:Py_Initialize.

.. c:function:: const char* Py_GetVersion() @@ -339,6 +345,9 @@ Process-wide parameters :data:sys.path, which is the same as prepending the current working directory (".").

@@ -377,6 +389,9 @@ Process-wide parameters execution. No code in the Python interpreter will change the contents of this storage.

.. c:function:: w_char* Py_GetPythonHome()

--- a/Doc/extending/embedding.rst +++ b/Doc/extending/embedding.rst @@ -58,12 +58,18 @@ perform some operation on a file. :: int main(int argc, char *argv[]) {

--- a/Doc/extending/extending.rst +++ b/Doc/extending/extending.rst @@ -370,11 +370,17 @@ optionally followed by an import of the int main(int argc, char *argv[]) {

+ /* Add a built-in module, before Py_Initialize / PyImport_AppendInittab("spam", PyInit_spam); / Pass argv[0] to the Python interpreter */

/* Initialize the Python interpreter. Required. */ Py_Initialize(); @@ -386,6 +392,10 @@ optionally followed by an import of the ...

.. note:: Removing entries from sys.modules or importing compiled modules into

--- a/Doc/includes/run-func.c +++ b/Doc/includes/run-func.c @@ -13,7 +13,7 @@ main(int argc, char *argv[]) } Py_Initialize();