summaryrefslogtreecommitdiffstats
path: root/Lib/multiprocessing/util.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/multiprocessing/util.py')
-rw-r--r--Lib/multiprocessing/util.py14
1 files changed, 11 insertions, 3 deletions
diff --git a/Lib/multiprocessing/util.py b/Lib/multiprocessing/util.py
index 0b695e4..ea5443d 100644
--- a/Lib/multiprocessing/util.py
+++ b/Lib/multiprocessing/util.py
@@ -212,10 +212,11 @@ class Finalize(object):
obj = None
if obj is None:
- return '<Finalize object, dead>'
+ return '<%s object, dead>' % self.__class__.__name__
- x = '<Finalize object, callback=%s' % \
- getattr(self._callback, '__name__', self._callback)
+ x = '<%s object, callback=%s' % (
+ self.__class__.__name__,
+ getattr(self._callback, '__name__', self._callback))
if self._args:
x += ', args=' + str(self._args)
if self._kwargs:
@@ -327,6 +328,13 @@ class ForkAwareThreadLock(object):
self.acquire = self._lock.acquire
self.release = self._lock.release
+ def __enter__(self):
+ return self._lock.__enter__()
+
+ def __exit__(self, *args):
+ return self._lock.__exit__(*args)
+
+
class ForkAwareLocal(threading.local):
def __init__(self):
register_after_fork(self, lambda obj : obj.__dict__.clear())