diff options
author | Benjamin Peterson <benjamin@python.org> | 2009-06-01 23:14:51 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2009-06-01 23:14:51 (GMT) |
commit | 8cc7d88bbcae32e5b7e12b0c4cfe34de2cff8166 (patch) | |
tree | a344b56e92dc8a1b6a0e6d58c98788c883e28165 /Lib/multiprocessing/synchronize.py | |
parent | be5f3712be7aeb7fee4698a24bcf44ffd98a7b1d (diff) | |
download | cpython-8cc7d88bbcae32e5b7e12b0c4cfe34de2cff8166.zip cpython-8cc7d88bbcae32e5b7e12b0c4cfe34de2cff8166.tar.gz cpython-8cc7d88bbcae32e5b7e12b0c4cfe34de2cff8166.tar.bz2 |
Merged revisions 73073-73074,73089 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r73073 | benjamin.peterson | 2009-05-31 09:43:00 -0500 (Sun, 31 May 2009) | 1 line
remove function import
........
r73074 | benjamin.peterson | 2009-05-31 10:00:27 -0500 (Sun, 31 May 2009) | 1 line
__enter__ and __exit__ must be on the class
........
r73089 | andrew.kuchling | 2009-05-31 19:14:19 -0500 (Sun, 31 May 2009) | 1 line
The class for regexes isn't called RegexObject any more; correct the text
........
Diffstat (limited to 'Lib/multiprocessing/synchronize.py')
-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: |