@@ -578,7 +578,7 @@ class SpellingTask:
578578 "O" : glob .O
579579 }
580580
581- def __init__ (self , checker , config , binary = '' , verbose = 0 , jobs = 0 , debug = False , skip_dict_compile = False ):
581+ def __init__ (self , checker , config , binary = '' , verbose = 0 , jobs = None , debug = False , skip_dict_compile = False ):
582582 """Initialize."""
583583
584584 if checker == "hunspell" : # pragma: no cover
@@ -678,12 +678,14 @@ def run_task(self, task, source_patterns=None):
678678 source_patterns = self .task .get ('sources' , [])
679679
680680 # If jobs was not specified via command line, check the config for jobs settings
681- jobs = max (1 , self .config .get ('jobs' , 1 ) if self .jobs == 0 else self .jobs )
681+ jobs = self .config .get ('jobs' , 1 ) if self .jobs is None else self .jobs
682+ if jobs < 0 :
683+ jobs = 1
682684
683685 expect_match = self .task .get ('expect_match' , True )
684- if jobs > 1 :
686+ if jobs != 1 :
685687 # Use multi-processing to process files concurrently
686- with ProcessPoolExecutor (max_workers = jobs ) as pool :
688+ with ProcessPoolExecutor (max_workers = jobs if jobs else None ) as pool :
687689 for results in pool .map (self .multi_check , self .walk_src (source_patterns , glob_flags , glob_limit )):
688690 self .found_match = True
689691 yield from results
@@ -711,7 +713,7 @@ def spellcheck(
711713 sources = None ,
712714 verbose = 0 ,
713715 debug = False ,
714- jobs = 0 ,
716+ jobs = None ,
715717 skip_dict_compile = False
716718):
717719 """Spell check."""
0 commit comments