summaryrefslogtreecommitdiffstats
path: root/Lib/multiprocessing/sharedctypes.py
diff options
context:
space:
mode:
authorMark Dickinson <mdickinson@enthought.com>2011-03-26 10:02:37 (GMT)
committerMark Dickinson <mdickinson@enthought.com>2011-03-26 10:02:37 (GMT)
commitd3cb2f6e2cd837bd6a0258a8e4e6699d703cf8b4 (patch)
tree1a8a2ecc8825b6cea316009dbab7fe6287f8127e /Lib/multiprocessing/sharedctypes.py
parent254d4b851d67adc6e5a6660eb76309bf8af0abc8 (diff)
downloadcpython-d3cb2f6e2cd837bd6a0258a8e4e6699d703cf8b4.zip
cpython-d3cb2f6e2cd837bd6a0258a8e4e6699d703cf8b4.tar.gz
cpython-d3cb2f6e2cd837bd6a0258a8e4e6699d703cf8b4.tar.bz2
Issue #11675: Zero-out newly-created multiprocessing.[Raw]Array objects.
Diffstat (limited to 'Lib/multiprocessing/sharedctypes.py')
-rw-r--r--Lib/multiprocessing/sharedctypes.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/Lib/multiprocessing/sharedctypes.py b/Lib/multiprocessing/sharedctypes.py
index 2430be7..1eb044d 100644
--- a/Lib/multiprocessing/sharedctypes.py
+++ b/Lib/multiprocessing/sharedctypes.py
@@ -80,7 +80,9 @@ def RawArray(typecode_or_type, size_or_initializer):
type_ = typecode_to_type.get(typecode_or_type, typecode_or_type)
if isinstance(size_or_initializer, (int, long)):
type_ = type_ * size_or_initializer
- return _new_value(type_)
+ obj = _new_value(type_)
+ ctypes.memset(ctypes.addressof(obj), 0, ctypes.sizeof(obj))
+ return obj
else:
type_ = type_ * len(size_or_initializer)
result = _new_value(type_)