Skip to content

Commit cee93c3

Browse files
committed
Issue python#28485: Merge single-threading fix from 3.5 into 3.6
2 parents 7d76c90 + 88281ce commit cee93c3

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

Lib/compileall.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,13 @@ def compile_dir(dir, maxlevels=10, ddir=None, force=False, rx=None,
6868
optimize: optimization level or -1 for level of the interpreter
6969
workers: maximum number of parallel workers
7070
"""
71+
if workers is not None and workers < 0:
72+
raise ValueError('workers must be greater or equal to 0')
73+
7174
files = _walk_dir(dir, quiet=quiet, maxlevels=maxlevels,
7275
ddir=ddir)
7376
success = True
7477
if workers is not None and workers != 1 and ProcessPoolExecutor is not None:
75-
if workers < 0:
76-
raise ValueError('workers must be greater or equal to 0')
77-
7878
workers = workers or None
7979
with ProcessPoolExecutor(max_workers=workers) as executor:
8080
results = executor.map(partial(compile_file,

Misc/NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -573,6 +573,10 @@ Core and Builtins
573573
Library
574574
-------
575575

576+
- Issue #28485: Always raise ValueError for negative
577+
compileall.compile_dir(workers=...) parameter, even when multithreading is
578+
unavailable.
579+
576580
- Issue #28037: Use sqlite3_get_autocommit() instead of setting
577581
Connection->inTransaction manually.
578582

0 commit comments

Comments
 (0)