summaryrefslogtreecommitdiffstats
path: root/Lib/multiprocessing
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2009-01-18 04:01:18 (GMT)
committerBenjamin Peterson <benjamin@python.org>2009-01-18 04:01:18 (GMT)
commitafd7eaadb082aac48bc6fbd21b39a371b718f8c0 (patch)
treeef65a416fde880a1c9f7cfcbc5aab01a235086c1 /Lib/multiprocessing
parent0293c804101f76796e1bf826717edd3417b2c431 (diff)
downloadcpython-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.py14
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):