From: Antoine Pitrou Date: Fri, 8 Jul 2011 23:03:00 +0000 (+0200) Subject: Rebind locally the globals which can be looked up at shutdown X-Git-Tag: v3.3.0a1~1934 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=71a28a91744b5cf6f881769300818232750de6d2;p=python Rebind locally the globals which can be looked up at shutdown (to avoid the warnings seen on a buildbot) --- diff --git a/Lib/multiprocessing/connection.py b/Lib/multiprocessing/connection.py index ede2908eec..2661898f9f 100644 --- a/Lib/multiprocessing/connection.py +++ b/Lib/multiprocessing/connection.py @@ -290,8 +290,8 @@ if win32: """ _buffered = b'' - def _close(self): - win32.CloseHandle(self._handle) + def _close(self, _CloseHandle=win32.CloseHandle): + _CloseHandle(self._handle) def _send_bytes(self, buf): overlapped = win32.WriteFile(self._handle, buf, overlapped=True) @@ -376,13 +376,13 @@ class Connection(_ConnectionBase): """ if win32: - def _close(self): - win32.closesocket(self._handle) + def _close(self, _close=win32.closesocket): + _close(self._handle) _write = win32.send _read = win32.recv else: - def _close(self): - os.close(self._handle) + def _close(self, _close=os.close): + _close(self._handle) _write = os.write _read = os.read diff --git a/Lib/multiprocessing/util.py b/Lib/multiprocessing/util.py index b59ac9fc61..c48718026b 100644 --- a/Lib/multiprocessing/util.py +++ b/Lib/multiprocessing/util.py @@ -188,7 +188,11 @@ class Finalize(object): _finalizer_registry[self._key] = self - def __call__(self, wr=None): + def __call__(self, wr=None, + # Need to bind these locally because the globals can have + # been cleared at shutdown + _finalizer_registry=_finalizer_registry, + sub_debug=sub_debug): ''' Run the callback unless it has already been called or cancelled '''