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
20efceb7
Kaydet (Commit)
20efceb7
authored
May 17, 2014
tarafından
Brian Quinlan
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #21362: concurrent.futures does not validate that max_workers is proper
üst
120e8edf
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
15 additions
and
0 deletions
+15
-0
concurrent.futures.rst
Doc/library/concurrent.futures.rst
+2
-0
process.py
Lib/concurrent/futures/process.py
+3
-0
thread.py
Lib/concurrent/futures/thread.py
+3
-0
test_concurrent_futures.py
Lib/test/test_concurrent_futures.py
+7
-0
No files found.
Doc/library/concurrent.futures.rst
Dosyayı görüntüle @
20efceb7
...
...
@@ -175,6 +175,8 @@ to a :class:`ProcessPoolExecutor` will result in deadlock.
An :class:`Executor` subclass that executes calls asynchronously using a pool
of at most *max_workers* processes. If *max_workers* is ``None`` or not
given, it will default to the number of processors on the machine.
If *max_workers* is lower or equal to ``0``, then a :exc:`ValueError`
will be raised.
.. versionchanged:: 3.3
When one of the worker processes terminates abruptly, a
...
...
Lib/concurrent/futures/process.py
Dosyayı görüntüle @
20efceb7
...
...
@@ -334,6 +334,9 @@ class ProcessPoolExecutor(_base.Executor):
if
max_workers
is
None
:
self
.
_max_workers
=
os
.
cpu_count
()
or
1
else
:
if
max_workers
<=
0
:
raise
ValueError
(
"max_workers must be greater than 0"
)
self
.
_max_workers
=
max_workers
# Make the call queue slightly larger than the number of processes to
...
...
Lib/concurrent/futures/thread.py
Dosyayı görüntüle @
20efceb7
...
...
@@ -87,6 +87,9 @@ class ThreadPoolExecutor(_base.Executor):
max_workers: The maximum number of threads that can be used to
execute the given calls.
"""
if
max_workers
<=
0
:
raise
ValueError
(
"max_workers must be greater than 0"
)
self
.
_max_workers
=
max_workers
self
.
_work_queue
=
queue
.
Queue
()
self
.
_threads
=
set
()
...
...
Lib/test/test_concurrent_futures.py
Dosyayı görüntüle @
20efceb7
...
...
@@ -425,6 +425,13 @@ class ExecutorTest:
self
.
assertTrue
(
collected
,
"Stale reference not collected within timeout."
)
def
test_max_workers_negative
(
self
):
for
number
in
(
0
,
-
1
):
with
self
.
assertRaisesRegexp
(
ValueError
,
"max_workers must be greater "
"than 0"
):
self
.
executor_type
(
max_workers
=
number
)
class
ThreadPoolExecutorTest
(
ThreadPoolMixin
,
ExecutorTest
,
unittest
.
TestCase
):
def
test_map_submits_without_iteration
(
self
):
...
...
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