[issue12285] Unexpected behavior for 0 or negative processes in multiprocessing.pool()

Jorgen Skancke report at bugs.python.org
Wed Jun 8 15:55:29 CEST 2011


New submission from Jorgen Skancke <jorgsk at nt.ntnu.no>:

A normal way to start a multiprocessing-pool is like this:

Multiprocessing.Pool(processes=some_number).

However, if 'some_number' is 0 or negative, Python hangs and must be killed. I would expect an error message of the type: "Number of processes must be at least 1".

Attaching a script that reproduces this.

I struggled a bit with this for a program that uses cpu_count() - 4 to calculate 'some_number'. Guess what happens when the number of cores is 4 :) Even though the fix is easy (if some_number < 1), it would be nice to be warned about it.

----------
components: Library (Lib)
files: multitest_pool.py
messages: 137908
nosy: jorgsk
priority: normal
severity: normal
status: open
title: Unexpected behavior for 0 or negative processes in multiprocessing.pool()
versions: Python 2.6
Added file: http://bugs.python.org/file22283/multitest_pool.py

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue12285>
_______________________________________


More information about the Python-bugs-list mailing list