[Python-checkins] cpython: Make Finalize reserve a reference to os.getpid in case called at shutdown

richard.oudkerk python-checkins at python.org
Mon Jun 4 20:01:05 CEST 2012


http://hg.python.org/cpython/rev/9257ea91df3d
changeset:   77347:9257ea91df3d
user:        Richard Oudkerk <shibturn at gmail.com>
date:        Mon Jun 04 18:58:59 2012 +0100
summary:
  Make Finalize reserve a reference to os.getpid in case called at shutdown

files:
  Lib/multiprocessing/util.py |  4 ++--
  1 files changed, 2 insertions(+), 2 deletions(-)


diff --git a/Lib/multiprocessing/util.py b/Lib/multiprocessing/util.py
--- a/Lib/multiprocessing/util.py
+++ b/Lib/multiprocessing/util.py
@@ -170,7 +170,7 @@
                  # Need to bind these locally because the globals can have
                  # been cleared at shutdown
                  _finalizer_registry=_finalizer_registry,
-                 sub_debug=sub_debug):
+                 sub_debug=sub_debug, getpid=os.getpid):
         '''
         Run the callback unless it has already been called or cancelled
         '''
@@ -179,7 +179,7 @@
         except KeyError:
             sub_debug('finalizer no longer registered')
         else:
-            if self._pid != os.getpid():
+            if self._pid != getpid():
                 sub_debug('finalizer ignored because different process')
                 res = None
             else:

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


More information about the Python-checkins mailing list