mirror of
https://github.com/python/cpython.git
synced 2025-11-10 10:32:04 +00:00
GH-83658: make multiprocessing.Pool raise an exception if maxtasksperchild is not None or a positive int (GH-93364) (GH-93923)
This commit is contained in:
parent
05d83a706c
commit
2b7fc1bfe6
3 changed files with 9 additions and 0 deletions
|
|
@ -203,6 +203,9 @@ def __init__(self, processes=None, initializer=None, initargs=(),
|
|||
processes = os.cpu_count() or 1
|
||||
if processes < 1:
|
||||
raise ValueError("Number of processes must be at least 1")
|
||||
if maxtasksperchild is not None:
|
||||
if not isinstance(maxtasksperchild, int) or maxtasksperchild <= 0:
|
||||
raise ValueError("maxtasksperchild must be a positive int or None")
|
||||
|
||||
if initializer is not None and not callable(initializer):
|
||||
raise TypeError('initializer must be a callable')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue