Pin text I/O to UTF-8 and fail CI on locale-dependent reads/writes (#3296)
Co-authored-by: ShuQingDollarVoyager <57471784+ShuQingDollarVoyager@users.noreply.github.com> Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
52ad0a8876
commit
5285e936a9
2 changed files with 76 additions and 57 deletions
|
|
@ -44,7 +44,7 @@ class Configuration:
|
|||
FileNotFoundError: If configuration file doesn't exist.
|
||||
JSONDecodeError: If configuration file is invalid JSON.
|
||||
"""
|
||||
with open(file_path, "r") as f:
|
||||
with open(file_path, encoding="utf-8") as f:
|
||||
return json.load(f)
|
||||
|
||||
@property
|
||||
|
|
|
|||
|
|
@ -123,7 +123,7 @@ async def _self_hosted(name: str, cfg: dict[str, Any]) -> AsyncIterator[str]:
|
|||
|
||||
def _story_cfg(name: str) -> dict[str, Any]:
|
||||
"""The manifest entry for the story ``name`` with ``[defaults]`` applied."""
|
||||
manifest: dict[str, Any] = tomllib.loads((Path(__file__).parent / "manifest.toml").read_text())
|
||||
manifest: dict[str, Any] = tomllib.loads((Path(__file__).parent / "manifest.toml").read_text(encoding="utf-8"))
|
||||
return manifest["defaults"] | manifest["story"].get(name, {})
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue