Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
33aaa73c
Kaydet (Commit)
33aaa73c
authored
Eki 28, 2013
tarafından
Richard Oudkerk
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
Merge.
üst
e6514f53
e90cedb7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
5 deletions
+19
-5
pool.py
Lib/multiprocessing/pool.py
+9
-5
_test_multiprocessing.py
Lib/test/_test_multiprocessing.py
+10
-0
No files found.
Lib/multiprocessing/pool.py
Dosyayı görüntüle @
33aaa73c
...
...
@@ -174,7 +174,8 @@ class Pool(object):
self
.
_task_handler
=
threading
.
Thread
(
target
=
Pool
.
_handle_tasks
,
args
=
(
self
.
_taskqueue
,
self
.
_quick_put
,
self
.
_outqueue
,
self
.
_pool
)
args
=
(
self
.
_taskqueue
,
self
.
_quick_put
,
self
.
_outqueue
,
self
.
_pool
,
self
.
_cache
)
)
self
.
_task_handler
.
daemon
=
True
self
.
_task_handler
.
_state
=
RUN
...
...
@@ -364,7 +365,7 @@ class Pool(object):
util
.
debug
(
'worker handler exiting'
)
@staticmethod
def
_handle_tasks
(
taskqueue
,
put
,
outqueue
,
pool
):
def
_handle_tasks
(
taskqueue
,
put
,
outqueue
,
pool
,
cache
):
thread
=
threading
.
current_thread
()
for
taskseq
,
set_length
in
iter
(
taskqueue
.
get
,
None
):
...
...
@@ -375,9 +376,12 @@ class Pool(object):
break
try
:
put
(
task
)
except
OSError
:
util
.
debug
(
'could not put task on queue'
)
break
except
Exception
as
e
:
job
,
ind
=
task
[:
2
]
try
:
cache
[
job
]
.
_set
(
ind
,
(
False
,
e
))
except
KeyError
:
pass
else
:
if
set_length
:
util
.
debug
(
'doing set_length()'
)
...
...
Lib/test/_test_multiprocessing.py
Dosyayı görüntüle @
33aaa73c
...
...
@@ -1698,6 +1698,16 @@ class _TestPool(BaseTestCase):
self
.
assertEqual
(
2
,
len
(
call_args
))
self
.
assertIsInstance
(
call_args
[
1
],
ValueError
)
def
test_map_unplicklable
(
self
):
# Issue #19425 -- failure to pickle should not cause a hang
if
self
.
TYPE
==
'threads'
:
return
class
A
(
object
):
def
__reduce__
(
self
):
raise
RuntimeError
(
'cannot pickle'
)
with
self
.
assertRaises
(
RuntimeError
):
self
.
pool
.
map
(
sqr
,
[
A
()]
*
10
)
def
test_map_chunksize
(
self
):
try
:
self
.
pool
.
map_async
(
sqr
,
[],
chunksize
=
1
)
.
get
(
timeout
=
TIMEOUT1
)
...
...
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