This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
| Author | mishok13 |
|---|---|
| Recipients | jnoller, mishok13, roudkerk |
| Date | 2008年06月26日.09:53:13 |
| SpamBayes Score | 0.015990458 |
| Marked as misclassified | No |
| Message-id | <1214473998.34.0.913565828871.issue3206@psf.upfronthosting.co.za> |
| In-reply-to |
| Content | |
|---|---|
multiprocessing.sharedctypes.Array and
multiprocessing.sharedctypes.Value if used according to documentation
fail with AssertionError.
Python 3.0b1+ (py3k:64518, Jun 25 2008, 12:52:38)
[GCC 4.2.3 (Ubuntu 4.2.3-2ubuntu7)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from multiprocessing import sharedctypes
>>> sharedctypes.Array('i', 1, lock=True)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.0/multiprocessing/sharedctypes.py", line
88, in Array
assert hasattr(lock, 'acquire')
AssertionError
>>> sharedctypes.Array('i', 1, lock=False)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.0/multiprocessing/sharedctypes.py", line
88, in Array
assert hasattr(lock, 'acquire')
AssertionError
>>> sharedctypes.Array('i', 1, lock=None)
<SynchronizedArray wrapper for
<multiprocessing.sharedctypes.c_long_Array_1 object at 0x83214f4>>
>>> Value('i', lock=True)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.0/multiprocessing/__init__.py", line 246,
in Value
return Value(typecode_or_type, *args, **kwds)
File "/usr/local/lib/python3.0/multiprocessing/sharedctypes.py", line
75, in Value
assert hasattr(lock, 'acquire')
AssertionError
The same goes for multiprocessing.Array and multiprocessing.Value.
Comparing code to documentation it's obvious that lock argument can be
one of Lock, RLock or None objects (or any object with "acquire"
attribute), but not True or False. Also, looking at the code it seems
strange to me that 'lock' is a keyword-only argument. Why not use simple
default argument "lock=None" for Array() function?
Proposed patch tries to address these issues. |
|
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2008年06月26日 09:53:19 | mishok13 | set | spambayes_score: 0.0159905 -> 0.015990458 recipients: + mishok13, roudkerk, jnoller |
| 2008年06月26日 09:53:18 | mishok13 | set | spambayes_score: 0.0159905 -> 0.0159905 messageid: <1214473998.34.0.913565828871.issue3206@psf.upfronthosting.co.za> |
| 2008年06月26日 09:53:16 | mishok13 | link | issue3206 messages |
| 2008年06月26日 09:53:14 | mishok13 | create | |