Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 52dfd4b

Browse files
committed
Issue #28485: Merge single-threading fix from 3.6
2 parents e37c1cb + cee93c3 commit 52dfd4b

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

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
@@ -582,6 +582,10 @@ Core and Builtins
582582
Library
583583
-------
584584

585+
- Issue #28485: Always raise ValueError for negative
586+
compileall.compile_dir(workers=...) parameter, even when multithreading is
587+
unavailable.
588+
585589
- Issue #28037: Use sqlite3_get_autocommit() instead of setting
586590
Connection->inTransaction manually.
587591

0 commit comments

Comments
 (0)