summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Panter <vadmium+py@gmail.com>2016-11-05 01:35:25 (GMT)
committerMartin Panter <vadmium+py@gmail.com>2016-11-05 01:35:25 (GMT)
commitcee93c3b73a115e9f2982b9210be15c417a482dc (patch)
treeae6cd12af823a3e76aabd91d48583139aaaa10fc
parent7d76c906f7c5ab3b1c887e0c64a4478ffd4c0843 (diff)
parent88281ceed02d8f4599cb22f196e40bc30f4fb689 (diff)
downloadcpython-cee93c3b73a115e9f2982b9210be15c417a482dc.zip
cpython-cee93c3b73a115e9f2982b9210be15c417a482dc.tar.gz
cpython-cee93c3b73a115e9f2982b9210be15c417a482dc.tar.bz2
Issue #28485: Merge single-threading fix from 3.5 into 3.6
-rw-r--r--Lib/compileall.py6
-rw-r--r--Misc/NEWS4
2 files changed, 7 insertions, 3 deletions
diff --git a/Lib/compileall.py b/Lib/compileall.py
index 3e45785..1c9ceb6 100644
--- a/Lib/compileall.py
+++ b/Lib/compileall.py
@@ -68,13 +68,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 = True
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,
diff --git a/Misc/NEWS b/Misc/NEWS
index 011df94..037a4f6 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -573,6 +573,10 @@ Core and Builtins
Library
-------
+- Issue #28485: Always raise ValueError for negative
+ compileall.compile_dir(workers=...) parameter, even when multithreading is
+ unavailable.
+
- Issue #28037: Use sqlite3_get_autocommit() instead of setting
Connection->inTransaction manually.