Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 34k
gh-103134: Update multiprocessing.managers.ListProxy and multiprocessing.managers.DictProxy #103133
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Uh oh!
There was an error while loading. Please reload this page.
Merged
Changes from all commits
Commits
Show all changes
34 commits Select commit Hold shift + click to select a range
6fb4cba Add support for manager.list().clear()
invisibleroads b3c8810 📜🤖 Added by blurb_it.
blurb-it[bot] fc803ca Update 2023-03-30-18-19-53.gh-issue-103134.bHrn91.rst
invisibleroads a748d41 Update ListProxy and DictProxy
invisibleroads 22de5a1 Update Misc/NEWS.d/next/Library/2023-03-30-18-19-53.gh-issue-103134.b…
invisibleroads 8602f0a Update 2023-03-30-18-19-53.gh-issue-103134.bHrn91.rst
invisibleroads 6fe264a Add DictProxy.__ior__ for d |={'b': 2}
invisibleroads 8c2afdb Update 2023-03-30-18-19-53.gh-issue-103134.bHrn91.rst
invisibleroads 3ae5749 Merge branch 'python:main' into patch-1
invisibleroads 1cf0985 Fix __ior__ and add tests thanks to https://github.com/python/cpython…
invisibleroads 5ef9850 Merge branch 'main' into patch-1
invisibleroads dd54efc Merge branch 'main' into patch-1
invisibleroads 8354c5b Merge branch 'main' into patch-1
invisibleroads b826c7b Merge branch 'main' into patch-1
invisibleroads 8550fe6 Merge branch 'main' into patch-1
invisibleroads a57c395 Merge branch 'main' into patch-1
invisibleroads d3e88af Merge branch 'main' into patch-1
invisibleroads dc298c6 Merge branch 'main' into patch-1
invisibleroads e33e7ab Merge branch 'main' into patch-1
invisibleroads 9e71823 Merge branch 'main' into patch-1
invisibleroads 847c072 Merge branch 'main' into patch-1
invisibleroads 820b45b Merge branch 'main' into patch-1
invisibleroads e94d306 Merge branch 'main' into patch-1
invisibleroads 083ad3d Merge branch 'main' into patch-1
invisibleroads 83ecdb3 Test the type and the value of the results as requested by @serhiy-st…
invisibleroads 6f2ea5b Remove trailing whitespace
invisibleroads b95f840 Merge branch 'main' into patch-1
invisibleroads 0e94e31 Merge branch 'main' into patch-1
invisibleroads 15089ce Merge branch 'main' into patch-1
invisibleroads d9b3bf6 Merge branch 'main' into patch-1
invisibleroads 9eb39c9 Merge branch 'main' into patch-1
invisibleroads 80a2f64 Merge branch 'main' into patch-1
invisibleroads 577e5a3 Update _test_multiprocessing.py
invisibleroads 72d1055 Add links to the NEWS blurb
encukou File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1152,10 +1152,10 @@ def set(self, value): | ||
| BaseListProxy = MakeProxyType('BaseListProxy', ( | ||
| '__add__', '__contains__', '__delitem__', '__getitem__', '__len__', | ||
| '__mul__', '__reversed__', '__rmul__', '__setitem__', | ||
| 'append', 'count', 'extend', 'index', 'insert', 'pop', 'remove', | ||
| 'reverse', 'sort', '__imul__' | ||
| '__add__', '__contains__', '__delitem__', '__getitem__', '__imul__', | ||
| '__len__', '__mul__', '__reversed__', '__rmul__', '__setitem__', | ||
| 'append', 'clear', 'copy', 'count', 'extend', 'index', 'insert', 'pop', | ||
| 'remove', 'reverse', 'sort', | ||
| )) | ||
| class ListProxy(BaseListProxy): | ||
| def __iadd__(self, value): | ||
| @@ -1169,16 +1169,20 @@ def __imul__(self, value): | ||
| _BaseDictProxy = MakeProxyType('DictProxy', ( | ||
| '__contains__', '__delitem__', '__getitem__', '__iter__', '__len__', | ||
| '__setitem__', 'clear', 'copy', 'get', 'items', | ||
| '__contains__', '__delitem__', '__getitem__', '__ior__', '__iter__', | ||
invisibleroads marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading. Please reload this page. | ||
| '__len__', '__or__', '__reversed__', '__ror__', | ||
| '__setitem__', 'clear', 'copy', 'fromkeys', 'get', 'items', | ||
| 'keys', 'pop', 'popitem', 'setdefault', 'update', 'values' | ||
| )) | ||
| _BaseDictProxy._method_to_typeid_ ={ | ||
| '__iter__': 'Iterator', | ||
| } | ||
| class DictProxy(_BaseDictProxy): | ||
| __class_getitem__ = classmethod(types.GenericAlias) | ||
| def __ior__(self, value): | ||
| self._callmethod('__ior__', (value,)) | ||
| return self | ||
| __class_getitem__ = classmethod(types.GenericAlias) | ||
| ArrayProxy = MakeProxyType('ArrayProxy', ( | ||
| '__len__', '__getitem__', '__setitem__' | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -6064,12 +6064,30 @@ def _test_list(cls, obj): | ||
| case.assertEqual(obj[0], 5) | ||
| case.assertEqual(obj.count(5), 1) | ||
| case.assertEqual(obj.index(5), 0) | ||
| obj += [7] | ||
invisibleroads marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading. Please reload this page. | ||
| case.assertIsInstance(obj, multiprocessing.managers.ListProxy) | ||
| case.assertListEqual(list(obj), [5, 7]) | ||
| obj *= 2 | ||
| case.assertIsInstance(obj, multiprocessing.managers.ListProxy) | ||
| case.assertListEqual(list(obj), [5, 7, 5, 7]) | ||
| double_obj = obj * 2 | ||
| case.assertIsInstance(double_obj, list) | ||
| case.assertListEqual(list(double_obj), [5, 7, 5, 7, 5, 7, 5, 7]) | ||
| double_obj = 2 * obj | ||
| case.assertIsInstance(double_obj, list) | ||
| case.assertListEqual(list(double_obj), [5, 7, 5, 7, 5, 7, 5, 7]) | ||
| copied_obj = obj.copy() | ||
| case.assertIsInstance(copied_obj, list) | ||
| case.assertListEqual(list(copied_obj), [5, 7, 5, 7]) | ||
| obj.extend(double_obj + copied_obj) | ||
| obj.sort() | ||
| obj.reverse() | ||
| for x in obj: | ||
| pass | ||
| case.assertEqual(len(obj), 1) | ||
| case.assertEqual(obj.pop(0), 5) | ||
| case.assertEqual(len(obj), 16) | ||
| case.assertEqual(obj.pop(0), 7) | ||
| obj.clear() | ||
| case.assertEqual(len(obj), 0) | ||
| def test_list(self): | ||
| o = self.manager.list() | ||
| @@ -6088,7 +6106,29 @@ def _test_dict(cls, obj): | ||
| case.assertListEqual(list(obj.keys()), ['foo']) | ||
| case.assertListEqual(list(obj.values()), [5]) | ||
| case.assertDictEqual(obj.copy(),{'foo': 5}) | ||
| case.assertTupleEqual(obj.popitem(), ('foo', 5)) | ||
| obj |={'bar': 6} | ||
invisibleroads marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading. Please reload this page. | ||
| case.assertIsInstance(obj, multiprocessing.managers.DictProxy) | ||
| case.assertDictEqual(dict(obj),{'foo': 5, 'bar': 6}) | ||
| x = reversed(obj) | ||
| case.assertIsInstance(x, type(iter([]))) | ||
| case.assertListEqual(list(x), ['bar', 'foo']) | ||
| x ={'bar': 7, 'baz': 7} | obj | ||
| case.assertIsInstance(x, dict) | ||
| case.assertDictEqual(dict(x),{'foo': 5, 'bar': 6, 'baz': 7}) | ||
| x = obj |{'bar': 7, 'baz': 7} | ||
| case.assertIsInstance(x, dict) | ||
| case.assertDictEqual(dict(x),{'foo': 5, 'bar': 7, 'baz': 7}) | ||
| x = obj.fromkeys(['bar'], 6) | ||
| case.assertIsInstance(x, dict) | ||
| case.assertDictEqual(x,{'bar': 6}) | ||
| x = obj.popitem() | ||
| case.assertIsInstance(x, tuple) | ||
| case.assertTupleEqual(x, ('bar', 6)) | ||
| obj.setdefault('bar', 0) | ||
| obj.update({'bar': 7}) | ||
| case.assertEqual(obj.pop('bar'), 7) | ||
| obj.clear() | ||
| case.assertEqual(len(obj), 0) | ||
| def test_dict(self): | ||
| o = self.manager.dict() | ||
6 changes: 6 additions & 0 deletions 6 Misc/NEWS.d/next/Library/2023-03-30-18-19-53.gh-issue-103134.bHrn91.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| Add additional methods to :ref:`proxy objects <multiprocessing-proxy_objects>` | ||
| in the :mod:`!multiprocessing` module: | ||
| * :meth:`!clear` and :meth:`!copy` for proxies of :class:`list` | ||
| * :meth:`~dict.fromkeys`, ``reversed(d)``, ``d |{}``, ``{} | d``, | ||
| ``d |={'b': 2}`` for proxies of :class:`dict` |
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.