diff --git a/Lib/multiprocessing/managers.py b/Lib/multiprocessing/managers.py index 11c6e21de90e693..03d7577bdd81657 100644 --- a/Lib/multiprocessing/managers.py +++ b/Lib/multiprocessing/managers.py @@ -1224,7 +1224,7 @@ def __isub__(self, value): __class_getitem__ = classmethod(types.GenericAlias) -collections.abc.MutableMapping.register(_BaseSetProxy) +collections.abc.MutableSet.register(_BaseSetProxy) ArrayProxy = MakeProxyType('ArrayProxy', ( diff --git a/Lib/test/_test_multiprocessing.py b/Lib/test/_test_multiprocessing.py index e5f618f5f2e84f4..3958162eaa2e29d 100644 --- a/Lib/test/_test_multiprocessing.py +++ b/Lib/test/_test_multiprocessing.py @@ -2841,6 +2841,11 @@ def test_dict_proxy_nested(self): self.assertIsInstance(outer[0], list) # Not a ListProxy self.assertEqual(outer[-1][-1]['feed'], 3) + def test_set_isinstance(self): + s = self.set() + self.assertIsInstance(s, collections.abc.MutableSet) + self.assertNotIsInstance(s, collections.abc.MutableMapping) + def test_nested_queue(self): a = self.list() # Test queue inside list a.append(self.Queue()) @@ -7675,6 +7680,7 @@ class ManagerMixin(BaseMixin): Array = property(operator.attrgetter('manager.Array')) list = property(operator.attrgetter('manager.list')) dict = property(operator.attrgetter('manager.dict')) + set = property(operator.attrgetter('manager.set')) Namespace = property(operator.attrgetter('manager.Namespace')) @classmethod diff --git a/Misc/NEWS.d/next/Library/2025-12-18-10-37-01.gh-issue-142740.Di48Rf.rst b/Misc/NEWS.d/next/Library/2025-12-18-10-37-01.gh-issue-142740.Di48Rf.rst new file mode 100644 index 000000000000000..389704bc9288263 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2025-12-18-10-37-01.gh-issue-142740.Di48Rf.rst @@ -0,0 +1,3 @@ +Register :class:`!multiprocessing.managers.SetProxy` as +:class:`collections.abc.MutableSet` rather than +:class:`~collections.abc.MutableMapping`.