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
969684f2
Commit
969684f2
authored
Oct 27, 2012
by
Hynek Schlawack
Browse files
Options
Browse Files
Download
Plain Diff
Merge 3.3
parents
5979fdf5
254af264
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
1 deletion
+23
-1
Lib/multiprocessing/pool.py
Lib/multiprocessing/pool.py
+2
-1
Lib/test/test_multiprocessing.py
Lib/test/test_multiprocessing.py
+17
-0
Misc/ACKS
Misc/ACKS
+1
-0
Misc/NEWS
Misc/NEWS
+3
-0
No files found.
Lib/multiprocessing/pool.py
View file @
969684f2
...
...
@@ -297,7 +297,8 @@ class Pool(object):
'''
Asynchronous version of `map()` method.
'''
return
self
.
_map_async
(
func
,
iterable
,
mapstar
,
chunksize
)
return
self
.
_map_async
(
func
,
iterable
,
mapstar
,
chunksize
,
callback
,
error_callback
)
def
_map_async
(
self
,
func
,
iterable
,
mapper
,
chunksize
=
None
,
callback
=
None
,
error_callback
=
None
):
...
...
Lib/test/test_multiprocessing.py
View file @
969684f2
...
...
@@ -1655,6 +1655,23 @@ class _TestPool(BaseTestCase):
self
.
assertEqual
(
self
.
pool
.
starmap_async
(
mul
,
tuples
).
get
(),
list
(
itertools
.
starmap
(
mul
,
tuples
)))
def
test_map_async
(
self
):
self
.
assertEqual
(
self
.
pool
.
map_async
(
sqr
,
list
(
range
(
10
))).
get
(),
list
(
map
(
sqr
,
list
(
range
(
10
)))))
def
test_map_async_callbacks
(
self
):
call_args
=
self
.
manager
.
list
()
if
self
.
TYPE
==
'manager'
else
[]
self
.
pool
.
map_async
(
int
,
[
'1'
],
callback
=
call_args
.
append
,
error_callback
=
call_args
.
append
).
wait
()
self
.
assertEqual
(
1
,
len
(
call_args
))
self
.
assertEqual
([
1
],
call_args
[
0
])
self
.
pool
.
map_async
(
int
,
[
'a'
],
callback
=
call_args
.
append
,
error_callback
=
call_args
.
append
).
wait
()
self
.
assertEqual
(
2
,
len
(
call_args
))
self
.
assertIsInstance
(
call_args
[
1
],
ValueError
)
def
test_map_chunksize
(
self
):
try
:
self
.
pool
.
map_async
(
sqr
,
[],
chunksize
=
1
).
get
(
timeout
=
TIMEOUT1
)
...
...
Misc/ACKS
View file @
969684f2
...
...
@@ -594,6 +594,7 @@ Jan Kaliszewski
Peter van Kampen
Rafe Kaplan
Jacob Kaplan-Moss
Janne Karila
Per Øyvind Karlsen
Lou Kates
Hiroaki Kawai
...
...
Misc/NEWS
View file @
969684f2
...
...
@@ -62,6 +62,9 @@ Core and Builtins
Library
-------
-
Issue
#
16307
:
Fix
multiprocessing
.
Pool
.
map_async
not
calling
its
callbacks
.
Patch
by
Janne
Karila
.
-
Issue
#
16305
:
Fix
a
segmentation
fault
occurring
when
interrupting
math
.
factorial
.
...
...
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