merge with 3.2

This commit is contained in:
Georg Brandl 2012-11-02 07:34:46 +01:00
commit ed71918d12
1 changed files with 10 additions and 12 deletions

View File

@ -66,18 +66,16 @@ perform some operation on a file. ::
return 0; return 0;
} }
Function :c:func:`Py_SetProgramName` should be called before The :c:func:`Py_SetProgramName` function should be called before
:c:func:`Py_Initialize` to inform the interpreter about paths to :c:func:`Py_Initialize` to inform the interpreter about paths to Python run-time
Python run-time libraries. Next initialize the Python interpreter libraries. Next, the Python interpreter is initialized with
with :c:func:`Py_Initialize`, followed by the execution of a :c:func:`Py_Initialize`, followed by the execution of a hard-coded Python script
hard-coded Python script that prints the date and time. Afterwards, that prints the date and time. Afterwards, the :c:func:`Py_Finalize` call shuts
the :c:func:`Py_Finalize` call shuts the interpreter down, followed by the interpreter down, followed by the end of the program. In a real program,
the end of the program. In a real program, you may want to get the you may want to get the Python script from another source, perhaps a text-editor
Python script from another source, perhaps a text-editor routine, a routine, a file, or a database. Getting the Python code from a file can better
file, or a database. Getting the Python code from a file can better be done by using the :c:func:`PyRun_SimpleFile` function, which saves you the
be done by using the :c:func:`PyRun_SimpleFile` function, which saves trouble of allocating memory space and loading the file contents.
you the trouble of allocating memory space and loading the file
contents.
.. _lower-level-embedding: .. _lower-level-embedding: