Skip to content

Commit

Permalink
Merge pull request #251 from neutrinoceros/bug/single_cpu_support
Browse files Browse the repository at this point in the history
BUG: fix a crash in inifix-format on single-core machines
  • Loading branch information
neutrinoceros authored Aug 12, 2024
2 parents fb7ae1d + 1175490 commit 2c4699a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [5.0.1] - 2024-08-12

BUG: fix a crash in inifix-format on single-core machines

## [5.0.0] - 2024-08-09

### API changes
Expand Down
2 changes: 1 addition & 1 deletion src/inifix/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
from .validation import validate_inifile_schema
from .format import format_string

__version__ = "5.0.0"
__version__ = "5.0.1"
3 changes: 2 additions & 1 deletion src/inifix/format.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,8 @@ def main(argv: list[str] | None = None) -> int:
args_report_noop=args.report_noop,
args_diff=args.diff,
)
with ThreadPoolExecutor(max_workers=int((os.cpu_count() or 2) / 2)) as executor:
cpu_count = os.cpu_count() or 1
with ThreadPoolExecutor(max_workers=max(1, int(cpu_count / 2))) as executor:
futures = [executor.submit(closure, file) for file in args.files]
results = [f.result() for f in futures]

Expand Down

0 comments on commit 2c4699a

Please sign in to comment.