From e9176a14e355ab7796a62e6f269b794bf468fea1 Mon Sep 17 00:00:00 2001 From: Eneko Ruiz <196690101+eneekoruiz@users.noreply.github.com> Date: Sun, 18 Oct 2026 13:21:59 +0200 Subject: [PATCH] test: annotate the legacy locale I/O wrapper (cherry picked from commit c5704c128ea25f7c128bbc7f3d22e63db8cbade0) --- skills/skill-comply/tests/test_utf8.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/skills/skill-comply/tests/test_utf8.py b/skills/skill-comply/tests/test_utf8.py index af9c3064f..23142ab45 100644 --- a/skills/skill-comply/tests/test_utf8.py +++ b/skills/skill-comply/tests/test_utf8.py @@ -142,12 +142,16 @@ def test_utf8_boundaries_under_legacy_encoding() -> None: import locale import os import sys + from typing import IO, Any assert sys.flags.utf8_mode == 0 if os.name == "nt": # Windows ignores LC_ALL for text I/O; emulate its legacy default. original_open = io.open - def legacy_open(file, mode="r", buffering=-1, encoding=None, *args, **kwargs): + def legacy_open( + file: Any, mode: str = "r", buffering: int = -1, + encoding: str | None = None, *args: Any, **kwargs: Any, + ) -> IO[Any]: if "b" not in mode and encoding in (None, "locale"): encoding = "cp1252" return original_open(file, mode, buffering, encoding, *args, **kwargs)