From 3aa0c9dcf3af9c7a17cadeb79de960ba025a0c29 Mon Sep 17 00:00:00 2001 From: Georg Brandl Date: Sun, 1 Jul 2012 09:43:20 +0200 Subject: [PATCH 1/2] Fix inconsistent function name in embedding howto. --- Doc/extending/embedding.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/extending/embedding.rst b/Doc/extending/embedding.rst index 3143c990e5f..d004d244c4d 100644 --- a/Doc/extending/embedding.rst +++ b/Doc/extending/embedding.rst @@ -155,13 +155,13 @@ for data conversion between Python and C, and for error reporting. The interesting part with respect to embedding Python starts with :: Py_Initialize(); - pName = PyString_FromString(argv[1]); + pName = PyUnicode_FromString(argv[1]); /* Error checking of pName left out */ pModule = PyImport_Import(pName); After initializing the interpreter, the script is loaded using :c:func:`PyImport_Import`. This routine needs a Python string as its argument, -which is constructed using the :c:func:`PyString_FromString` data conversion +which is constructed using the :c:func:`PyUnicode_FromString` data conversion routine. :: pFunc = PyObject_GetAttrString(pModule, argv[2]); From 29feb1ffcaa45335c33fc0a8bade83304b238744 Mon Sep 17 00:00:00 2001 From: Georg Brandl Date: Sun, 1 Jul 2012 09:47:54 +0200 Subject: [PATCH 2/2] Make call of os.getppid() conditional: it is not available on Windows. --- Doc/library/multiprocessing.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Doc/library/multiprocessing.rst b/Doc/library/multiprocessing.rst index a9512f3358a..f503f4dfb41 100644 --- a/Doc/library/multiprocessing.rst +++ b/Doc/library/multiprocessing.rst @@ -79,7 +79,8 @@ To show the individual process IDs involved, here is an expanded example:: def info(title): print(title) print('module name:', __name__) - print('parent process:', os.getppid()) + if hasattr(os, 'getppid'): # only available on Unix + print('parent process:', os.getppid()) print('process id:', os.getpid()) def f(name):