Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiprocessing.Array(lock=False) fails #51344

Closed
schlesin mannequin opened this issue Oct 9, 2009 · 5 comments
Closed

Multiprocessing.Array(lock=False) fails #51344

schlesin mannequin opened this issue Oct 9, 2009 · 5 comments
Labels
extension-modules C modules in the Modules dir type-bug An unexpected behavior, bug, or error

Comments

@schlesin
Copy link
Mannequin

schlesin mannequin commented Oct 9, 2009

BPO 7095

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = <Date 2009-10-10.02:58:41.680>
created_at = <Date 2009-10-09.23:13:17.259>
labels = ['extension-modules', 'type-bug']
title = 'Multiprocessing.Array(lock=False) fails'
updated_at = <Date 2009-10-10.02:58:41.679>
user = 'https://bugs.python.org/schlesin'

bugs.python.org fields:

activity = <Date 2009-10-10.02:58:41.679>
actor = 'jnoller'
assignee = 'jnoller'
closed = True
closed_date = <Date 2009-10-10.02:58:41.680>
closer = 'jnoller'
components = ['Extension Modules']
creation = <Date 2009-10-09.23:13:17.259>
creator = 'schlesin'
dependencies = []
files = []
hgrepos = []
issue_num = 7095
keywords = []
message_count = 5.0
messages = ['93812', '93813', '93814', '93817', '93819']
nosy_count = 3.0
nosy_names = ['ggenellina', 'jnoller', 'schlesin']
pr_nums = []
priority = 'normal'
resolution = 'duplicate'
stage = None
status = 'closed'
superseder = None
type = 'behavior'
url = 'https://bugs.python.org/issue7095'
versions = ['Python 2.6']

@schlesin
Copy link
Mannequin Author

schlesin mannequin commented Oct 9, 2009

The documentation for the Multiprocessing.Array says:

multiprocessing.Array(typecode_or_type, size_or_initializer, *,
lock=True)¶

...
If lock is False then access to the returned object will not be
automatically protected by a lock, so it will not necessarily be
“process-safe”.
...

However:
In [48]: mp.Array('i',1,lock=False)
---------------------------------------------------------------------------

AssertionError                            Traceback (most recent call
last)

/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/
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,
**kwds)
255
256 #

/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/
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)
89

AssertionError:

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

@schlesin schlesin mannequin added extension-modules C modules in the Modules dir type-bug An unexpected behavior, bug, or error labels Oct 9, 2009
@jnoller
Copy link
Mannequin

jnoller mannequin commented Oct 9, 2009

schlesin - what platform are you on, and what version of 2.6?

@schlesin
Copy link
Mannequin Author

schlesin mannequin commented Oct 10, 2009

Happens both on
Python 2.6 (r26:66714, Jul 25 2009, 11:30:23)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-44)] on linux2
and
Python 2.6.1 (r261:67515, Dec 6 2008, 16:42:21)
[GCC 4.0.1 (Apple Computer, Inc. build 5370)] on darwin

@ggenellina
Copy link
Mannequin

ggenellina mannequin commented Oct 10, 2009

Fixed in r68708 - upgrading to 2.6.2 should solve this.

@jnoller
Copy link
Mannequin

jnoller mannequin commented Oct 10, 2009

Gabriel is right, I'm really hoping Apple includes an upgrade including
2.6.4 once it's buttoned down

@jnoller jnoller mannequin closed this as completed Oct 10, 2009
@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
extension-modules C modules in the Modules dir type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

0 participants