mirror of
https://github.com/affaan-m/ECC.git
synced 2026-10-26 18:35:05 +00:00
test: annotate the legacy locale I/O wrapper
This commit is contained in:
1 parent
b5fa7e7fcf
commit
c5704c128e
2 files changed
+6
-2
No files matched your search
@@ -10,7 +10,7 @@
|
||||
"id": "hand-seeded",
|
||||
"source": "manual-curation-pending-regeneration"
|
||||
},
|
||||
"registryDigest": "191d5ab399be507136bcb961c1c6ccc0502410ca93a70e30250516f08f717d6d",
|
||||
"registryDigest": "18c3ce00385a4c84d03f224208095d2efdc6f3b3486ed561c970080fcc2e88d4",
|
||||
"schemaVersion": 1,
|
||||
"triggers": {
|
||||
"skill:agent-runtime-gateway-smoke-test": [
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in new issue
Block a user