Skip to content

Commit ec0d490

Browse files
author
Codex
committed
Fix Windows release check encoding in CI
1 parent dddad46 commit ec0d490

2 files changed

Lines changed: 17 additions & 0 deletions

File tree

.github/workflows/release-check.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ on:
88
jobs:
99
source-check:
1010
runs-on: windows-latest
11+
env:
12+
PYTHONUTF8: "1"
13+
PYTHONIOENCODING: "utf-8"
1114
steps:
1215
- name: Check out repository
1316
uses: actions/checkout@v4

tools/release_check.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,20 @@
1212
import sys
1313
from pathlib import Path
1414

15+
16+
def _configure_utf8_stdio() -> None:
17+
for stream_name in ("stdout", "stderr"):
18+
stream = getattr(sys, stream_name, None)
19+
if stream is None or not hasattr(stream, "reconfigure"):
20+
continue
21+
try:
22+
stream.reconfigure(encoding="utf-8", errors="replace")
23+
except Exception:
24+
pass
25+
26+
27+
_configure_utf8_stdio()
28+
1529
ROOT = Path(__file__).resolve().parents[1]
1630
if str(ROOT) not in sys.path:
1731
sys.path.insert(0, str(ROOT))

0 commit comments

Comments
 (0)