diff options
| author | Mark Dickinson <mdickinson@enthought.com> | 2011-03-26 10:02:37 (GMT) |
|---|---|---|
| committer | Mark Dickinson <mdickinson@enthought.com> | 2011-03-26 10:02:37 (GMT) |
| commit | d3cb2f6e2cd837bd6a0258a8e4e6699d703cf8b4 (patch) | |
| tree | 1a8a2ecc8825b6cea316009dbab7fe6287f8127e /Lib/test/test_multiprocessing.py | |
| parent | 254d4b851d67adc6e5a6660eb76309bf8af0abc8 (diff) | |
| download | cpython-d3cb2f6e2cd837bd6a0258a8e4e6699d703cf8b4.zip cpython-d3cb2f6e2cd837bd6a0258a8e4e6699d703cf8b4.tar.gz cpython-d3cb2f6e2cd837bd6a0258a8e4e6699d703cf8b4.tar.bz2 | |
Issue #11675: Zero-out newly-created multiprocessing.[Raw]Array objects.
Diffstat (limited to 'Lib/test/test_multiprocessing.py')
| -rw-r--r-- | Lib/test/test_multiprocessing.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/Lib/test/test_multiprocessing.py b/Lib/test/test_multiprocessing.py index bdfc171..0df2f78 100644 --- a/Lib/test/test_multiprocessing.py +++ b/Lib/test/test_multiprocessing.py @@ -914,6 +914,21 @@ class _TestArray(BaseTestCase): self.assertEqual(list(arr[:]), seq) @unittest.skipIf(c_int is None, "requires _ctypes") + def test_array_from_size(self): + size = 10 + # Test for zeroing (see issue #11675). + # The repetition below strengthens the test by increasing the chances + # of previously allocated non-zero memory being used for the new array + # on the 2nd and 3rd loops. + for _ in range(3): + arr = self.Array('i', size) + self.assertEqual(len(arr), size) + self.assertEqual(list(arr), [0] * size) + arr[:] = range(10) + self.assertEqual(list(arr), range(10)) + del arr + + @unittest.skipIf(c_int is None, "requires _ctypes") def test_rawarray(self): self.test_array(raw=True) |
