diff options
author | Martin Panter <vadmium+py@gmail.com> | 2016-11-05 01:11:36 (GMT) |
---|---|---|
committer | Martin Panter <vadmium+py@gmail.com> | 2016-11-05 01:11:36 (GMT) |
commit | 88281ceed02d8f4599cb22f196e40bc30f4fb689 (patch) | |
tree | f24d14a2a880599dc0958cf8ba063c05d436c687 | |
parent | da4887a88d4400ef12aca0bb8269838d2c9f9a00 (diff) | |
download | cpython-88281ceed02d8f4599cb22f196e40bc30f4fb689.zip cpython-88281ceed02d8f4599cb22f196e40bc30f4fb689.tar.gz cpython-88281ceed02d8f4599cb22f196e40bc30f4fb689.tar.bz2 |
Issue #28485: Check for negative workers even without ProcessPoolExecutor
This matches the documentation, and passes the test suite when multithreading
is disabled.
-rw-r--r-- | Lib/compileall.py | 6 | ||||
-rw-r--r-- | Misc/NEWS | 4 |
2 files changed, 7 insertions, 3 deletions
diff --git a/Lib/compileall.py b/Lib/compileall.py index 0cc0c1d..2d4c523 100644 --- a/Lib/compileall.py +++ b/Lib/compileall.py @@ -66,13 +66,13 @@ def compile_dir(dir, maxlevels=10, ddir=None, force=False, rx=None, optimize: optimization level or -1 for level of the interpreter workers: maximum number of parallel workers """ + if workers is not None and workers < 0: + raise ValueError('workers must be greater or equal to 0') + files = _walk_dir(dir, quiet=quiet, maxlevels=maxlevels, ddir=ddir) success = 1 if workers is not None and workers != 1 and ProcessPoolExecutor is not None: - if workers < 0: - raise ValueError('workers must be greater or equal to 0') - workers = workers or None with ProcessPoolExecutor(max_workers=workers) as executor: results = executor.map(partial(compile_file, @@ -113,6 +113,10 @@ Core and Builtins Library ------- +- Issue #28485: Always raise ValueError for negative + compileall.compile_dir(workers=...) parameter, even when multithreading is + unavailable. + - Issue #28387: Fixed possible crash in _io.TextIOWrapper deallocator when the garbage collector is invoked in other thread. Based on patch by Sebastian Cufre. |