gh-103134: Update multiprocessing.managers.ListProxy and multiprocessing.managers.DictProxy #103133
gh-103134: Update multiprocessing.managers.ListProxy and multiprocessing.managers.DictProxy #103133encukou merged 34 commits into
Conversation
```
from multiprocessing import Manager
with Manager() as manager:
xs = manager.list()
xs.clear()
```
For now, we can use the workaround `del xs[:]`
|
Most changes to Python require a NEWS entry. Please add it using the blurb_it web app or the blurb command-line tool. |
Sorry, something went wrong.
Sorry, something went wrong.
terryjreedy
left a comment
There was a problem hiding this comment.
Are there any tests for BaseList Proxy or derivatives that are not automatically expanded by expanding this list? And which should be manually augmented?
Sorry, something went wrong.
|
As mentioned on issue, DictProxy and maybe others need updating. |
Sorry, something went wrong.
```
from multiprocessing import Manager
with Manager() as manager:
xs = manager.list()
xs.clear
xs.copy
d = manager.dict()
d | {} # __or__
{} | d # __ror__
reversed(d) # __reversed__
d.fromkeys
```
suggested by @terryjreedy
tested manually in Python 3.10.8
python#103134
…Hrn91.rst Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
Added a few more bits to DictProxy to support the cases you mentioned, including After your comments, I'm tempted to replace |
Sorry, something went wrong.
|
As an update, I did try removing RESULTSACTUAL after replacing EXPECTED and ACTUAL with current commits for this pull request -- works with this pull request The pull request passes the above manual test. |
Sorry, something went wrong.
|
We could write a test that uses a process to modify a manager.list or manager.list, then check that the list or dict has actually been modified. I found the multiprocessing tests here will try to add tests over the weekend |
Sorry, something went wrong.
|
This pull request is ready for review. Thanks to @arhadthedev for accepting this issue, @terryjreedy for the suggestions and @sunmy2019 for the very important hints. |
Sorry, something went wrong.
|
This minor enhancement backports recently added list and dictionary functionality into multiprocessing.managers.ListProxy and multiprocessing.managers.DictProxy so that scripts that use multiprocessing.Manager can use the same list and dictionary functionality. Would it be possible for someone to review these proposed enhancements? @kumaraditya303 |
Sorry, something went wrong.
serhiy-storchaka
left a comment
There was a problem hiding this comment.
Please test the type and the value of results.
Sorry, something went wrong.
|
It's been almost a year, but I finally got around to making the changes requested by @serhiy-storchaka. Would it be possible for someone to review these changes? |
Sorry, something went wrong.
Check that the dictionary returned by dict_proxy.from_keys is a dict as defined in dict.from_keys as requested by @encukou
|
Thanks to @encukou for taking the time to review this during the PyCon 2024 sprints!! |
Sorry, something went wrong.
For now, we can use the workaround
del xs[:]