# HG changeset patch # Parent c445746d08461dc146afcb34116b8d2731da853d Check for negative workers even if ProcessPoolExecutor unavailable This matches the documentation, and passes the test suite when multithreading is disabled. diff -r c445746d0846 Lib/compileall.py --- a/Lib/compileall.py Wed Oct 19 19:37:20 2016 +0300 +++ b/Lib/compileall.py Thu Oct 20 07:34:39 2016 +0000 @@ -66,13 +66,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 = 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, diff -r c445746d0846 Misc/NEWS --- a/Misc/NEWS Wed Oct 19 19:37:20 2016 +0300 +++ b/Misc/NEWS Thu Oct 20 07:34:39 2016 +0000 @@ -110,6 +110,10 @@ Library ------- +- Issue #NNNNN: Always raise ValueError for negative + compileall.compile_dir(workers=...) parameter, even when multithreading is + unavailable. + - Issue #24452: Make webbrowser support Chrome on Mac OS X. - Issue #20766: Fix references leaked by pdb in the handling of SIGINT