[New-bugs-announce] [issue7095] Multiprocessing.Array(lock=False) fails

schlesin report at bugs.python.org
Sat Oct 10 01:13:18 CEST 2009

New submission from schlesin <schlesin at cshl.edu>:

The documentation for the Multiprocessing.Array says:

multiprocessing.Array(typecode_or_type, size_or_initializer, *,

If lock is False then access to the returned object will not be
automatically protected by a lock, so it will not necessarily be

In [48]: mp.Array('i',1,lock=False)
AssertionError                            Traceback (most recent call

multiprocessing/__init__.pyc in Array(typecode_or_type,
size_or_initializer, **kwds)
    252     '''
    253     from multiprocessing.sharedctypes import Array
--> 254     return Array(typecode_or_type, size_or_initializer,
    256 #

multiprocessing/sharedctypes.pyc in Array(typecode_or_type,
size_or_initializer, **kwds)
     85     if lock is None:
     86         lock = RLock()
---> 87     assert hasattr(lock, 'acquire')
     88     return synchronized(obj, lock)


I.e. it looks like lock=False is not actually supported.

components: Extension Modules
messages: 93812
nosy: schlesin
severity: normal
status: open
title: Multiprocessing.Array(lock=False) fails
type: behavior
versions: Python 2.6

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list