@@ -1266,3 +1266,326 @@ diff Python-3.14.0a4/Lib/test/_test_multiprocessing.py Python-3.14.0a5/Lib/test/
1266
1266
---
1267
1267
> for process in forked_processes:
1268
1268
> self.assertFalse(process.is_alive(), process)
1269
+ # ----------------------------------------------------------------------
1270
+ diff Python-3.14.0a5/Modules/_multiprocessing/clinic/semaphore.c.h Python-3.14.0a6/Modules/_multiprocessing/clinic/semaphore.c.h
1271
+ 326c326
1272
+ < _multiprocessing_SemLock__rebuild(PyTypeObject *type, PyObject *const *args, Py_ssize_t nargs)
1273
+ ---
1274
+ > _multiprocessing_SemLock__rebuild(PyObject *type, PyObject *const *args, Py_ssize_t nargs)
1275
+ 338c338
1276
+ < return_value = _multiprocessing_SemLock__rebuild_impl(type, handle, kind, maxvalue, name);
1277
+ ---
1278
+ > return_value = _multiprocessing_SemLock__rebuild_impl((PyTypeObject *)type, handle, kind, maxvalue, name);
1279
+ 579c579
1280
+ < /*[clinic end generated code: output=e28d0fdbfefd1235 input=a9049054013a1b77]*/
1281
+ ---
1282
+ > /*[clinic end generated code: output=dddd8e989525f565 input=a9049054013a1b77]*/
1283
+ diff Python-3.14.0a5/Lib/multiprocessing/managers.py Python-3.14.0a6/Lib/multiprocessing/managers.py
1284
+ 1197a1198,1227
1285
+ > _BaseSetProxy = MakeProxyType("_BaseSetProxy", (
1286
+ > '__and__', '__class_getitem__', '__contains__', '__iand__', '__ior__',
1287
+ > '__isub__', '__iter__', '__ixor__', '__len__', '__or__', '__rand__',
1288
+ > '__ror__', '__rsub__', '__rxor__', '__sub__', '__xor__',
1289
+ > '__ge__', '__gt__', '__le__', '__lt__',
1290
+ > 'add', 'clear', 'copy', 'difference', 'difference_update', 'discard',
1291
+ > 'intersection', 'intersection_update', 'isdisjoint', 'issubset',
1292
+ > 'issuperset', 'pop', 'remove', 'symmetric_difference',
1293
+ > 'symmetric_difference_update', 'union', 'update',
1294
+ > ))
1295
+ >
1296
+ > class SetProxy(_BaseSetProxy):
1297
+ > def __ior__(self, value):
1298
+ > self._callmethod('__ior__', (value,))
1299
+ > return self
1300
+ > def __iand__(self, value):
1301
+ > self._callmethod('__iand__', (value,))
1302
+ > return self
1303
+ > def __ixor__(self, value):
1304
+ > self._callmethod('__ixor__', (value,))
1305
+ > return self
1306
+ > def __isub__(self, value):
1307
+ > self._callmethod('__isub__', (value,))
1308
+ > return self
1309
+ >
1310
+ > __class_getitem__ = classmethod(types.GenericAlias)
1311
+ >
1312
+ > collections.abc.MutableMapping.register(_BaseSetProxy)
1313
+ >
1314
+ >
1315
+ 1247a1278
1316
+ > SyncManager.register('set', set, SetProxy)
1317
+ diff Python-3.14.0a5/Lib/test/_test_multiprocessing.py Python-3.14.0a6/Lib/test/_test_multiprocessing.py
1318
+ 592c592,593
1319
+ < p = self.Process(target=time.sleep, args=(DELTA,))
1320
+ ---
1321
+ > event = self.Event()
1322
+ > p = self.Process(target=event.wait, args=())
1323
+ 595,597c596,601
1324
+ < p.daemon = True
1325
+ < p.start()
1326
+ < self.assertIn(p, self.active_children())
1327
+ ---
1328
+ > try:
1329
+ > p.daemon = True
1330
+ > p.start()
1331
+ > self.assertIn(p, self.active_children())
1332
+ > finally:
1333
+ > event.set()
1334
+ 1524,1527c1528,1529
1335
+ <
1336
+ < t = threading.Thread(target=self._acquire_release,
1337
+ < args=(lock, 0.2),
1338
+ < name=f'T1')
1339
+ ---
1340
+ > rlock = self.RLock()
1341
+ > t = threading.Thread(target=rlock.acquire)
1342
+ 1529,1531c1531,1532
1343
+ < time.sleep(0.1)
1344
+ < self.assertEqual('<RLock(SomeOtherThread, nonzero)>', repr(lock))
1345
+ < time.sleep(0.2)
1346
+ ---
1347
+ > t.join()
1348
+ > self.assertEqual('<RLock(SomeOtherThread, nonzero)>', repr(rlock))
1349
+ 1542,1545c1543,1544
1350
+ < event = self.Event()
1351
+ < lock = self.RLock()
1352
+ < p = self.Process(target=self._acquire_event,
1353
+ < args=(lock, event))
1354
+ ---
1355
+ > rlock = self.RLock()
1356
+ > p = self.Process(target=self._acquire, args=(rlock,))
1357
+ 1547,1548d1545
1358
+ < event.wait()
1359
+ < self.assertEqual('<RLock(SomeOtherProcess, nonzero)>', repr(lock))
1360
+ 1549a1547
1361
+ > self.assertEqual('<RLock(SomeOtherProcess, nonzero)>', repr(rlock))
1362
+ 1631c1629
1363
+ < for i in range(10):
1364
+ ---
1365
+ > for _ in support.sleeping_retry(support.SHORT_TIMEOUT):
1366
+ 1637,1638c1635
1367
+ < time.sleep(DELTA)
1368
+ < time.sleep(DELTA)
1369
+ ---
1370
+ >
1371
+ 1660d1656
1372
+ < self.addCleanup(p.join)
1373
+ 1662,1665c1658,1660
1374
+ < p = threading.Thread(target=self.f, args=(cond, sleeping, woken))
1375
+ < p.daemon = True
1376
+ < p.start()
1377
+ < self.addCleanup(p.join)
1378
+ ---
1379
+ > t = threading.Thread(target=self.f, args=(cond, sleeping, woken))
1380
+ > t.daemon = True
1381
+ > t.start()
1382
+ 1672,1673c1667
1383
+ < time.sleep(DELTA)
1384
+ < self.assertReturnsIfImplemented(0, get_value, woken)
1385
+ ---
1386
+ > self.assertReachesEventually(lambda: get_value(woken), 0)
1387
+ 1681,1682c1675
1388
+ < time.sleep(DELTA)
1389
+ < self.assertReturnsIfImplemented(1, get_value, woken)
1390
+ ---
1391
+ > self.assertReachesEventually(lambda: get_value(woken), 1)
1392
+ 1690,1691c1683
1393
+ < time.sleep(DELTA)
1394
+ < self.assertReturnsIfImplemented(2, get_value, woken)
1395
+ ---
1396
+ > self.assertReachesEventually(lambda: get_value(woken), 2)
1397
+ 1695c1687,1689
1398
+ < p.join()
1399
+ ---
1400
+ >
1401
+ > threading_helper.join_thread(t)
1402
+ > join_process(p)
1403
+ 1702a1697
1404
+ > workers = []
1405
+ 1708c1703
1406
+ < self.addCleanup(p.join)
1407
+ ---
1408
+ > workers.append(p)
1409
+ 1714c1709
1410
+ < self.addCleanup(t.join)
1411
+ ---
1412
+ > workers.append(t)
1413
+ 1733c1728
1414
+ < self.addCleanup(p.join)
1415
+ ---
1416
+ > workers.append(p)
1417
+ 1738c1733
1418
+ < self.addCleanup(t.join)
1419
+ ---
1420
+ > workers.append(t)
1421
+ 1754c1749,1751
1422
+ < self.assertReachesEventually(lambda: get_value(woken), 6)
1423
+ ---
1424
+ > for i in range(6):
1425
+ > woken.acquire()
1426
+ > self.assertReturnsIfImplemented(0, get_value, woken)
1427
+ 1758a1756,1759
1428
+ > for w in workers:
1429
+ > # NOTE: join_process and join_thread are the same
1430
+ > threading_helper.join_thread(w)
1431
+ >
1432
+ 1764a1766
1433
+ > workers = []
1434
+ 1769c1771
1435
+ < self.addCleanup(p.join)
1436
+ ---
1437
+ > workers.append(p)
1438
+ 1774c1776
1439
+ < self.addCleanup(t.join)
1440
+ ---
1441
+ > workers.append(t)
1442
+ 1808a1811,1814
1443
+ > for w in workers:
1444
+ > # NOTE: join_process and join_thread are the same
1445
+ > threading_helper.join_thread(w)
1446
+ >
1447
+ 6443a6450,6593
1448
+ > @classmethod
1449
+ > def _test_set_operator_symbols(cls, obj):
1450
+ > case = unittest.TestCase()
1451
+ > obj.update(['a', 'b', 'c'])
1452
+ > case.assertEqual(len(obj), 3)
1453
+ > case.assertIn('a', obj)
1454
+ > case.assertNotIn('d', obj)
1455
+ > result = obj | {'d', 'e'}
1456
+ > case.assertSetEqual(result, {'a', 'b', 'c', 'd', 'e'})
1457
+ > result = {'d', 'e'} | obj
1458
+ > case.assertSetEqual(result, {'a', 'b', 'c', 'd', 'e'})
1459
+ > obj |= {'d', 'e'}
1460
+ > case.assertSetEqual(obj, {'a', 'b', 'c', 'd', 'e'})
1461
+ > case.assertIsInstance(obj, multiprocessing.managers.SetProxy)
1462
+ >
1463
+ > obj.clear()
1464
+ > obj.update(['a', 'b', 'c'])
1465
+ > result = {'a', 'b', 'd'} - obj
1466
+ > case.assertSetEqual(result, {'d'})
1467
+ > result = obj - {'a', 'b'}
1468
+ > case.assertSetEqual(result, {'c'})
1469
+ > obj -= {'a', 'b'}
1470
+ > case.assertSetEqual(obj, {'c'})
1471
+ > case.assertIsInstance(obj, multiprocessing.managers.SetProxy)
1472
+ >
1473
+ > obj.clear()
1474
+ > obj.update(['a', 'b', 'c'])
1475
+ > result = {'b', 'c', 'd'} ^ obj
1476
+ > case.assertSetEqual(result, {'a', 'd'})
1477
+ > result = obj ^ {'b', 'c', 'd'}
1478
+ > case.assertSetEqual(result, {'a', 'd'})
1479
+ > obj ^= {'b', 'c', 'd'}
1480
+ > case.assertSetEqual(obj, {'a', 'd'})
1481
+ > case.assertIsInstance(obj, multiprocessing.managers.SetProxy)
1482
+ >
1483
+ > obj.clear()
1484
+ > obj.update(['a', 'b', 'c'])
1485
+ > result = obj & {'b', 'c', 'd'}
1486
+ > case.assertSetEqual(result, {'b', 'c'})
1487
+ > result = {'b', 'c', 'd'} & obj
1488
+ > case.assertSetEqual(result, {'b', 'c'})
1489
+ > obj &= {'b', 'c', 'd'}
1490
+ > case.assertSetEqual(obj, {'b', 'c'})
1491
+ > case.assertIsInstance(obj, multiprocessing.managers.SetProxy)
1492
+ >
1493
+ > obj.clear()
1494
+ > obj.update(['a', 'b', 'c'])
1495
+ > case.assertSetEqual(set(obj), {'a', 'b', 'c'})
1496
+ >
1497
+ > @classmethod
1498
+ > def _test_set_operator_methods(cls, obj):
1499
+ > case = unittest.TestCase()
1500
+ > obj.add('d')
1501
+ > case.assertIn('d', obj)
1502
+ >
1503
+ > obj.clear()
1504
+ > obj.update(['a', 'b', 'c'])
1505
+ > copy_obj = obj.copy()
1506
+ > case.assertSetEqual(copy_obj, obj)
1507
+ > obj.remove('a')
1508
+ > case.assertNotIn('a', obj)
1509
+ > case.assertRaises(KeyError, obj.remove, 'a')
1510
+ >
1511
+ > obj.clear()
1512
+ > obj.update(['a'])
1513
+ > obj.discard('a')
1514
+ > case.assertNotIn('a', obj)
1515
+ > obj.discard('a')
1516
+ > case.assertNotIn('a', obj)
1517
+ > obj.update(['a'])
1518
+ > popped = obj.pop()
1519
+ > case.assertNotIn(popped, obj)
1520
+ >
1521
+ > obj.clear()
1522
+ > obj.update(['a', 'b', 'c'])
1523
+ > result = obj.intersection({'b', 'c', 'd'})
1524
+ > case.assertSetEqual(result, {'b', 'c'})
1525
+ > obj.intersection_update({'b', 'c', 'd'})
1526
+ > case.assertSetEqual(obj, {'b', 'c'})
1527
+ >
1528
+ > obj.clear()
1529
+ > obj.update(['a', 'b', 'c'])
1530
+ > result = obj.difference({'a', 'b'})
1531
+ > case.assertSetEqual(result, {'c'})
1532
+ > obj.difference_update({'a', 'b'})
1533
+ > case.assertSetEqual(obj, {'c'})
1534
+ >
1535
+ > obj.clear()
1536
+ > obj.update(['a', 'b', 'c'])
1537
+ > result = obj.symmetric_difference({'b', 'c', 'd'})
1538
+ > case.assertSetEqual(result, {'a', 'd'})
1539
+ > obj.symmetric_difference_update({'b', 'c', 'd'})
1540
+ > case.assertSetEqual(obj, {'a', 'd'})
1541
+ >
1542
+ > @classmethod
1543
+ > def _test_set_comparisons(cls, obj):
1544
+ > case = unittest.TestCase()
1545
+ > obj.update(['a', 'b', 'c'])
1546
+ > result = obj.union({'d', 'e'})
1547
+ > case.assertSetEqual(result, {'a', 'b', 'c', 'd', 'e'})
1548
+ > case.assertTrue(obj.isdisjoint({'d', 'e'}))
1549
+ > case.assertFalse(obj.isdisjoint({'a', 'd'}))
1550
+ >
1551
+ > case.assertTrue(obj.issubset({'a', 'b', 'c', 'd'}))
1552
+ > case.assertFalse(obj.issubset({'a', 'b'}))
1553
+ > case.assertLess(obj, {'a', 'b', 'c', 'd'})
1554
+ > case.assertLessEqual(obj, {'a', 'b', 'c'})
1555
+ >
1556
+ > case.assertTrue(obj.issuperset({'a', 'b'}))
1557
+ > case.assertFalse(obj.issuperset({'a', 'b', 'd'}))
1558
+ > case.assertGreater(obj, {'a'})
1559
+ > case.assertGreaterEqual(obj, {'a', 'b'})
1560
+ >
1561
+ > def test_set(self):
1562
+ > o = self.manager.set()
1563
+ > self.run_worker(self._test_set_operator_symbols, o)
1564
+ > o = self.manager.set()
1565
+ > self.run_worker(self._test_set_operator_methods, o)
1566
+ > o = self.manager.set()
1567
+ > self.run_worker(self._test_set_comparisons, o)
1568
+ >
1569
+ > def test_set_init(self):
1570
+ > o = self.manager.set({'a', 'b', 'c'})
1571
+ > self.assertSetEqual(o, {'a', 'b', 'c'})
1572
+ > o = self.manager.set(["a", "b", "c"])
1573
+ > self.assertSetEqual(o, {"a", "b", "c"})
1574
+ > o = self.manager.set({"a": 1, "b": 2, "c": 3})
1575
+ > self.assertSetEqual(o, {"a", "b", "c"})
1576
+ > self.assertRaises(RemoteError, self.manager.set, 1234)
1577
+ >
1578
+ > def test_set_contain_all_method(self):
1579
+ > o = self.manager.set()
1580
+ > set_methods = {
1581
+ > '__and__', '__class_getitem__', '__contains__', '__iand__', '__ior__',
1582
+ > '__isub__', '__iter__', '__ixor__', '__len__', '__or__', '__rand__',
1583
+ > '__ror__', '__rsub__', '__rxor__', '__sub__', '__xor__',
1584
+ > '__ge__', '__gt__', '__le__', '__lt__',
1585
+ > 'add', 'clear', 'copy', 'difference', 'difference_update', 'discard',
1586
+ > 'intersection', 'intersection_update', 'isdisjoint', 'issubset',
1587
+ > 'issuperset', 'pop', 'remove', 'symmetric_difference',
1588
+ > 'symmetric_difference_update', 'union', 'update',
1589
+ > }
1590
+ > self.assertLessEqual(set_methods, set(dir(o)))
1591
+ >
0 commit comments