Skip to content

tests/test_git_output_decoding.py: TextModeCalls sees only subprocess.<spawner>(..., text=True), so from subprocess import run, import subprocess as sp, a **kwargs call, a call naming only encoding= or errors=, and subprocess.getoutput each decode with the locale codec without failing the guard #217 added #321

Closed

Description

@brettheap

Lane: openreposhape-3 (openRepoShape-3)

What happens. The guard test_no_shipped_text_mode_call_decodes_with_the_locale_codec walks every shipped file with TextModeCalls. Its visit_Call accepts only a call whose function is Attribute(Name("subprocess"), <one of SPAWNERS>) and whose keywords include text or universal_newlines. Run on main be2790e, the class applied to seven one-line programs:

subprocess.run(['git'], text=True)            -> SEEN   (control)
from subprocess import run; run(.., text=True) -> missed
import subprocess as sp; sp.run(.., text=True) -> missed
subprocess.run(['git'], **opts)               -> missed
subprocess.run(['git'], errors='replace')     -> missed
subprocess.run(['git'], encoding='cp1252')    -> missed
subprocess.getoutput('git status')            -> missed

A call naming only errors= or encoding= is text mode with the locale codec for the other half, and **opts can carry either. An AST scan of the shipped files for those forms (from-imports of subprocess, module aliases, ** in a spawner call, getoutput/getstatusoutput, encoding/errors without text) finds none today (total 0), so nothing is wrong yet.

Where. tests/test_git_output_decoding.py: SPAWNERS, TextModeCalls.visit_Call.

Why it matters. The guard exists so that "a thirty-first cannot arrive" (#217): a text-mode call decoding with the locale codec raises UnicodeDecodeError in place of REFUSED under a C locale or a Windows code page, after both legs exist. Any of the five spellings gets past it silently. Direction (from #230): treat encoding=/errors= as asking for text, refuse ** in a spawner call, resolve aliases and from-imports, add getoutput and getstatusoutput.

Source. PR #230, ## Left out, third bullet; coordinator's running list item 5.

Activity

  1. brettheap commented on Oct 12, 2026

    @brettheap
    ContributorAuthor

    CLAIMED — lane openRepoShape-3, session b2cc9e59-4dc8-4f43-b01b-81cb99c8b07e@Eagle, 2026-10-12T10:58:38Z, for #321

    Logged in lanes/log/openRepoShape-3.md at 5e25af4db67f434b53620ec76da7a42d0fc6d8f5.

    The three reads (lane-collision-protocol Rule 1):

    1. existing `CLAIMED —` comments on opensoft/openRepoShape#321:
       none
    2. `gh pr list --repo opensoft/openRepoShape --state all --search "#321"`, kept where the row or its body names `#321`:
       none
    3. `git ls-remote --heads git@github.com:opensoft/openRepoShape` branches naming `321` as a whole token:
       none
    
  2. added 4 commits that reference this issue on Oct 12, 2026
  3. added 3 commits that reference this issue on Oct 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions