Issue 34610: Incorrect iteration of Manager.dict() method of the multiprocessing module. (original) (raw)
Created on 2018-09-07 23:43 by deltaclock, last changed 2022-04-11 14:59 by admin. This issue is now closed.
Files | |||
---|---|---|---|
File name | Uploaded | Description | Edit |
test.py | deltaclock,2018-09-07 23:43 | Proof of concept code. |
Pull Requests | |||
---|---|---|---|
URL | Status | Linked | Edit |
PR 9113 | merged | serhiy.storchaka,2018-09-08 10:01 | |
PR 9349 | merged | miss-islington,2018-09-17 11:24 | |
PR 9350 | merged | miss-islington,2018-09-17 11:24 | |
PR 9500 | merged | serhiy.storchaka,2018-09-22 18:16 |
Messages (6) | ||
---|---|---|
msg324813 - (view) | Author: (deltaclock) | Date: 2018-09-07 23:43 |
The manager class of the multiprocessing module doesnt implement __next__ or __iter__ on its dictionary method and relies on using __getitem__. This results in an unexpected functionality of an object that is supposed to act like a dict, and instead of looping over the dictionary keys it loops over its values. The user needs to call dict() on this object in order to loop over it correctly, which is not that obvious. The problem originates from there https://github.com/python/cpython/blob/master/Lib/multiprocessing/managers.py#L1136 Poc link: https://hastebin.com/codoqihowi.py | ||
msg324820 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * ![]() |
Date: 2018-09-08 08:08 |
DictProxy needs to provide the __iter__() method. And perhaps methods keys(), values() and items() need to be reworked in Python 3. has_key() is unneeded in Python 3. It is worth to test also other special and new in Python 3 methods. | ||
msg325522 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * ![]() |
Date: 2018-09-17 11:24 |
New changeset e0e5065daef36dafe10a46eaa8b7800274d73062 by Serhiy Storchaka in branch 'master': bpo-34610: Fixed iterator of multiprocessing.managers.DictProxy. (GH-9113) https://github.com/python/cpython/commit/e0e5065daef36dafe10a46eaa8b7800274d73062 | ||
msg325528 - (view) | Author: miss-islington (miss-islington) | Date: 2018-09-17 12:11 |
New changeset 1d3078849381335008379e3de96d5a81d2131113 by Miss Islington (bot) in branch '3.7': bpo-34610: Fixed iterator of multiprocessing.managers.DictProxy. (GH-9113) https://github.com/python/cpython/commit/1d3078849381335008379e3de96d5a81d2131113 | ||
msg325529 - (view) | Author: miss-islington (miss-islington) | Date: 2018-09-17 12:11 |
New changeset f35e4d5851555d66f1e7a36b2a37f0d82b3d1706 by Miss Islington (bot) in branch '3.6': bpo-34610: Fixed iterator of multiprocessing.managers.DictProxy. (GH-9113) https://github.com/python/cpython/commit/f35e4d5851555d66f1e7a36b2a37f0d82b3d1706 | ||
msg326107 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * ![]() |
Date: 2018-09-22 18:34 |
New changeset 69d0bc1430d2e9cddf0b39054ddcb86dbbe7927e by Serhiy Storchaka in branch '2.7': [2.7] bpo-34610: Fixed iterator of multiprocessing.managers.DictProxy. (GH-9113). (GH-9500) https://github.com/python/cpython/commit/69d0bc1430d2e9cddf0b39054ddcb86dbbe7927e |
History | |||
---|---|---|---|
Date | User | Action | Args |
2022-04-11 14:59:05 | admin | set | github: 78791 |
2018-09-22 18:35:26 | serhiy.storchaka | set | status: open -> closedresolution: fixedstage: patch review -> resolved |
2018-09-22 18:34:26 | serhiy.storchaka | set | messages: + |
2018-09-22 18:16:29 | serhiy.storchaka | set | pull_requests: + <pull%5Frequest8907> |
2018-09-17 12:11:07 | miss-islington | set | messages: + |
2018-09-17 12:11:02 | miss-islington | set | nosy: + miss-islingtonmessages: + |
2018-09-17 11:24:38 | miss-islington | set | pull_requests: + <pull%5Frequest8773> |
2018-09-17 11:24:27 | miss-islington | set | pull_requests: + <pull%5Frequest8772> |
2018-09-17 11:24:06 | serhiy.storchaka | set | messages: + |
2018-09-08 10:01:33 | serhiy.storchaka | set | nosy: + pitrou, davin |
2018-09-08 10:01:11 | serhiy.storchaka | set | keywords: + patchstage: patch reviewpull_requests: + <pull%5Frequest8567> |
2018-09-08 08:08:20 | serhiy.storchaka | set | nosy: + benjamin.peterson, serhiy.storchakamessages: + versions: + Python 2.7, Python 3.7, Python 3.8 |
2018-09-07 23:43:37 | deltaclock | create |