Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
e0e5065d
Commit
e0e5065d
authored
Sep 17, 2018
by
Serhiy Storchaka
Committed by
GitHub
Sep 17, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bpo-34610: Fixed iterator of multiprocessing.managers.DictProxy. (GH-9113)
parent
ddd1949f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
1 deletion
+28
-1
Lib/multiprocessing/managers.py
Lib/multiprocessing/managers.py
+4
-1
Lib/test/_test_multiprocessing.py
Lib/test/_test_multiprocessing.py
+23
-0
Misc/NEWS.d/next/Library/2018-09-08-12-57-07.bpo-34610.wmoP5j.rst
...S.d/next/Library/2018-09-08-12-57-07.bpo-34610.wmoP5j.rst
+1
-0
No files found.
Lib/multiprocessing/managers.py
View file @
e0e5065d
...
...
@@ -1134,10 +1134,13 @@ class ListProxy(BaseListProxy):
DictProxy
=
MakeProxyType
(
'DictProxy'
,
(
'__contains__'
,
'__delitem__'
,
'__getitem__'
,
'__len__'
,
'__contains__'
,
'__delitem__'
,
'__getitem__'
,
'__
iter__'
,
'__
len__'
,
'__setitem__'
,
'clear'
,
'copy'
,
'get'
,
'has_key'
,
'items'
,
'keys'
,
'pop'
,
'popitem'
,
'setdefault'
,
'update'
,
'values'
))
DictProxy
.
_method_to_typeid_
=
{
'__iter__'
:
'Iterator'
,
}
ArrayProxy
=
MakeProxyType
(
'ArrayProxy'
,
(
...
...
Lib/test/_test_multiprocessing.py
View file @
e0e5065d
...
...
@@ -2080,6 +2080,16 @@ class _TestContainers(BaseTestCase):
a
.
append
(
'hello'
)
self
.
assertEqual
(
f
[
0
][:],
[
0
,
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
,
'hello'
])
def
test_list_iter
(
self
):
a
=
self
.
list
(
list
(
range
(
10
)))
it
=
iter
(
a
)
self
.
assertEqual
(
list
(
it
),
list
(
range
(
10
)))
self
.
assertEqual
(
list
(
it
),
[])
# exhausted
# list modified during iteration
it
=
iter
(
a
)
a
[
0
]
=
100
self
.
assertEqual
(
next
(
it
),
100
)
def
test_list_proxy_in_list
(
self
):
a
=
self
.
list
([
self
.
list
(
range
(
3
))
for
_i
in
range
(
3
)])
self
.
assertEqual
([
inner
[:]
for
inner
in
a
],
[[
0
,
1
,
2
]]
*
3
)
...
...
@@ -2110,6 +2120,19 @@ class _TestContainers(BaseTestCase):
self
.
assertEqual
(
sorted
(
d
.
values
()),
[
chr
(
i
)
for
i
in
indices
])
self
.
assertEqual
(
sorted
(
d
.
items
()),
[(
i
,
chr
(
i
))
for
i
in
indices
])
def
test_dict_iter
(
self
):
d
=
self
.
dict
()
indices
=
list
(
range
(
65
,
70
))
for
i
in
indices
:
d
[
i
]
=
chr
(
i
)
it
=
iter
(
d
)
self
.
assertEqual
(
list
(
it
),
indices
)
self
.
assertEqual
(
list
(
it
),
[])
# exhausted
# dictionary changed size during iteration
it
=
iter
(
d
)
d
.
clear
()
self
.
assertRaises
(
RuntimeError
,
next
,
it
)
def
test_dict_proxy_nested
(
self
):
pets
=
self
.
dict
(
ferrets
=
2
,
hamsters
=
4
)
supplies
=
self
.
dict
(
water
=
10
,
feed
=
3
)
...
...
Misc/NEWS.d/next/Library/2018-09-08-12-57-07.bpo-34610.wmoP5j.rst
0 → 100644
View file @
e0e5065d
Fixed iterator of :class:`multiprocessing.managers.DictProxy`.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment