Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: set a max jobs on win32 to avoid too many handles #1964

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/flake8/checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import multiprocessing.pool
import operator
import signal
import sys
import tokenize
from typing import Any
from typing import Generator
Expand Down Expand Up @@ -151,7 +152,14 @@ def _job_count(self) -> int:
# default to 1
if jobs.is_auto:
try:
return multiprocessing.cpu_count()
system_cpus = multiprocessing.cpu_count()

# Work around https://bugs.python.org/issue26903
return (
min(system_cpus, 61)
if sys.platform == "win32"
else system_cpus
)
except NotImplementedError:
return 0

Expand Down