summaryrefslogtreecommitdiffstats
path: root/Lib/multiprocessing
diff options
context:
space:
mode:
authorJesse Noller <jnoller@gmail.com>2009-01-18 03:11:38 (GMT)
committerJesse Noller <jnoller@gmail.com>2009-01-18 03:11:38 (GMT)
commitb0516a6bc6cdc580846b075bc27b1d3281dd6295 (patch)
tree051beb24dbf3d805f6b8f1fd054c68031d1582bc /Lib/multiprocessing
parent34f9b4c6f1b4129d8ded2cfd580687295bc9cb63 (diff)
downloadcpython-b0516a6bc6cdc580846b075bc27b1d3281dd6295.zip
cpython-b0516a6bc6cdc580846b075bc27b1d3281dd6295.tar.gz
cpython-b0516a6bc6cdc580846b075bc27b1d3281dd6295.tar.bz2
Merge r68708 to py3k, fixes 4449
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 b94cd52..1976277 100644
--- a/Lib/multiprocessing/sharedctypes.py
+++ b/Lib/multiprocessing/sharedctypes.py
@@ -66,9 +66,12 @@ def Value(typecode_or_type, *args, lock=None):
Return a synchronization wrapper for a Value
'''
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):
@@ -79,9 +82,12 @@ def Array(typecode_or_type, size_or_initializer, **kwds):
if kwds:
raise ValueError('unrecognized keyword argument(s): %s' % list(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):