diff options
author | Benjamin Peterson <benjamin@python.org> | 2009-01-18 04:01:18 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2009-01-18 04:01:18 (GMT) |
commit | afd7eaadb082aac48bc6fbd21b39a371b718f8c0 (patch) | |
tree | ef65a416fde880a1c9f7cfcbc5aab01a235086c1 /Lib/multiprocessing | |
parent | 0293c804101f76796e1bf826717edd3417b2c431 (diff) | |
download | cpython-afd7eaadb082aac48bc6fbd21b39a371b718f8c0.zip cpython-afd7eaadb082aac48bc6fbd21b39a371b718f8c0.tar.gz cpython-afd7eaadb082aac48bc6fbd21b39a371b718f8c0.tar.bz2 |
Merged revisions 68708 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r68708 | jesse.noller | 2009-01-17 20:45:38 -0600 (Sat, 17 Jan 2009) | 1 line
Resolve issue 4449: AssertionError in mp_benchmarks.py
........
Diffstat (limited to 'Lib/multiprocessing')
-rw-r--r-- | Lib/multiprocessing/sharedctypes.py | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/Lib/multiprocessing/sharedctypes.py b/Lib/multiprocessing/sharedctypes.py index 0054ff1..76b5e94 100644 --- a/Lib/multiprocessing/sharedctypes.py +++ b/Lib/multiprocessing/sharedctypes.py @@ -69,9 +69,12 @@ def Value(typecode_or_type, *args, **kwds): if kwds: raise ValueError('unrecognized keyword argument(s): %s' % kwds.keys()) obj = RawValue(typecode_or_type, *args) - if lock is None: + if lock is False: + return obj + if lock in (True, None): lock = RLock() - assert hasattr(lock, 'acquire') + if not hasattr(lock, 'acquire'): + raise AttributeError("'%r' has no method 'acquire'" % lock) return synchronized(obj, lock) def Array(typecode_or_type, size_or_initializer, **kwds): @@ -82,9 +85,12 @@ def Array(typecode_or_type, size_or_initializer, **kwds): if kwds: raise ValueError('unrecognized keyword argument(s): %s' % kwds.keys()) obj = RawArray(typecode_or_type, size_or_initializer) - if lock is None: + if lock is False: + return obj + if lock in (True, None): lock = RLock() - assert hasattr(lock, 'acquire') + if not hasattr(lock, 'acquire'): + raise AttributeError("'%r' has no method 'acquire'" % lock) return synchronized(obj, lock) def copy(obj): |