Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .agents/skills/python-codestyle/references/code-style.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,16 @@
- **Don't use exceptions for expected control flow.** Exceptions are for unexpected states.
- **Don't suppress errors silently** (`except Exception: pass`). Either handle the specific
exception and document why it's safe, or let it propagate.
- **Don't leave a text-mode `subprocess` call to the locale's encoding.** Every call that reads
or writes a pipe as text (`text=True`, `universal_newlines=True`, or an `errors` argument) names
the encoding its child uses on that pipe. Below Python 3.15, a call that names none encodes and
decodes with the locale encoding unless UTF-8 Mode is on. That encoding follows the host's
locale, usually UTF-8 on Linux and the ANSI code page on Windows. The omission therefore looks
correct on a UTF-8 host. On any other, a Windows host being the common case, it misreads or
rejects non-ASCII output from a child writing UTF-8. No static check in the ruff, pyright, or
mypy toolchain looks for the omission in a subprocess call. Naming the encoding settles how the
bytes are translated, not what a byte or character outside that encoding is worth. Each call
decides that with its own `errors` argument, and the strict default decides it by raising.

<!-- External -->

Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
78b687fa4e03cda7
a54a634cf8810359
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,16 @@
- **Don't use exceptions for expected control flow.** Exceptions are for unexpected states.
- **Don't suppress errors silently** (`except Exception: pass`). Either handle the specific
exception and document why it's safe, or let it propagate.
- **Don't leave a text-mode `subprocess` call to the locale's encoding.** Every call that reads
or writes a pipe as text (`text=True`, `universal_newlines=True`, or an `errors` argument) names
the encoding its child uses on that pipe. Below Python 3.15, a call that names none encodes and
decodes with the locale encoding unless UTF-8 Mode is on. That encoding follows the host's
locale, usually UTF-8 on Linux and the ANSI code page on Windows. The omission therefore looks
correct on a UTF-8 host. On any other, a Windows host being the common case, it misreads or
rejects non-ASCII output from a child writing UTF-8. No static check in the ruff, pyright, or
mypy toolchain looks for the omission in a subprocess call. Naming the encoding settles how the
bytes are translated, not what a byte or character outside that encoding is worth. Each call
decides that with its own `errors` argument, and the strict default decides it by raising.

<!-- External -->

Expand Down
10 changes: 10 additions & 0 deletions .github/skills/python-codestyle/references/code-style.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,16 @@
- **Don't use exceptions for expected control flow.** Exceptions are for unexpected states.
- **Don't suppress errors silently** (`except Exception: pass`). Either handle the specific
exception and document why it's safe, or let it propagate.
- **Don't leave a text-mode `subprocess` call to the locale's encoding.** Every call that reads
or writes a pipe as text (`text=True`, `universal_newlines=True`, or an `errors` argument) names
the encoding its child uses on that pipe. Below Python 3.15, a call that names none encodes and
decodes with the locale encoding unless UTF-8 Mode is on. That encoding follows the host's
locale, usually UTF-8 on Linux and the ANSI code page on Windows. The omission therefore looks
correct on a UTF-8 host. On any other, a Windows host being the common case, it misreads or
rejects non-ASCII output from a child writing UTF-8. No static check in the ruff, pyright, or
mypy toolchain looks for the omission in a subprocess call. Naming the encoding settles how the
bytes are translated, not what a byte or character outside that encoding is worth. Each call
decides that with its own `errors` argument, and the strict default decides it by raising.

<!-- External -->

Expand Down
Loading