[PR #367] pr_conflict_label: guard stdout against the console code page (TEST-WIN-SWEEP) #419

Open
opened 2026-11-26 20:17:49 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/367
Author: @ItsMrDubey
Created: 11/24/2026
Status: 🔄 Open

Base: main ← Head: win-stdout-pr-conflict-label


📝 Commits (1)

  • 9683501 pr_conflict_label: stdout writes '?' for what the console code page cannot encode, as every other tool does

📊 Changes

1 file changed (+4 additions, -0 deletions)

View changed files

📝 tools/pr_conflict_label.py (+4 -0)

📄 Description

Claimed in the coordination issue as: TEST-WIN-SWEEP (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7121328982)

What and why

python -I tests/test_tool_stdout_encoding.py fails on main: test_every_main_block_reconfigures_stdout lists tools/pr_conflict_label.py, added in 4f7a347 (PR-CONFLICT-LABEL) without the sys.stdout.reconfigure(errors="replace") guard every other program's __main__ block has. Under -I a redirected stdout on Windows is strict cp1252, so a character outside the code page would end the run with UnicodeEncodeError. The check itself is not Windows-specific, so the test fails on every OS; the sweep found it on Windows.

The __main__ block now sets the same guard, in the same words, as scripts/ci_expected_failures.py and the tools.

Tested

Windows 11, Python 3.11.9 and 3.12.9:

  • python -I tests/test_tool_stdout_encoding.py: before FAIL ... ['tools/pr_conflict_label.py'] != [] (exit 1); after OK.
  • python -I tests/test_pr_conflict_label.py: OK.
  • python -I scripts/check_no_game_data.py tools/pr_conflict_label.py: clean.
  • Linux (the conflict-label workflow runs python3 -I tools/pr_conflict_label.py): reconfigure is a no-op there for a UTF-8 stdout and the guard swallows the errors it could raise.

AI-assisted: yes

Checklist

  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. n/a: no translator rule

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/367 **Author:** [@ItsMrDubey](https://github.com/ItsMrDubey) **Created:** 11/24/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `win-stdout-pr-conflict-label` --- ### 📝 Commits (1) - [`9683501`](https://github.com/ubiquitarianism/leonida/commit/9683501d0f09e987ae5a78ee9a8450e5987d60be) pr_conflict_label: stdout writes '?' for what the console code page cannot encode, as every other tool does ### 📊 Changes **1 file changed** (+4 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `tools/pr_conflict_label.py` (+4 -0) </details> ### 📄 Description Claimed in the coordination issue as: TEST-WIN-SWEEP (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7121328982) ### What and why `python -I tests/test_tool_stdout_encoding.py` fails on main: `test_every_main_block_reconfigures_stdout` lists `tools/pr_conflict_label.py`, added in 4f7a347 (PR-CONFLICT-LABEL) without the `sys.stdout.reconfigure(errors="replace")` guard every other program's `__main__` block has. Under `-I` a redirected stdout on Windows is strict cp1252, so a character outside the code page would end the run with `UnicodeEncodeError`. The check itself is not Windows-specific, so the test fails on every OS; the sweep found it on Windows. The `__main__` block now sets the same guard, in the same words, as `scripts/ci_expected_failures.py` and the tools. ### Tested Windows 11, Python 3.11.9 and 3.12.9: - `python -I tests/test_tool_stdout_encoding.py`: before `FAIL ... ['tools/pr_conflict_label.py'] != []` (exit 1); after OK. - `python -I tests/test_pr_conflict_label.py`: OK. - `python -I scripts/check_no_game_data.py tools/pr_conflict_label.py`: clean. - Linux (the conflict-label workflow runs `python3 -I tools/pr_conflict_label.py`): `reconfigure` is a no-op there for a UTF-8 stdout and the guard swallows the errors it could raise. AI-assisted: yes ### Checklist - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [ ] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. n/a: no translator rule --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
starred/leonida#419
No description provided.