[Python-checkins] cpython (merge 3.6 -> default): Issue #28485: Merge single-threading fix from 3.6

martin.panter python-checkins at python.org
Fri Nov 4 22:23:43 EDT 2016


https://hg.python.org/cpython/rev/7d9885fd6777
changeset:   104914:7d9885fd6777
parent:      104911:87d76ce01217
parent:      104913:a7c76c3843af
user:        Martin Panter <vadmium+py at gmail.com>
date:        Sat Nov 05 01:56:58 2016 +0000
summary:
  Issue #28485: Merge single-threading fix from 3.6

files:
  Lib/compileall.py |  6 +++---
  Misc/NEWS         |  4 ++++
  2 files changed, 7 insertions(+), 3 deletions(-)


diff --git a/Lib/compileall.py b/Lib/compileall.py
--- a/Lib/compileall.py
+++ b/Lib/compileall.py
@@ -68,13 +68,13 @@
     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
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -582,6 +582,10 @@
 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.
 

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list