Skip to content

Commit 2c4699a

Browse files
Merge pull request #251 from neutrinoceros/bug/single_cpu_support
BUG: fix a crash in inifix-format on single-core machines
2 parents fb7ae1d + 1175490 commit 2c4699a

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
## [5.0.1] - 2024-08-12
8+
9+
BUG: fix a crash in inifix-format on single-core machines
10+
711
## [5.0.0] - 2024-08-09
812

913
### API changes

src/inifix/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@
55
from .validation import validate_inifile_schema
66
from .format import format_string
77

8-
__version__ = "5.0.0"
8+
__version__ = "5.0.1"

src/inifix/format.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,8 @@ def main(argv: list[str] | None = None) -> int:
168168
args_report_noop=args.report_noop,
169169
args_diff=args.diff,
170170
)
171-
with ThreadPoolExecutor(max_workers=int((os.cpu_count() or 2) / 2)) as executor:
171+
cpu_count = os.cpu_count() or 1
172+
with ThreadPoolExecutor(max_workers=max(1, int(cpu_count / 2))) as executor:
172173
futures = [executor.submit(closure, file) for file in args.files]
173174
results = [f.result() for f in futures]
174175

0 commit comments

Comments
 (0)