diff options
Diffstat (limited to 'Lib/multiprocessing')
-rw-r--r-- | Lib/multiprocessing/synchronize.py | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/Lib/multiprocessing/synchronize.py b/Lib/multiprocessing/synchronize.py index 8e994df..7f4718c 100644 --- a/Lib/multiprocessing/synchronize.py +++ b/Lib/multiprocessing/synchronize.py @@ -58,8 +58,12 @@ class SemLock(object): def _make_methods(self): self.acquire = self._semlock.acquire self.release = self._semlock.release - self.__enter__ = self._semlock.__enter__ - self.__exit__ = self._semlock.__exit__ + + def __enter__(self): + return self._semlock.__enter__() + + def __exit__(self, *args): + return self._semlock.__exit__(*args) def __getstate__(self): assert_spawning(self) @@ -181,11 +185,15 @@ class Condition(object): self._woken_count, self._wait_semaphore) = state self._make_methods() + def __enter__(self): + return self._lock.__enter__() + + def __exit__(self, *args): + return self._lock.__exit__(*args) + def _make_methods(self): self.acquire = self._lock.acquire self.release = self._lock.release - self.__enter__ = self._lock.__enter__ - self.__exit__ = self._lock.__exit__ def __repr__(self): try: |