[Python-checkins] cpython (2.7): Make call of os.getppid() conditional: it is not available on Windows.

georg.brandl python-checkins at python.org
Sun Jul 1 09:47:49 CEST 2012


http://hg.python.org/cpython/rev/65dd71ebf28f
changeset:   77906:65dd71ebf28f
branch:      2.7
user:        Georg Brandl <georg at python.org>
date:        Sun Jul 01 09:47:54 2012 +0200
summary:
  Make call of os.getppid() conditional: it is not available on Windows.

files:
  Doc/library/multiprocessing.rst |  3 ++-
  1 files changed, 2 insertions(+), 1 deletions(-)


diff --git a/Doc/library/multiprocessing.rst b/Doc/library/multiprocessing.rst
--- a/Doc/library/multiprocessing.rst
+++ b/Doc/library/multiprocessing.rst
@@ -81,7 +81,8 @@
     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):

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list