| 1 |
cp -rf py3.10/examples . |
| 2 |
cp -rf py3.10/doc . |
| 3 |
cp -f py3.10/index.html . |
| 4 |
cp -rf py3.10/_multiprocess _multiprocess |
| 5 |
cp -rf py3.10/multiprocess multiprocess |
| 6 |
cp -rf py3.10/Modules/_multiprocess Modules/_multiprocess |
| 7 |
# ---------------------------------------------------------------------- |
| 8 |
diff Python-3.10.0rc2/Lib/multiprocessing/connection.py Python-3.11.0a1/Lib/multiprocessing/connection.py |
| 9 |
946c946 |
| 10 |
< # Make connection and socket objects sharable if possible |
| 11 |
--- |
| 12 |
> # Make connection and socket objects shareable if possible |
| 13 |
diff Python-3.10.0rc2/Lib/multiprocessing/managers.py Python-3.11.0a1/Lib/multiprocessing/managers.py |
| 14 |
1341d1340 |
| 15 |
< pass |
| 16 |
# ---------------------------------------------------------------------- |
| 17 |
diff Python-3.10.0rc2/Lib/test/_test_multiprocessing.py Python-3.11.0a1/Lib/test/_test_multiprocessing.py |
| 18 |
613a614 |
| 19 |
> gc.collect() # For PyPy or other GCs. |
| 20 |
2669a2671 |
| 21 |
> gc.collect() # For PyPy or other GCs. |
| 22 |
3773a3776,3781 |
| 23 |
> def _new_shm_name(self, prefix): |
| 24 |
> # Add a PID to the name of a POSIX shared memory object to allow |
| 25 |
> # running multiprocessing tests (test_multiprocessing_fork, |
| 26 |
> # test_multiprocessing_spawn, etc) in parallel. |
| 27 |
> return prefix + str(os.getpid()) |
| 28 |
> |
| 29 |
3775c3783,3784 |
| 30 |
< sms = shared_memory.SharedMemory('test01_tsmb', create=True, size=512) |
| 31 |
--- |
| 32 |
> name_tsmb = self._new_shm_name('test01_tsmb') |
| 33 |
> sms = shared_memory.SharedMemory(name_tsmb, create=True, size=512) |
| 34 |
3779c3788 |
| 35 |
< self.assertEqual(sms.name, 'test01_tsmb') |
| 36 |
--- |
| 37 |
> self.assertEqual(sms.name, name_tsmb) |
| 38 |
3787,3793d3795 |
| 39 |
< # Test pickling |
| 40 |
< sms.buf[0:6] = b'pickle' |
| 41 |
< pickled_sms = pickle.dumps(sms) |
| 42 |
< sms2 = pickle.loads(pickled_sms) |
| 43 |
< self.assertEqual(sms.name, sms2.name) |
| 44 |
< self.assertEqual(bytes(sms.buf[0:6]), bytes(sms2.buf[0:6]), b'pickle') |
| 45 |
< |
| 46 |
3799c3801 |
| 47 |
< also_sms = shared_memory.SharedMemory('test01_tsmb') |
| 48 |
--- |
| 49 |
> also_sms = shared_memory.SharedMemory(name_tsmb) |
| 50 |
3804c3806 |
| 51 |
< same_sms = shared_memory.SharedMemory('test01_tsmb', size=20*sms.size) |
| 52 |
--- |
| 53 |
> same_sms = shared_memory.SharedMemory(name_tsmb, size=20*sms.size) |
| 54 |
3822c3824 |
| 55 |
< names = ['test01_fn', 'test02_fn'] |
| 56 |
--- |
| 57 |
> names = [self._new_shm_name('test01_fn'), self._new_shm_name('test02_fn')] |
| 58 |
3843a3846,3851 |
| 59 |
> name_dblunlink = self._new_shm_name('test01_dblunlink') |
| 60 |
> sms_uno = shared_memory.SharedMemory( |
| 61 |
> name_dblunlink, |
| 62 |
> create=True, |
| 63 |
> size=5000 |
| 64 |
> ) |
| 65 |
3845,3850d3852 |
| 66 |
< sms_uno = shared_memory.SharedMemory( |
| 67 |
< 'test01_dblunlink', |
| 68 |
< create=True, |
| 69 |
< size=5000 |
| 70 |
< ) |
| 71 |
< |
| 72 |
3854c3856 |
| 73 |
< sms_duo = shared_memory.SharedMemory('test01_dblunlink') |
| 74 |
--- |
| 75 |
> sms_duo = shared_memory.SharedMemory(name_dblunlink) |
| 76 |
3866c3868 |
| 77 |
< 'test01_tsmb', |
| 78 |
--- |
| 79 |
> name_tsmb, |
| 80 |
3880c3882 |
| 81 |
< ok_if_exists_sms = OptionalAttachSharedMemory('test01_tsmb') |
| 82 |
--- |
| 83 |
> ok_if_exists_sms = OptionalAttachSharedMemory(name_tsmb) |
| 84 |
3891a3894,3916 |
| 85 |
> def test_shared_memory_recreate(self): |
| 86 |
> # Test if shared memory segment is created properly, |
| 87 |
> # when _make_filename returns an existing shared memory segment name |
| 88 |
> with unittest.mock.patch( |
| 89 |
> 'multiprocessing.shared_memory._make_filename') as mock_make_filename: |
| 90 |
> |
| 91 |
> NAME_PREFIX = shared_memory._SHM_NAME_PREFIX |
| 92 |
> names = ['test01_fn', 'test02_fn'] |
| 93 |
> # Prepend NAME_PREFIX which can be '/psm_' or 'wnsm_', necessary |
| 94 |
> # because some POSIX compliant systems require name to start with / |
| 95 |
> names = [NAME_PREFIX + name for name in names] |
| 96 |
> |
| 97 |
> mock_make_filename.side_effect = names |
| 98 |
> shm1 = shared_memory.SharedMemory(create=True, size=1) |
| 99 |
> self.addCleanup(shm1.unlink) |
| 100 |
> self.assertEqual(shm1._name, names[0]) |
| 101 |
> |
| 102 |
> mock_make_filename.side_effect = names |
| 103 |
> shm2 = shared_memory.SharedMemory(create=True, size=1) |
| 104 |
> self.addCleanup(shm2.unlink) |
| 105 |
> self.assertEqual(shm2._name, names[1]) |
| 106 |
> |
| 107 |
> def test_invalid_shared_memory_cration(self): |
| 108 |
3903a3929,3969 |
| 109 |
> def test_shared_memory_pickle_unpickle(self): |
| 110 |
> for proto in range(pickle.HIGHEST_PROTOCOL + 1): |
| 111 |
> with self.subTest(proto=proto): |
| 112 |
> sms = shared_memory.SharedMemory(create=True, size=512) |
| 113 |
> self.addCleanup(sms.unlink) |
| 114 |
> sms.buf[0:6] = b'pickle' |
| 115 |
> |
| 116 |
> # Test pickling |
| 117 |
> pickled_sms = pickle.dumps(sms, protocol=proto) |
| 118 |
> |
| 119 |
> # Test unpickling |
| 120 |
> sms2 = pickle.loads(pickled_sms) |
| 121 |
> self.assertIsInstance(sms2, shared_memory.SharedMemory) |
| 122 |
> self.assertEqual(sms.name, sms2.name) |
| 123 |
> self.assertEqual(bytes(sms.buf[0:6]), b'pickle') |
| 124 |
> self.assertEqual(bytes(sms2.buf[0:6]), b'pickle') |
| 125 |
> |
| 126 |
> # Test that unpickled version is still the same SharedMemory |
| 127 |
> sms.buf[0:6] = b'newval' |
| 128 |
> self.assertEqual(bytes(sms.buf[0:6]), b'newval') |
| 129 |
> self.assertEqual(bytes(sms2.buf[0:6]), b'newval') |
| 130 |
> |
| 131 |
> sms2.buf[0:6] = b'oldval' |
| 132 |
> self.assertEqual(bytes(sms.buf[0:6]), b'oldval') |
| 133 |
> self.assertEqual(bytes(sms2.buf[0:6]), b'oldval') |
| 134 |
> |
| 135 |
> def test_shared_memory_pickle_unpickle_dead_object(self): |
| 136 |
> for proto in range(pickle.HIGHEST_PROTOCOL + 1): |
| 137 |
> with self.subTest(proto=proto): |
| 138 |
> sms = shared_memory.SharedMemory(create=True, size=512) |
| 139 |
> sms.buf[0:6] = b'pickle' |
| 140 |
> pickled_sms = pickle.dumps(sms, protocol=proto) |
| 141 |
> |
| 142 |
> # Now, we are going to kill the original object. |
| 143 |
> # So, unpickled one won't be able to attach to it. |
| 144 |
> sms.close() |
| 145 |
> sms.unlink() |
| 146 |
> |
| 147 |
> with self.assertRaises(FileNotFoundError): |
| 148 |
> pickle.loads(pickled_sms) |
| 149 |
> |
| 150 |
4085c4151,4152 |
| 151 |
< sl_copy = shared_memory.ShareableList(sl, name='test03_duplicate') |
| 152 |
--- |
| 153 |
> name_duplicate = self._new_shm_name('test03_duplicate') |
| 154 |
> sl_copy = shared_memory.ShareableList(sl, name=name_duplicate) |
| 155 |
4088c4155 |
| 156 |
< self.assertEqual('test03_duplicate', sl_copy.shm.name) |
| 157 |
--- |
| 158 |
> self.assertEqual(name_duplicate, sl_copy.shm.name) |
| 159 |
4120,4139c4187,4222 |
| 160 |
< sl = shared_memory.ShareableList(range(10)) |
| 161 |
< self.addCleanup(sl.shm.unlink) |
| 162 |
< |
| 163 |
< serialized_sl = pickle.dumps(sl) |
| 164 |
< deserialized_sl = pickle.loads(serialized_sl) |
| 165 |
< self.assertTrue( |
| 166 |
< isinstance(deserialized_sl, shared_memory.ShareableList) |
| 167 |
< ) |
| 168 |
< self.assertTrue(deserialized_sl[-1], 9) |
| 169 |
< self.assertFalse(sl is deserialized_sl) |
| 170 |
< deserialized_sl[4] = "changed" |
| 171 |
< self.assertEqual(sl[4], "changed") |
| 172 |
< |
| 173 |
< # Verify data is not being put into the pickled representation. |
| 174 |
< name = 'a' * len(sl.shm.name) |
| 175 |
< larger_sl = shared_memory.ShareableList(range(400)) |
| 176 |
< self.addCleanup(larger_sl.shm.unlink) |
| 177 |
< serialized_larger_sl = pickle.dumps(larger_sl) |
| 178 |
< self.assertTrue(len(serialized_sl) == len(serialized_larger_sl)) |
| 179 |
< larger_sl.shm.close() |
| 180 |
--- |
| 181 |
> for proto in range(pickle.HIGHEST_PROTOCOL + 1): |
| 182 |
> with self.subTest(proto=proto): |
| 183 |
> sl = shared_memory.ShareableList(range(10)) |
| 184 |
> self.addCleanup(sl.shm.unlink) |
| 185 |
> |
| 186 |
> serialized_sl = pickle.dumps(sl, protocol=proto) |
| 187 |
> deserialized_sl = pickle.loads(serialized_sl) |
| 188 |
> self.assertIsInstance( |
| 189 |
> deserialized_sl, shared_memory.ShareableList) |
| 190 |
> self.assertEqual(deserialized_sl[-1], 9) |
| 191 |
> self.assertIsNot(sl, deserialized_sl) |
| 192 |
> |
| 193 |
> deserialized_sl[4] = "changed" |
| 194 |
> self.assertEqual(sl[4], "changed") |
| 195 |
> sl[3] = "newvalue" |
| 196 |
> self.assertEqual(deserialized_sl[3], "newvalue") |
| 197 |
> |
| 198 |
> larger_sl = shared_memory.ShareableList(range(400)) |
| 199 |
> self.addCleanup(larger_sl.shm.unlink) |
| 200 |
> serialized_larger_sl = pickle.dumps(larger_sl, protocol=proto) |
| 201 |
> self.assertEqual(len(serialized_sl), len(serialized_larger_sl)) |
| 202 |
> larger_sl.shm.close() |
| 203 |
> |
| 204 |
> deserialized_sl.shm.close() |
| 205 |
> sl.shm.close() |
| 206 |
> |
| 207 |
> def test_shared_memory_ShareableList_pickling_dead_object(self): |
| 208 |
> for proto in range(pickle.HIGHEST_PROTOCOL + 1): |
| 209 |
> with self.subTest(proto=proto): |
| 210 |
> sl = shared_memory.ShareableList(range(10)) |
| 211 |
> serialized_sl = pickle.dumps(sl, protocol=proto) |
| 212 |
> |
| 213 |
> # Now, we are going to kill the original object. |
| 214 |
> # So, unpickled one won't be able to attach to it. |
| 215 |
> sl.shm.close() |
| 216 |
> sl.shm.unlink() |
| 217 |
4141,4142c4224,4225 |
| 218 |
< deserialized_sl.shm.close() |
| 219 |
< sl.shm.close() |
| 220 |
--- |
| 221 |
> with self.assertRaises(FileNotFoundError): |
| 222 |
> pickle.loads(serialized_sl) |
| 223 |
4178a4262,4268 |
| 224 |
> # Without this line it was raising warnings like: |
| 225 |
> # UserWarning: resource_tracker: |
| 226 |
> # There appear to be 1 leaked shared_memory |
| 227 |
> # objects to clean up at shutdown |
| 228 |
> # See: https://bugs.python.org/issue45209 |
| 229 |
> resource_tracker.unregister(f"/{name}", "shared_memory") |
| 230 |
> |
| 231 |
4188c4278 |
| 232 |
< # |
| 233 |
--- |
| 234 |
> # Test to verify that `Finalize` works. |
| 235 |
4199a4290 |
| 236 |
> gc.collect() # For PyPy or other GCs. |
| 237 |
4210a4302 |
| 238 |
> gc.collect() # For PyPy or other GCs. |
| 239 |
4216a4309 |
| 240 |
> gc.collect() # For PyPy or other GCs. |
| 241 |
g |
| 242 |
# ---------------------------------------------------------------------- |
| 243 |
diff Python-3.11.0a1/Lib/test/_test_multiprocessing.py py3.11/multiprocess/tests/__init__.py |
| 244 |
3821c3825 |
| 245 |
< 'multiprocessing.shared_memory._make_filename') as mock_make_filename: |
| 246 |
--- |
| 247 |
> 'multiprocess.shared_memory._make_filename') as mock_make_filename: |
| 248 |
3898c3902 |
| 249 |
< 'multiprocessing.shared_memory._make_filename') as mock_make_filename: |
| 250 |
--- |
| 251 |
> 'multiprocess.shared_memory._make_filename') as mock_make_filename: |
| 252 |
# ---------------------------------------------------------------------- |
| 253 |
diff Python-3.11.0a1/Modules/_multiprocessing/multiprocessing.c Python-3.11.0a3/Modules/_multiprocessing/multiprocessing.c |
| 254 |
189,190c189 |
| 255 |
< #if defined(MS_WINDOWS) || \ |
| 256 |
< (defined(HAVE_SEM_OPEN) && !defined(POSIX_SEMAPHORES_NOT_ENABLED)) |
| 257 |
--- |
| 258 |
> #ifdef HAVE_MP_SEMAPHORE |
| 259 |
diff Python-3.11.0a1/Modules/_multiprocessing/multiprocessing.h Python-3.11.0a3/Modules/_multiprocessing/multiprocessing.h |
| 260 |
23a24 |
| 261 |
> # define HAVE_MP_SEMAPHORE |
| 262 |
26a28 |
| 263 |
> # define HAVE_MP_SEMAPHORE |
| 264 |
diff Python-3.11.0a1/Modules/_multiprocessing/semaphore.c Python-3.11.0a3/Modules/_multiprocessing/semaphore.c |
| 265 |
11a12,13 |
| 266 |
> #ifdef HAVE_MP_SEMAPHORE |
| 267 |
> |
| 268 |
796a799,800 |
| 269 |
> |
| 270 |
> #endif // HAVE_MP_SEMAPHORE |
| 271 |
# ---------------------------------------------------------------------- |
| 272 |
cp Python-3.11.0a3/Modules/_multiprocessing/clinic/* py3.11/Modules/_multiprocess/clinic |
| 273 |
# ---------------------------------------------------------------------- |
| 274 |
diff Python-3.11.0a3/Lib/multiprocessing/synchronize.py Python-3.11.0a4/Lib/multiprocessing/synchronize.py |
| 275 |
355a356,358 |
| 276 |
> def __repr__(self) -> str: |
| 277 |
> set_status = 'set' if self.is_set() else 'unset' |
| 278 |
> return f"<{type(self).__qualname__} at {id(self):#x} {set_status}>" |
| 279 |
diff Python-3.11.0a3/Lib/test/_test_multiprocessing.py Python-3.11.0a4/Lib/test/_test_multiprocessing.py |
| 280 |
1648c1648,1661 |
| 281 |
< # |
| 282 |
--- |
| 283 |
> def test_repr(self) -> None: |
| 284 |
> event = self.Event() |
| 285 |
> if self.TYPE == 'processes': |
| 286 |
> self.assertRegex(repr(event), r"<Event at .* unset>") |
| 287 |
> event.set() |
| 288 |
> self.assertRegex(repr(event), r"<Event at .* set>") |
| 289 |
> event.clear() |
| 290 |
> self.assertRegex(repr(event), r"<Event at .* unset>") |
| 291 |
> elif self.TYPE == 'manager': |
| 292 |
> self.assertRegex(repr(event), r"<EventProxy object, typeid 'Event' at .*") |
| 293 |
> event.set() |
| 294 |
> self.assertRegex(repr(event), r"<EventProxy object, typeid 'Event' at .*") |
| 295 |
> |
| 296 |
> |
| 297 |
# ---------------------------------------------------------------------- |
| 298 |
diff Python-3.11.0a4/Lib/multiprocessing/managers.py Python-3.11.0a5/Lib/multiprocessing/managers.py |
| 299 |
52,56c52,56 |
| 300 |
< if view_types[0] is not list: # only needed in Py3.0 |
| 301 |
< def rebuild_as_list(obj): |
| 302 |
< return list, (list(obj),) |
| 303 |
< for view_type in view_types: |
| 304 |
< reduction.register(view_type, rebuild_as_list) |
| 305 |
--- |
| 306 |
> def rebuild_as_list(obj): |
| 307 |
> return list, (list(obj),) |
| 308 |
> for view_type in view_types: |
| 309 |
> reduction.register(view_type, rebuild_as_list) |
| 310 |
> del view_type, view_types |
| 311 |
diff Python-3.11.0a4/Lib/multiprocessing/process.py Python-3.11.0a5/Lib/multiprocessing/process.py |
| 312 |
429a430 |
| 313 |
> del name, signum |
| 314 |
# ---------------------------------------------------------------------- |
| 315 |
diff Python-3.11.0a5/Lib/test/_test_multiprocessing.py Python-3.11.0a7/Lib/test/_test_multiprocessing.py |
| 316 |
75a76,81 |
| 317 |
> if support.check_sanitizer(address=True): |
| 318 |
> # bpo-45200: Skip multiprocessing tests if Python is built with ASAN to |
| 319 |
> # work around a libasan race condition: dead lock in pthread_create(). |
| 320 |
> raise unittest.SkipTest("libasan has a pthread_create() dead lock") |
| 321 |
> |
| 322 |
> |
| 323 |
249a256,279 |
| 324 |
> def test_args_argument(self): |
| 325 |
> # bpo-45735: Using list or tuple as *args* in constructor could |
| 326 |
> # achieve the same effect. |
| 327 |
> args_cases = (1, "str", [1], (1,)) |
| 328 |
> args_types = (list, tuple) |
| 329 |
> |
| 330 |
> test_cases = itertools.product(args_cases, args_types) |
| 331 |
> |
| 332 |
> for args, args_type in test_cases: |
| 333 |
> with self.subTest(args=args, args_type=args_type): |
| 334 |
> q = self.Queue(1) |
| 335 |
> # pass a tuple or list as args |
| 336 |
> p = self.Process(target=self._test_args, args=args_type((q, args))) |
| 337 |
> p.daemon = True |
| 338 |
> p.start() |
| 339 |
> child_args = q.get() |
| 340 |
> self.assertEqual(child_args, args) |
| 341 |
> p.join() |
| 342 |
> close_queue(q) |
| 343 |
> |
| 344 |
> @classmethod |
| 345 |
> def _test_args(cls, q, arg): |
| 346 |
> q.put(arg) |
| 347 |
> |
| 348 |
# ---------------------------------------------------------------------- |
| 349 |
diff Python-3.11.0a7/Lib/multiprocessing/connection.py Python-3.11.0b1/Lib/multiprocessing/connection.py |
| 350 |
191d190 |
| 351 |
< # HACK for byte-indexing of non-bytewise buffers (e.g. array.array) |
| 352 |
193,194c192,193 |
| 353 |
< m = memoryview(bytes(m)) |
| 354 |
< n = len(m) |
| 355 |
--- |
| 356 |
> m = m.cast('B') |
| 357 |
> n = m.nbytes |
| 358 |
Common subdirectories: Python-3.11.0a7/Lib/multiprocessing/dummy and Python-3.11.0b1/Lib/multiprocessing/dummy |
| 359 |
diff Python-3.11.0a7/Lib/multiprocessing/managers.py Python-3.11.0b1/Lib/multiprocessing/managers.py |
| 360 |
500c500 |
| 361 |
< ctx=None): |
| 362 |
--- |
| 363 |
> ctx=None, *, shutdown_timeout=1.0): |
| 364 |
509a510 |
| 365 |
> self._shutdown_timeout = shutdown_timeout |
| 366 |
573,574c574,575 |
| 367 |
< args=(self._process, self._address, self._authkey, |
| 368 |
< self._state, self._Client), |
| 369 |
--- |
| 370 |
> args=(self._process, self._address, self._authkey, self._state, |
| 371 |
> self._Client, self._shutdown_timeout), |
| 372 |
659c660,661 |
| 373 |
< def _finalize_manager(process, address, authkey, state, _Client): |
| 374 |
--- |
| 375 |
> def _finalize_manager(process, address, authkey, state, _Client, |
| 376 |
> shutdown_timeout): |
| 377 |
674c676 |
| 378 |
< process.join(timeout=1.0) |
| 379 |
--- |
| 380 |
> process.join(timeout=shutdown_timeout) |
| 381 |
680c682 |
| 382 |
< process.join(timeout=0.1) |
| 383 |
--- |
| 384 |
> process.join(timeout=shutdown_timeout) |
| 385 |
682a685,686 |
| 386 |
> process.kill() |
| 387 |
> process.join() |
| 388 |
diff Python-3.11.0a7/Lib/multiprocessing/queues.py Python-3.11.0b1/Lib/multiprocessing/queues.py |
| 389 |
142,148c142,145 |
| 390 |
< try: |
| 391 |
< self._reader.close() |
| 392 |
< finally: |
| 393 |
< close = self._close |
| 394 |
< if close: |
| 395 |
< self._close = None |
| 396 |
< close() |
| 397 |
--- |
| 398 |
> close = self._close |
| 399 |
> if close: |
| 400 |
> self._close = None |
| 401 |
> close() |
| 402 |
172,173c169,171 |
| 403 |
< self._wlock, self._writer.close, self._ignore_epipe, |
| 404 |
< self._on_queue_feeder_error, self._sem), |
| 405 |
--- |
| 406 |
> self._wlock, self._reader.close, self._writer.close, |
| 407 |
> self._ignore_epipe, self._on_queue_feeder_error, |
| 408 |
> self._sem), |
| 409 |
214,215c212,213 |
| 410 |
< def _feed(buffer, notempty, send_bytes, writelock, close, ignore_epipe, |
| 411 |
< onerror, queue_sem): |
| 412 |
--- |
| 413 |
> def _feed(buffer, notempty, send_bytes, writelock, reader_close, |
| 414 |
> writer_close, ignore_epipe, onerror, queue_sem): |
| 415 |
241c239,240 |
| 416 |
< close() |
| 417 |
--- |
| 418 |
> reader_close() |
| 419 |
> writer_close() |
| 420 |
diff Python-3.11.0a7/Lib/multiprocessing/spawn.py Python-3.11.0b1/Lib/multiprocessing/spawn.py |
| 421 |
36,40d35 |
| 422 |
< if WINSERVICE: |
| 423 |
< _python_exe = os.path.join(sys.exec_prefix, 'python.exe') |
| 424 |
< else: |
| 425 |
< _python_exe = sys.executable |
| 426 |
< |
| 427 |
43c38,41 |
| 428 |
< _python_exe = exe |
| 429 |
--- |
| 430 |
> if sys.platform == 'win32': |
| 431 |
> _python_exe = os.fsdecode(exe) |
| 432 |
> else: |
| 433 |
> _python_exe = os.fsencode(exe) |
| 434 |
47a46,50 |
| 435 |
> if WINSERVICE: |
| 436 |
> set_executable(os.path.join(sys.exec_prefix, 'python.exe')) |
| 437 |
> else: |
| 438 |
> set_executable(sys.executable) |
| 439 |
> |
| 440 |
89c92,93 |
| 441 |
< return [_python_exe] + opts + ['-c', prog, '--multiprocessing-fork'] |
| 442 |
--- |
| 443 |
> exe = get_executable() |
| 444 |
> return [exe] + opts + ['-c', prog, '--multiprocessing-fork'] |
| 445 |
diff Python-3.11.0a7/Lib/multiprocessing/util.py Python-3.11.0b1/Lib/multiprocessing/util.py |
| 446 |
123c123 |
| 447 |
< raise TypeError('address type of {address!r} unrecognized') |
| 448 |
--- |
| 449 |
> raise TypeError(f'address type of {address!r} unrecognized') |
| 450 |
448a449 |
| 451 |
> import subprocess |
| 452 |
453c454 |
| 453 |
< args, [os.fsencode(path)], True, passfds, None, None, |
| 454 |
--- |
| 455 |
> args, [path], True, passfds, None, None, |
| 456 |
455c456,457 |
| 457 |
< False, False, None, None, None, -1, None) |
| 458 |
--- |
| 459 |
> False, False, -1, None, None, None, -1, None, |
| 460 |
> subprocess._USE_VFORK) |
| 461 |
# ---------------------------------------------------------------------- |
| 462 |
diff Python-3.11.0b1/Lib/multiprocessing/context.py Python-3.11.0b5/Lib/multiprocessing/context.py |
| 463 |
225a226,229 |
| 464 |
> @staticmethod |
| 465 |
> def _after_fork(): |
| 466 |
> return _default_context.get_context().Process._after_fork() |
| 467 |
> |
| 468 |
285a290,294 |
| 469 |
> @staticmethod |
| 470 |
> def _after_fork(): |
| 471 |
> # process is spawned, nothing to do |
| 472 |
> pass |
| 473 |
> |
| 474 |
328a338,342 |
| 475 |
> @staticmethod |
| 476 |
> def _after_fork(): |
| 477 |
> # process is spawned, nothing to do |
| 478 |
> pass |
| 479 |
> |
| 480 |
Common subdirectories: Python-3.11.0b1/Lib/multiprocessing/dummy and Python-3.11.0b5/Lib/multiprocessing/dummy |
| 481 |
diff Python-3.11.0b1/Lib/multiprocessing/pool.py Python-3.11.0b5/Lib/multiprocessing/pool.py |
| 482 |
205a206,208 |
| 483 |
> if maxtasksperchild is not None: |
| 484 |
> if not isinstance(maxtasksperchild, int) or maxtasksperchild <= 0: |
| 485 |
> raise ValueError("maxtasksperchild must be a positive int or None") |
| 486 |
diff Python-3.11.0b1/Lib/multiprocessing/process.py Python-3.11.0b5/Lib/multiprocessing/process.py |
| 487 |
307,308c307 |
| 488 |
< util._finalizer_registry.clear() |
| 489 |
< util._run_after_forkers() |
| 490 |
--- |
| 491 |
> self._after_fork() |
| 492 |
338a338,344 |
| 493 |
> @staticmethod |
| 494 |
> def _after_fork(): |
| 495 |
> from . import util |
| 496 |
> util._finalizer_registry.clear() |
| 497 |
> util._run_after_forkers() |
| 498 |
> |
| 499 |
> |
| 500 |
diff Python-3.11.0b1/Lib/multiprocessing/shared_memory.py Python-3.11.0b5/Lib/multiprocessing/shared_memory.py |
| 501 |
25a26 |
| 502 |
> from . import resource_tracker |
| 503 |
119,120c120 |
| 504 |
< from .resource_tracker import register |
| 505 |
< register(self._name, "shared_memory") |
| 506 |
--- |
| 507 |
> resource_tracker.register(self._name, "shared_memory") |
| 508 |
240d239 |
| 509 |
< from .resource_tracker import unregister |
| 510 |
242c241 |
| 511 |
< unregister(self._name, "shared_memory") |
| 512 |
--- |
| 513 |
> resource_tracker.unregister(self._name, "shared_memory") |
| 514 |
diff Python-3.11.0b1/Modules/_multiprocessing/semaphore.c Python-3.11.0b5/Modules/_multiprocessing/semaphore.c |
| 515 |
457,459c457 |
| 516 |
< SemLockObject *self; |
| 517 |
< |
| 518 |
< self = PyObject_New(SemLockObject, type); |
| 519 |
--- |
| 520 |
> SemLockObject *self = (SemLockObject *)type->tp_alloc(type, 0); |
| 521 |
576c574 |
| 522 |
< PyObject_Free(self); |
| 523 |
--- |
| 524 |
> Py_TYPE(self)->tp_free((PyObject*)self); |
| 525 |
diff Python-3.11.0b1/Lib/test/_test_multiprocessing.py Python-3.11.0b5/Lib/test/_test_multiprocessing.py |
| 526 |
7a8 |
| 527 |
> import textwrap |
| 528 |
2862a2864,2868 |
| 529 |
> def test_pool_maxtasksperchild_invalid(self): |
| 530 |
> for value in [0, -1, 0.5, "12"]: |
| 531 |
> with self.assertRaises(ValueError): |
| 532 |
> multiprocessing.Pool(3, maxtasksperchild=value) |
| 533 |
> |
| 534 |
3968c3974 |
| 535 |
< names = ['test01_fn', 'test02_fn'] |
| 536 |
--- |
| 537 |
> names = [self._new_shm_name('test03_fn'), self._new_shm_name('test04_fn')] |
| 538 |
5762a5769,5797 |
| 539 |
> class TestNamedResource(unittest.TestCase): |
| 540 |
> def test_global_named_resource_spawn(self): |
| 541 |
> # |
| 542 |
> # gh-90549: Check that global named resources in main module |
| 543 |
> # will not leak by a subprocess, in spawn context. |
| 544 |
> # |
| 545 |
> testfn = os_helper.TESTFN |
| 546 |
> self.addCleanup(os_helper.unlink, testfn) |
| 547 |
> with open(testfn, 'w', encoding='utf-8') as f: |
| 548 |
> f.write(textwrap.dedent('''\ |
| 549 |
> import multiprocessing as mp |
| 550 |
> |
| 551 |
> ctx = mp.get_context('spawn') |
| 552 |
> |
| 553 |
> global_resource = ctx.Semaphore() |
| 554 |
> |
| 555 |
> def submain(): pass |
| 556 |
> |
| 557 |
> if __name__ == '__main__': |
| 558 |
> p = ctx.Process(target=submain) |
| 559 |
> p.start() |
| 560 |
> p.join() |
| 561 |
> ''')) |
| 562 |
> rc, out, err = test.support.script_helper.assert_python_ok(testfn) |
| 563 |
> # on error, err = 'UserWarning: resource_tracker: There appear to |
| 564 |
> # be 1 leaked semaphore objects to clean up at shutdown' |
| 565 |
> self.assertEqual(err, b'') |
| 566 |
> |
| 567 |
> |
| 568 |
5993a6029,6040 |
| 569 |
> |
| 570 |
> |
| 571 |
> @unittest.skipIf(not hasattr(_multiprocessing, 'SemLock'), 'SemLock not available') |
| 572 |
> @unittest.skipIf(sys.platform != "linux", "Linux only") |
| 573 |
> class SemLockTests(unittest.TestCase): |
| 574 |
> |
| 575 |
> def test_semlock_subclass(self): |
| 576 |
> class SemLock(_multiprocessing.SemLock): |
| 577 |
> pass |
| 578 |
> name = f'test_semlock_subclass-{os.getpid()}' |
| 579 |
> s = SemLock(1, 0, 10, name, 0) |
| 580 |
> _multiprocessing.sem_unlink(name) |
| 581 |
# ---------------------------------------------------------------------- |
| 582 |
diff Python-3.11.0b5/Lib/multiprocessing/connection.py Python-3.11.0/Lib/multiprocessing/connection.py |
| 583 |
76,80d75 |
| 584 |
< # Prefer abstract sockets if possible to avoid problems with the address |
| 585 |
< # size. When coding portable applications, some implementations have |
| 586 |
< # sun_path as short as 92 bytes in the sockaddr_un struct. |
| 587 |
< if util.abstract_sockets_supported: |
| 588 |
< return f"\0listener-{os.getpid()}-{next(_mmap_counter)}" |
| 589 |
diff Python-3.11.0b5/Lib/multiprocessing/popen_spawn_win32.py Python-3.11.0/Lib/multiprocessing/popen_spawn_win32.py |
| 590 |
57d56 |
| 591 |
< cmd = ' '.join('"%s"' % x for x in cmd) |
| 592 |
64c63 |
| 593 |
< python_exe = sys._base_executable |
| 594 |
--- |
| 595 |
> cmd[0] = python_exe = sys._base_executable |
| 596 |
69a69,70 |
| 597 |
> cmd = ' '.join('"%s"' % x for x in cmd) |
| 598 |
> |
| 599 |
# ---------------------------------------------------------------------- |
| 600 |
cp Python-3.11.0/Modules/_multiprocessing/clinic/* Modules/_multiprocess/clinic/ |
| 601 |
# ---------------------------------------------------------------------- |
| 602 |
diff Python-3.11.0/Lib/multiprocessing/resource_tracker.py Python-3.11.1/Lib/multiprocessing/resource_tracker.py |
| 603 |
164c164 |
| 604 |
< if len(name) > 512: |
| 605 |
--- |
| 606 |
> if len(msg) > 512: |
| 607 |
167c167 |
| 608 |
< raise ValueError('name too long') |
| 609 |
--- |
| 610 |
> raise ValueError('msg too long') |
| 611 |
diff Python-3.11.0/Lib/multiprocessing/shared_memory.py Python-3.11.1/Lib/multiprocessing/shared_memory.py |
| 612 |
176c176,179 |
| 613 |
< size = _winapi.VirtualQuerySize(p_buf) |
| 614 |
--- |
| 615 |
> try: |
| 616 |
> size = _winapi.VirtualQuerySize(p_buf) |
| 617 |
> finally: |
| 618 |
> _winapi.UnmapViewOfFile(p_buf) |
| 619 |
diff Python-3.11.0/Lib/test/_test_multiprocessing.py Python-3.11.1/Lib/test/_test_multiprocessing.py |
| 620 |
5440a5441,5448 |
| 621 |
> def test_too_long_name_resource(self): |
| 622 |
> # gh-96819: Resource names that will make the length of a write to a pipe |
| 623 |
> # greater than PIPE_BUF are not allowed |
| 624 |
> rtype = "shared_memory" |
| 625 |
> too_long_name_resource = "a" * (512 - len(rtype)) |
| 626 |
> with self.assertRaises(ValueError): |
| 627 |
> resource_tracker.register(too_long_name_resource, rtype) |
| 628 |
> |
| 629 |
6039c6047 |
| 630 |
< s = SemLock(1, 0, 10, name, 0) |
| 631 |
--- |
| 632 |
> s = SemLock(1, 0, 10, name, False) |
| 633 |
# ---------------------------------------------------------------------- |
| 634 |
diff Python-3.11.1/Lib/multiprocessing/process.py Python-3.11.4/Lib/multiprocessing/process.py |
| 635 |
64c64 |
| 636 |
< if p._popen.poll() is not None: |
| 637 |
--- |
| 638 |
> if (child_popen := p._popen) and child_popen.poll() is not None: |
| 639 |
# ---------------------------------------------------------------------- |
| 640 |
diff Python-3.11.4/Lib/multiprocessing/forkserver.py Python-3.11.5/Lib/multiprocessing/forkserver.py |
| 641 |
64c64 |
| 642 |
< if not all(type(mod) is str for mod in self._preload_modules): |
| 643 |
--- |
| 644 |
> if not all(type(mod) is str for mod in modules_names): |
| 645 |
diff Python-3.11.4/Lib/multiprocessing/spawn.py Python-3.11.5/Lib/multiprocessing/spawn.py |
| 646 |
34c34 |
| 647 |
< WINSERVICE = sys.executable.lower().endswith("pythonservice.exe") |
| 648 |
--- |
| 649 |
> WINSERVICE = sys.executable and sys.executable.lower().endswith("pythonservice.exe") |
| 650 |
38c38,40 |
| 651 |
< if sys.platform == 'win32': |
| 652 |
--- |
| 653 |
> if exe is None: |
| 654 |
> _python_exe = exe |
| 655 |
> elif sys.platform == 'win32': |
| 656 |
151c153,157 |
| 657 |
< is not going to be frozen to produce an executable.''') |
| 658 |
--- |
| 659 |
> is not going to be frozen to produce an executable. |
| 660 |
> |
| 661 |
> To fix this issue, refer to the "Safe importing of main module" |
| 662 |
> section in https://docs.python.org/3/library/multiprocessing.html |
| 663 |
> ''') |
| 664 |
diff Python-3.11.4/Lib/multiprocessing/synchronize.py Python-3.11.5/Lib/multiprocessing/synchronize.py |
| 665 |
53,54c53,54 |
| 666 |
< name = ctx.get_start_method() |
| 667 |
< unlink_now = sys.platform == 'win32' or name == 'fork' |
| 668 |
--- |
| 669 |
> self.is_fork_ctx = ctx.get_start_method() == 'fork' |
| 670 |
> unlink_now = sys.platform == 'win32' or self.is_fork_ctx |
| 671 |
105a106,110 |
| 672 |
> if self.is_fork_ctx: |
| 673 |
> raise RuntimeError('A SemLock created in a fork context is being ' |
| 674 |
> 'shared with a process in a spawn context. This is ' |
| 675 |
> 'not supported. Please use the same context to create ' |
| 676 |
> 'multiprocessing objects and Process.') |
| 677 |
# ---------------------------------------------------------------------- |
| 678 |
diff Python-3.11.4/Lib/test/_test_multiprocessing.py Python-3.11.5/Lib/test/_test_multiprocessing.py |
| 679 |
15a16 |
| 680 |
> import functools |
| 681 |
33a35 |
| 682 |
> from test.support import script_helper |
| 683 |
172a175,227 |
| 684 |
> def only_run_in_spawn_testsuite(reason): |
| 685 |
> """Returns a decorator: raises SkipTest when SM != spawn at test time. |
| 686 |
> |
| 687 |
> This can be useful to save overall Python test suite execution time. |
| 688 |
> "spawn" is the universal mode available on all platforms so this limits the |
| 689 |
> decorated test to only execute within test_multiprocessing_spawn. |
| 690 |
> |
| 691 |
> This would not be necessary if we refactored our test suite to split things |
| 692 |
> into other test files when they are not start method specific to be rerun |
| 693 |
> under all start methods. |
| 694 |
> """ |
| 695 |
> |
| 696 |
> def decorator(test_item): |
| 697 |
> |
| 698 |
> @functools.wraps(test_item) |
| 699 |
> def spawn_check_wrapper(*args, **kwargs): |
| 700 |
> if (start_method := multiprocessing.get_start_method()) != "spawn": |
| 701 |
> raise unittest.SkipTest(f"{start_method=}, not 'spawn'; {reason}") |
| 702 |
> return test_item(*args, **kwargs) |
| 703 |
> |
| 704 |
> return spawn_check_wrapper |
| 705 |
> |
| 706 |
> return decorator |
| 707 |
> |
| 708 |
> |
| 709 |
> class TestInternalDecorators(unittest.TestCase): |
| 710 |
> """Logic within a test suite that could errantly skip tests? Test it!""" |
| 711 |
> |
| 712 |
> @unittest.skipIf(sys.platform == "win32", "test requires that fork exists.") |
| 713 |
> def test_only_run_in_spawn_testsuite(self): |
| 714 |
> if multiprocessing.get_start_method() != "spawn": |
| 715 |
> raise unittest.SkipTest("only run in test_multiprocessing_spawn.") |
| 716 |
> |
| 717 |
> try: |
| 718 |
> @only_run_in_spawn_testsuite("testing this decorator") |
| 719 |
> def return_four_if_spawn(): |
| 720 |
> return 4 |
| 721 |
> except Exception as err: |
| 722 |
> self.fail(f"expected decorated `def` not to raise; caught {err}") |
| 723 |
> |
| 724 |
> orig_start_method = multiprocessing.get_start_method(allow_none=True) |
| 725 |
> try: |
| 726 |
> multiprocessing.set_start_method("spawn", force=True) |
| 727 |
> self.assertEqual(return_four_if_spawn(), 4) |
| 728 |
> multiprocessing.set_start_method("fork", force=True) |
| 729 |
> with self.assertRaises(unittest.SkipTest) as ctx: |
| 730 |
> return_four_if_spawn() |
| 731 |
> self.assertIn("testing this decorator", str(ctx.exception)) |
| 732 |
> self.assertIn("start_method=", str(ctx.exception)) |
| 733 |
> finally: |
| 734 |
> multiprocessing.set_start_method(orig_start_method, force=True) |
| 735 |
> |
| 736 |
> |
| 737 |
5240a5296,5303 |
| 738 |
> def test_context_check_module_types(self): |
| 739 |
> try: |
| 740 |
> ctx = multiprocessing.get_context('forkserver') |
| 741 |
> except ValueError: |
| 742 |
> raise unittest.SkipTest('forkserver should be available') |
| 743 |
> with self.assertRaisesRegex(TypeError, 'module_names must be a list of strings'): |
| 744 |
> ctx.set_forkserver_preload([1, 2, 3]) |
| 745 |
> |
| 746 |
5284a5348,5369 |
| 747 |
> @unittest.skipIf(sys.platform == "win32", |
| 748 |
> "Only Spawn on windows so no risk of mixing") |
| 749 |
> @only_run_in_spawn_testsuite("avoids redundant testing.") |
| 750 |
> def test_mixed_startmethod(self): |
| 751 |
> # Fork-based locks cannot be used with spawned process |
| 752 |
> for process_method in ["spawn", "forkserver"]: |
| 753 |
> queue = multiprocessing.get_context("fork").Queue() |
| 754 |
> process_ctx = multiprocessing.get_context(process_method) |
| 755 |
> p = process_ctx.Process(target=close_queue, args=(queue,)) |
| 756 |
> err_msg = "A SemLock created in a fork" |
| 757 |
> with self.assertRaisesRegex(RuntimeError, err_msg): |
| 758 |
> p.start() |
| 759 |
> |
| 760 |
> # non-fork-based locks can be used with all other start methods |
| 761 |
> for queue_method in ["spawn", "forkserver"]: |
| 762 |
> for process_method in multiprocessing.get_all_start_methods(): |
| 763 |
> queue = multiprocessing.get_context(queue_method).Queue() |
| 764 |
> process_ctx = multiprocessing.get_context(process_method) |
| 765 |
> p = process_ctx.Process(target=close_queue, args=(queue,)) |
| 766 |
> p.start() |
| 767 |
> p.join() |
| 768 |
> |
| 769 |
5777a5863 |
| 770 |
> @only_run_in_spawn_testsuite("spawn specific test.") |
| 771 |
5788d5873 |
| 772 |
< |
| 773 |
5790d5874 |
| 774 |
< |
| 775 |
5792d5875 |
| 776 |
< |
| 777 |
5794d5876 |
| 778 |
< |
| 779 |
5800c5882 |
| 780 |
< rc, out, err = test.support.script_helper.assert_python_ok(testfn) |
| 781 |
--- |
| 782 |
> rc, out, err = script_helper.assert_python_ok(testfn) |
| 783 |
5803c5885 |
| 784 |
< self.assertEqual(err, b'') |
| 785 |
--- |
| 786 |
> self.assertFalse(err, msg=err.decode('utf-8')) |
| 787 |
5811a5894,5911 |
| 788 |
> @only_run_in_spawn_testsuite("avoids redundant testing.") |
| 789 |
> def test_spawn_sys_executable_none_allows_import(self): |
| 790 |
> # Regression test for a bug introduced in |
| 791 |
> # https://github.com/python/cpython/issues/90876 that caused an |
| 792 |
> # ImportError in multiprocessing when sys.executable was None. |
| 793 |
> # This can be true in embedded environments. |
| 794 |
> rc, out, err = script_helper.assert_python_ok( |
| 795 |
> "-c", |
| 796 |
> """if 1: |
| 797 |
> import sys |
| 798 |
> sys.executable = None |
| 799 |
> assert "multiprocessing" not in sys.modules, "already imported!" |
| 800 |
> import multiprocessing |
| 801 |
> import multiprocessing.spawn # This should not fail\n""", |
| 802 |
> ) |
| 803 |
> self.assertEqual(rc, 0) |
| 804 |
> self.assertFalse(err, msg=err.decode('utf-8')) |
| 805 |
> |
| 806 |
# ---------------------------------------------------------------------- |
| 807 |
diff Python-3.11.5/Modules/_multiprocessing/semaphore.c Python-3.11.6/Modules/_multiprocessing/semaphore.c |
| 808 |
519,521d518 |
| 809 |
< if (handle != SEM_FAILED) |
| 810 |
< SEM_CLOSE(handle); |
| 811 |
< PyMem_Free(name_copy); |
| 812 |
524a522,524 |
| 813 |
> if (handle != SEM_FAILED) |
| 814 |
> SEM_CLOSE(handle); |
| 815 |
> PyMem_Free(name_copy); |
| 816 |
558a559 |
| 817 |
> PyErr_SetFromErrno(PyExc_OSError); |
| 818 |
560c561 |
| 819 |
< return PyErr_SetFromErrno(PyExc_OSError); |
| 820 |
--- |
| 821 |
> return NULL; |
| 822 |
diff Python-3.11.5/Lib/multiprocessing/connection.py Python-3.11.6/Lib/multiprocessing/connection.py |
| 823 |
11a12 |
| 824 |
> import errno |
| 825 |
273a275 |
| 826 |
> _send_ov = None |
| 827 |
275a278,281 |
| 828 |
> ov = self._send_ov |
| 829 |
> if ov is not None: |
| 830 |
> # Interrupt WaitForMultipleObjects() in _send_bytes() |
| 831 |
> ov.cancel() |
| 832 |
278a285,288 |
| 833 |
> if self._send_ov is not None: |
| 834 |
> # A connection should only be used by a single thread |
| 835 |
> raise ValueError("concurrent send_bytes() calls " |
| 836 |
> "are not supported") |
| 837 |
279a290 |
| 838 |
> self._send_ov = ov |
| 839 |
288a300 |
| 840 |
> self._send_ov = None |
| 841 |
289a302,306 |
| 842 |
> if err == _winapi.ERROR_OPERATION_ABORTED: |
| 843 |
> # close() was called by another thread while |
| 844 |
> # WaitForMultipleObjects() was waiting for the overlapped |
| 845 |
> # operation. |
| 846 |
> raise OSError(errno.EPIPE, "handle is closed") |
| 847 |
diff Python-3.11.5/Lib/multiprocessing/popen_spawn_win32.py Python-3.11.6/Lib/multiprocessing/popen_spawn_win32.py |
| 848 |
16a17 |
| 849 |
> # Exit code used by Popen.terminate() |
| 850 |
125,126c126,130 |
| 851 |
< except OSError: |
| 852 |
< if self.wait(timeout=1.0) is None: |
| 853 |
--- |
| 854 |
> except PermissionError: |
| 855 |
> # ERROR_ACCESS_DENIED (winerror 5) is received when the |
| 856 |
> # process already died. |
| 857 |
> code = _winapi.GetExitCodeProcess(int(self._handle)) |
| 858 |
> if code == _winapi.STILL_ACTIVE: |
| 859 |
127a132,134 |
| 860 |
> self.returncode = code |
| 861 |
> else: |
| 862 |
> self.returncode = -signal.SIGTERM |
| 863 |
diff Python-3.11.5/Lib/multiprocessing/resource_tracker.py Python-3.11.6/Lib/multiprocessing/resource_tracker.py |
| 864 |
53a54,57 |
| 865 |
> class ReentrantCallError(RuntimeError): |
| 866 |
> pass |
| 867 |
> |
| 868 |
> |
| 869 |
57c61 |
| 870 |
< self._lock = threading.Lock() |
| 871 |
--- |
| 872 |
> self._lock = threading.RLock() |
| 873 |
60a65,72 |
| 874 |
> def _reentrant_call_error(self): |
| 875 |
> # gh-109629: this happens if an explicit call to the ResourceTracker |
| 876 |
> # gets interrupted by a garbage collection, invoking a finalizer (*) |
| 877 |
> # that itself calls back into ResourceTracker. |
| 878 |
> # (*) for example the SemLock finalizer |
| 879 |
> raise ReentrantCallError( |
| 880 |
> "Reentrant call into the multiprocessing resource tracker") |
| 881 |
> |
| 882 |
62a75,78 |
| 883 |
> # This should not happen (_stop() isn't called by a finalizer) |
| 884 |
> # but we check for it anyway. |
| 885 |
> if self._lock._recursion_count() > 1: |
| 886 |
> return self._reentrant_call_error() |
| 887 |
83a100,102 |
| 888 |
> if self._lock._recursion_count() > 1: |
| 889 |
> # The code below is certainly not reentrant-safe, so bail out |
| 890 |
> return self._reentrant_call_error() |
| 891 |
162c181,191 |
| 892 |
< self.ensure_running() |
| 893 |
--- |
| 894 |
> try: |
| 895 |
> self.ensure_running() |
| 896 |
> except ReentrantCallError: |
| 897 |
> # The code below might or might not work, depending on whether |
| 898 |
> # the resource tracker was already running and still alive. |
| 899 |
> # Better warn the user. |
| 900 |
> # (XXX is warnings.warn itself reentrant-safe? :-) |
| 901 |
> warnings.warn( |
| 902 |
> f"ResourceTracker called reentrantly for resource cleanup, " |
| 903 |
> f"which is unsupported. " |
| 904 |
> f"The {rtype} object {name!r} might leak.") |
| 905 |
178a208 |
| 906 |
> |
| 907 |
diff Python-3.11.5/Lib/multiprocessing/synchronize.py Python-3.11.6/Lib/multiprocessing/synchronize.py |
| 908 |
53,54c53,54 |
| 909 |
< self.is_fork_ctx = ctx.get_start_method() == 'fork' |
| 910 |
< unlink_now = sys.platform == 'win32' or self.is_fork_ctx |
| 911 |
--- |
| 912 |
> self._is_fork_ctx = ctx.get_start_method() == 'fork' |
| 913 |
> unlink_now = sys.platform == 'win32' or self._is_fork_ctx |
| 914 |
106c106 |
| 915 |
< if self.is_fork_ctx: |
| 916 |
--- |
| 917 |
> if self._is_fork_ctx: |
| 918 |
117a118,119 |
| 919 |
> # Ensure that deserialized SemLock can be serialized again (gh-108520). |
| 920 |
> self._is_fork_ctx = False |
| 921 |
diff Python-3.11.5/Lib/test/_test_multiprocessing.py Python-3.11.6/Lib/test/_test_multiprocessing.py |
| 922 |
81c81 |
| 923 |
< # bpo-45200: Skip multiprocessing tests if Python is built with ASAN to |
| 924 |
--- |
| 925 |
> # gh-89363: Skip multiprocessing tests if Python is built with ASAN to |
| 926 |
330a331 |
| 927 |
> @support.requires_resource('cpu') |
| 928 |
558,559c559 |
| 929 |
< if os.name != 'nt': |
| 930 |
< self.assertEqual(exitcode, -signal.SIGTERM) |
| 931 |
--- |
| 932 |
> self.assertEqual(exitcode, -signal.SIGTERM) |
| 933 |
564a565,566 |
| 934 |
> else: |
| 935 |
> self.assertEqual(exitcode, -signal.SIGTERM) |
| 936 |
675a678 |
| 937 |
> @support.requires_resource('walltime') |
| 938 |
4472a4476 |
| 939 |
> @support.requires_resource('cpu') |
| 940 |
4919a4924 |
| 941 |
> @support.requires_resource('walltime') |
| 942 |
4947a4953 |
| 943 |
> @support.requires_resource('walltime') |
| 944 |
5369a5376,5403 |
| 945 |
> @classmethod |
| 946 |
> def _put_one_in_queue(cls, queue): |
| 947 |
> queue.put(1) |
| 948 |
> |
| 949 |
> @classmethod |
| 950 |
> def _put_two_and_nest_once(cls, queue): |
| 951 |
> queue.put(2) |
| 952 |
> process = multiprocessing.Process(target=cls._put_one_in_queue, args=(queue,)) |
| 953 |
> process.start() |
| 954 |
> process.join() |
| 955 |
> |
| 956 |
> def test_nested_startmethod(self): |
| 957 |
> # gh-108520: Regression test to ensure that child process can send its |
| 958 |
> # arguments to another process |
| 959 |
> queue = multiprocessing.Queue() |
| 960 |
> |
| 961 |
> process = multiprocessing.Process(target=self._put_two_and_nest_once, args=(queue,)) |
| 962 |
> process.start() |
| 963 |
> process.join() |
| 964 |
> |
| 965 |
> results = [] |
| 966 |
> while not queue.empty(): |
| 967 |
> results.append(queue.get()) |
| 968 |
> |
| 969 |
> # gh-109706: queue.put(1) can write into the queue before queue.put(2), |
| 970 |
> # there is no synchronization in the test. |
| 971 |
> self.assertSetEqual(set(results), set([2, 1])) |
| 972 |
> |
| 973 |
6052c6086,6087 |
| 974 |
< def install_tests_in_module_dict(remote_globs, start_method): |
| 975 |
--- |
| 976 |
> def install_tests_in_module_dict(remote_globs, start_method, |
| 977 |
> only_type=None, exclude_types=False): |
| 978 |
6064a6100,6103 |
| 979 |
> if only_type and type_ != only_type: |
| 980 |
> continue |
| 981 |
> if exclude_types: |
| 982 |
> continue |
| 983 |
6074a6114,6116 |
| 984 |
> if only_type: |
| 985 |
> continue |
| 986 |
> |
| 987 |
# ---------------------------------------------------------------------- |
| 988 |
diff Python-3.11.6/Lib/test/_test_multiprocessing.py Python-3.11.7/Lib/test/_test_multiprocessing.py |
| 989 |
80c80 |
| 990 |
< if support.check_sanitizer(address=True): |
| 991 |
--- |
| 992 |
> if support.HAVE_ASAN_FORK_BUG: |
| 993 |
83c83,88 |
| 994 |
< raise unittest.SkipTest("libasan has a pthread_create() dead lock") |
| 995 |
--- |
| 996 |
> raise unittest.SkipTest("libasan has a pthread_create() dead lock related to thread+fork") |
| 997 |
> |
| 998 |
> |
| 999 |
> # gh-110666: Tolerate a difference of 100 ms when comparing timings |
| 1000 |
> # (clock resolution) |
| 1001 |
> CLOCK_RES = 0.100 |
| 1002 |
1653c1658 |
| 1003 |
< expected = 0.1 |
| 1004 |
--- |
| 1005 |
> expected = 0.100 |
| 1006 |
1657,1658c1662 |
| 1007 |
< # borrow logic in assertTimeout() from test/lock_tests.py |
| 1008 |
< if not result and expected * 0.6 < dt < expected * 10.0: |
| 1009 |
--- |
| 1010 |
> if not result and (expected - CLOCK_RES) <= dt: |
| 1011 |
1677c1681 |
| 1012 |
< time.sleep(0.01) |
| 1013 |
--- |
| 1014 |
> time.sleep(0.010) |
| 1015 |
2436,2437c2440,2444 |
| 1016 |
< def sqr(x, wait=0.0): |
| 1017 |
< time.sleep(wait) |
| 1018 |
--- |
| 1019 |
> def sqr(x, wait=0.0, event=None): |
| 1020 |
> if event is None: |
| 1021 |
> time.sleep(wait) |
| 1022 |
> else: |
| 1023 |
> event.wait(wait) |
| 1024 |
2576,2579c2583,2594 |
| 1025 |
< res = self.pool.apply_async(sqr, (6, TIMEOUT2 + 1.0)) |
| 1026 |
< get = TimingWrapper(res.get) |
| 1027 |
< self.assertRaises(multiprocessing.TimeoutError, get, timeout=TIMEOUT2) |
| 1028 |
< self.assertTimingAlmostEqual(get.elapsed, TIMEOUT2) |
| 1029 |
--- |
| 1030 |
> p = self.Pool(3) |
| 1031 |
> try: |
| 1032 |
> event = threading.Event() if self.TYPE == 'threads' else None |
| 1033 |
> res = p.apply_async(sqr, (6, TIMEOUT2 + support.SHORT_TIMEOUT, event)) |
| 1034 |
> get = TimingWrapper(res.get) |
| 1035 |
> self.assertRaises(multiprocessing.TimeoutError, get, timeout=TIMEOUT2) |
| 1036 |
> self.assertTimingAlmostEqual(get.elapsed, TIMEOUT2) |
| 1037 |
> finally: |
| 1038 |
> if event is not None: |
| 1039 |
> event.set() |
| 1040 |
> p.terminate() |
| 1041 |
> p.join() |
| 1042 |
2680,2687c2695,2700 |
| 1043 |
< result = self.pool.map_async( |
| 1044 |
< time.sleep, [0.1 for i in range(10000)], chunksize=1 |
| 1045 |
< ) |
| 1046 |
< self.pool.terminate() |
| 1047 |
< join = TimingWrapper(self.pool.join) |
| 1048 |
< join() |
| 1049 |
< # Sanity check the pool didn't wait for all tasks to finish |
| 1050 |
< self.assertLess(join.elapsed, 2.0) |
| 1051 |
--- |
| 1052 |
> # Simulate slow tasks which take "forever" to complete |
| 1053 |
> p = self.Pool(3) |
| 1054 |
> args = [support.LONG_TIMEOUT for i in range(10_000)] |
| 1055 |
> result = p.map_async(time.sleep, args, chunksize=1) |
| 1056 |
> p.terminate() |
| 1057 |
> p.join() |
| 1058 |
4379,4383c4392,4394 |
| 1059 |
< deadline = time.monotonic() + support.LONG_TIMEOUT |
| 1060 |
< t = 0.1 |
| 1061 |
< while time.monotonic() < deadline: |
| 1062 |
< time.sleep(t) |
| 1063 |
< t = min(t*2, 5) |
| 1064 |
--- |
| 1065 |
> err_msg = ("A SharedMemory segment was leaked after " |
| 1066 |
> "a process was abruptly terminated") |
| 1067 |
> for _ in support.sleeping_retry(support.LONG_TIMEOUT, err_msg): |
| 1068 |
4388,4390d4398 |
| 1069 |
< else: |
| 1070 |
< raise AssertionError("A SharedMemory segment was leaked after" |
| 1071 |
< " a process was abruptly terminated.") |
| 1072 |
4839c4847 |
| 1073 |
< time.sleep(random.random()*0.1) |
| 1074 |
--- |
| 1075 |
> time.sleep(random.random() * 0.100) |
| 1076 |
4879c4887 |
| 1077 |
< time.sleep(random.random()*0.1) |
| 1078 |
--- |
| 1079 |
> time.sleep(random.random() * 0.100) |
| 1080 |
4928c4936 |
| 1081 |
< expected = 5 |
| 1082 |
--- |
| 1083 |
> timeout = 5.0 # seconds |
| 1084 |
4932c4940 |
| 1085 |
< res = wait([a, b], expected) |
| 1086 |
--- |
| 1087 |
> res = wait([a, b], timeout) |
| 1088 |
4936,4937c4944 |
| 1089 |
< self.assertLess(delta, expected * 2) |
| 1090 |
< self.assertGreater(delta, expected * 0.5) |
| 1091 |
--- |
| 1092 |
> self.assertGreater(delta, timeout - CLOCK_RES) |
| 1093 |
4940,4941d4946 |
| 1094 |
< |
| 1095 |
< start = time.monotonic() |
| 1096 |
4943,4944d4947 |
| 1097 |
< delta = time.monotonic() - start |
| 1098 |
< |
| 1099 |
4946d4948 |
| 1100 |
< self.assertLess(delta, 0.4) |
| 1101 |
5461,5463c5463,5466 |
| 1102 |
< deadline = time.monotonic() + support.LONG_TIMEOUT |
| 1103 |
< while time.monotonic() < deadline: |
| 1104 |
< time.sleep(.5) |
| 1105 |
--- |
| 1106 |
> err_msg = (f"A {rtype} resource was leaked after a process was " |
| 1107 |
> f"abruptly terminated") |
| 1108 |
> for _ in support.sleeping_retry(support.SHORT_TIMEOUT, |
| 1109 |
> err_msg): |
| 1110 |
5471,5474c5474 |
| 1111 |
< else: |
| 1112 |
< raise AssertionError( |
| 1113 |
< f"A {rtype} resource was leaked after a process was " |
| 1114 |
< f"abruptly terminated.") |
| 1115 |
--- |
| 1116 |
> |
| 1117 |
5709a5710 |
| 1118 |
> |
| 1119 |
5711,5720c5712,5713 |
| 1120 |
< t = 0.01 |
| 1121 |
< while len(multiprocessing.active_children()) > 1: |
| 1122 |
< time.sleep(t) |
| 1123 |
< t *= 2 |
| 1124 |
< dt = time.monotonic() - start_time |
| 1125 |
< if dt >= 5.0: |
| 1126 |
< test.support.environment_altered = True |
| 1127 |
< support.print_warning(f"multiprocessing.Manager still has " |
| 1128 |
< f"{multiprocessing.active_children()} " |
| 1129 |
< f"active children after {dt} seconds") |
| 1130 |
--- |
| 1131 |
> for _ in support.sleeping_retry(5.0, error=False): |
| 1132 |
> if len(multiprocessing.active_children()) <= 1: |
| 1133 |
5721a5715,5720 |
| 1134 |
> else: |
| 1135 |
> dt = time.monotonic() - start_time |
| 1136 |
> support.environment_altered = True |
| 1137 |
> support.print_warning(f"multiprocessing.Manager still has " |
| 1138 |
> f"{multiprocessing.active_children()} " |
| 1139 |
> f"active children after {dt:.1f} seconds") |
| 1140 |
6034,6043c6033,6034 |
| 1141 |
< t = 0.01 |
| 1142 |
< while len(multiprocessing.active_children()) > 1: |
| 1143 |
< time.sleep(t) |
| 1144 |
< t *= 2 |
| 1145 |
< dt = time.monotonic() - start_time |
| 1146 |
< if dt >= 5.0: |
| 1147 |
< test.support.environment_altered = True |
| 1148 |
< support.print_warning(f"multiprocessing.Manager still has " |
| 1149 |
< f"{multiprocessing.active_children()} " |
| 1150 |
< f"active children after {dt} seconds") |
| 1151 |
--- |
| 1152 |
> for _ in support.sleeping_retry(5.0, error=False): |
| 1153 |
> if len(multiprocessing.active_children()) <= 1: |
| 1154 |
6044a6036,6041 |
| 1155 |
> else: |
| 1156 |
> dt = time.monotonic() - start_time |
| 1157 |
> support.environment_altered = True |
| 1158 |
> support.print_warning(f"multiprocessing.Manager still has " |
| 1159 |
> f"{multiprocessing.active_children()} " |
| 1160 |
> f"active children after {dt:.1f} seconds") |
| 1161 |
# ---------------------------------------------------------------------- |
| 1162 |
diff Python-3.11.7/Lib/multiprocessing/managers.py Python-3.11.8/Lib/multiprocessing/managers.py |
| 1163 |
156c156 |
| 1164 |
< self.listener = Listener(address=address, backlog=16) |
| 1165 |
--- |
| 1166 |
> self.listener = Listener(address=address, backlog=128) |
| 1167 |
diff Python-3.11.7/Lib/multiprocessing/popen_spawn_win32.py Python-3.11.8/Lib/multiprocessing/popen_spawn_win32.py |
| 1168 |
104,115c104,117 |
| 1169 |
< if self.returncode is None: |
| 1170 |
< if timeout is None: |
| 1171 |
< msecs = _winapi.INFINITE |
| 1172 |
< else: |
| 1173 |
< msecs = max(0, int(timeout * 1000 + 0.5)) |
| 1174 |
< |
| 1175 |
< res = _winapi.WaitForSingleObject(int(self._handle), msecs) |
| 1176 |
< if res == _winapi.WAIT_OBJECT_0: |
| 1177 |
< code = _winapi.GetExitCodeProcess(self._handle) |
| 1178 |
< if code == TERMINATE: |
| 1179 |
< code = -signal.SIGTERM |
| 1180 |
< self.returncode = code |
| 1181 |
--- |
| 1182 |
> if self.returncode is not None: |
| 1183 |
> return self.returncode |
| 1184 |
> |
| 1185 |
> if timeout is None: |
| 1186 |
> msecs = _winapi.INFINITE |
| 1187 |
> else: |
| 1188 |
> msecs = max(0, int(timeout * 1000 + 0.5)) |
| 1189 |
> |
| 1190 |
> res = _winapi.WaitForSingleObject(int(self._handle), msecs) |
| 1191 |
> if res == _winapi.WAIT_OBJECT_0: |
| 1192 |
> code = _winapi.GetExitCodeProcess(self._handle) |
| 1193 |
> if code == TERMINATE: |
| 1194 |
> code = -signal.SIGTERM |
| 1195 |
> self.returncode = code |
| 1196 |
123,134c125,140 |
| 1197 |
< if self.returncode is None: |
| 1198 |
< try: |
| 1199 |
< _winapi.TerminateProcess(int(self._handle), TERMINATE) |
| 1200 |
< except PermissionError: |
| 1201 |
< # ERROR_ACCESS_DENIED (winerror 5) is received when the |
| 1202 |
< # process already died. |
| 1203 |
< code = _winapi.GetExitCodeProcess(int(self._handle)) |
| 1204 |
< if code == _winapi.STILL_ACTIVE: |
| 1205 |
< raise |
| 1206 |
< self.returncode = code |
| 1207 |
< else: |
| 1208 |
< self.returncode = -signal.SIGTERM |
| 1209 |
--- |
| 1210 |
> if self.returncode is not None: |
| 1211 |
> return |
| 1212 |
> |
| 1213 |
> try: |
| 1214 |
> _winapi.TerminateProcess(int(self._handle), TERMINATE) |
| 1215 |
> except PermissionError: |
| 1216 |
> # ERROR_ACCESS_DENIED (winerror 5) is received when the |
| 1217 |
> # process already died. |
| 1218 |
> code = _winapi.GetExitCodeProcess(int(self._handle)) |
| 1219 |
> if code == _winapi.STILL_ACTIVE: |
| 1220 |
> raise |
| 1221 |
> |
| 1222 |
> # gh-113009: Don't set self.returncode. Even if GetExitCodeProcess() |
| 1223 |
> # returns an exit code different than STILL_ACTIVE, the process can |
| 1224 |
> # still be running. Only set self.returncode once WaitForSingleObject() |
| 1225 |
> # returns WAIT_OBJECT_0 in wait(). |
| 1226 |
diff Python-3.11.7/Lib/multiprocessing/resource_sharer.py Python-3.11.8/Lib/multiprocessing/resource_sharer.py |
| 1227 |
126c126 |
| 1228 |
< self._listener = Listener(authkey=process.current_process().authkey) |
| 1229 |
--- |
| 1230 |
> self._listener = Listener(authkey=process.current_process().authkey, backlog=128) |
| 1231 |
diff Python-3.11.7/Lib/multiprocessing/util.py Python-3.11.8/Lib/multiprocessing/util.py |
| 1232 |
46c46 |
| 1233 |
< _logger.log(SUBDEBUG, msg, *args) |
| 1234 |
--- |
| 1235 |
> _logger.log(SUBDEBUG, msg, *args, stacklevel=2) |
| 1236 |
50c50 |
| 1237 |
< _logger.log(DEBUG, msg, *args) |
| 1238 |
--- |
| 1239 |
> _logger.log(DEBUG, msg, *args, stacklevel=2) |
| 1240 |
54c54 |
| 1241 |
< _logger.log(INFO, msg, *args) |
| 1242 |
--- |
| 1243 |
> _logger.log(INFO, msg, *args, stacklevel=2) |
| 1244 |
58c58 |
| 1245 |
< _logger.log(SUBWARNING, msg, *args) |
| 1246 |
--- |
| 1247 |
> _logger.log(SUBWARNING, msg, *args, stacklevel=2) |
| 1248 |
133c133,136 |
| 1249 |
< rmtree(tempdir) |
| 1250 |
--- |
| 1251 |
> def onerror(func, path, err_info): |
| 1252 |
> if not issubclass(err_info[0], FileNotFoundError): |
| 1253 |
> raise |
| 1254 |
> rmtree(tempdir, onerror=onerror) |
| 1255 |
diff Python-3.11.7/Lib/test/_test_multiprocessing.py Python-3.11.8/Lib/test/_test_multiprocessing.py |
| 1256 |
2695a2696,2703 |
| 1257 |
> sleep_time = support.LONG_TIMEOUT |
| 1258 |
> |
| 1259 |
> if self.TYPE == 'threads': |
| 1260 |
> # Thread pool workers can't be forced to quit, so if the first |
| 1261 |
> # task starts early enough, we will end up waiting for it. |
| 1262 |
> # Sleep for a shorter time, so the test doesn't block. |
| 1263 |
> sleep_time = 1 |
| 1264 |
> |
| 1265 |
2697c2705 |
| 1266 |
< args = [support.LONG_TIMEOUT for i in range(10_000)] |
| 1267 |
--- |
| 1268 |
> args = [sleep_time for i in range(10_000)] |
| 1269 |
2698a2707 |
| 1270 |
> time.sleep(0.2) # give some tasks a chance to start |
| 1271 |
4631a4641,4663 |
| 1272 |
> def test_filename(self): |
| 1273 |
> logger = multiprocessing.get_logger() |
| 1274 |
> original_level = logger.level |
| 1275 |
> try: |
| 1276 |
> logger.setLevel(util.DEBUG) |
| 1277 |
> stream = io.StringIO() |
| 1278 |
> handler = logging.StreamHandler(stream) |
| 1279 |
> logging_format = '[%(levelname)s] [%(filename)s] %(message)s' |
| 1280 |
> handler.setFormatter(logging.Formatter(logging_format)) |
| 1281 |
> logger.addHandler(handler) |
| 1282 |
> logger.info('1') |
| 1283 |
> util.info('2') |
| 1284 |
> logger.debug('3') |
| 1285 |
> filename = os.path.basename(__file__) |
| 1286 |
> log_record = stream.getvalue() |
| 1287 |
> self.assertIn(f'[INFO] [{filename}] 1', log_record) |
| 1288 |
> self.assertIn(f'[INFO] [{filename}] 2', log_record) |
| 1289 |
> self.assertIn(f'[DEBUG] [{filename}] 3', log_record) |
| 1290 |
> finally: |
| 1291 |
> logger.setLevel(original_level) |
| 1292 |
> logger.removeHandler(handler) |
| 1293 |
> handler.close() |
| 1294 |
> |
| 1295 |
# ---------------------------------------------------------------------- |
| 1296 |
diff Python-3.11.8/Modules/_multiprocessing/posixshmem.c Python-3.11.9/Modules/_multiprocessing/posixshmem.c |
| 1297 |
45c45,46 |
| 1298 |
< const char *name = PyUnicode_AsUTF8(path); |
| 1299 |
--- |
| 1300 |
> Py_ssize_t name_size; |
| 1301 |
> const char *name = PyUnicode_AsUTF8AndSize(path, &name_size); |
| 1302 |
48a50,53 |
| 1303 |
> if (strlen(name) != (size_t)name_size) { |
| 1304 |
> PyErr_SetString(PyExc_ValueError, "embedded null character"); |
| 1305 |
> return -1; |
| 1306 |
> } |
| 1307 |
84c89,90 |
| 1308 |
< const char *name = PyUnicode_AsUTF8(path); |
| 1309 |
--- |
| 1310 |
> Py_ssize_t name_size; |
| 1311 |
> const char *name = PyUnicode_AsUTF8AndSize(path, &name_size); |
| 1312 |
87a94,97 |
| 1313 |
> if (strlen(name) != (size_t)name_size) { |
| 1314 |
> PyErr_SetString(PyExc_ValueError, "embedded null character"); |
| 1315 |
> return NULL; |
| 1316 |
> } |
| 1317 |
diff Python-3.11.8/Lib/multiprocessing/connection.py Python-3.11.9/Lib/multiprocessing/connection.py |
| 1318 |
478a479 |
| 1319 |
> |
| 1320 |
480c481 |
| 1321 |
< if self._authkey: |
| 1322 |
--- |
| 1323 |
> if self._authkey is not None: |
| 1324 |
diff Python-3.11.8/Lib/test/_test_multiprocessing.py Python-3.11.9/Lib/test/_test_multiprocessing.py |
| 1325 |
3467a3468,3491 |
| 1326 |
> def test_empty_authkey(self): |
| 1327 |
> # bpo-43952: allow empty bytes as authkey |
| 1328 |
> def handler(*args): |
| 1329 |
> raise RuntimeError('Connection took too long...') |
| 1330 |
> |
| 1331 |
> def run(addr, authkey): |
| 1332 |
> client = self.connection.Client(addr, authkey=authkey) |
| 1333 |
> client.send(1729) |
| 1334 |
> |
| 1335 |
> key = b'' |
| 1336 |
> |
| 1337 |
> with self.connection.Listener(authkey=key) as listener: |
| 1338 |
> thread = threading.Thread(target=run, args=(listener.address, key)) |
| 1339 |
> thread.start() |
| 1340 |
> try: |
| 1341 |
> with listener.accept() as d: |
| 1342 |
> self.assertEqual(d.recv(), 1729) |
| 1343 |
> finally: |
| 1344 |
> thread.join() |
| 1345 |
> |
| 1346 |
> if self.TYPE == 'processes': |
| 1347 |
> with self.assertRaises(OSError): |
| 1348 |
> listener.accept() |
| 1349 |
> |
| 1350 |
3934a3959,3973 |
| 1351 |
> def test_shared_memory_name_with_embedded_null(self): |
| 1352 |
> name_tsmb = self._new_shm_name('test01_null') |
| 1353 |
> sms = shared_memory.SharedMemory(name_tsmb, create=True, size=512) |
| 1354 |
> self.addCleanup(sms.unlink) |
| 1355 |
> with self.assertRaises(ValueError): |
| 1356 |
> shared_memory.SharedMemory(name_tsmb + '\0a', create=False, size=512) |
| 1357 |
> if shared_memory._USE_POSIX: |
| 1358 |
> orig_name = sms._name |
| 1359 |
> try: |
| 1360 |
> sms._name = orig_name + '\0a' |
| 1361 |
> with self.assertRaises(ValueError): |
| 1362 |
> sms.unlink() |
| 1363 |
> finally: |
| 1364 |
> sms._name = orig_name |
| 1365 |
> |
| 1366 |
4069c4108 |
| 1367 |
< def test_invalid_shared_memory_cration(self): |
| 1368 |
--- |
| 1369 |
> def test_invalid_shared_memory_creation(self): |