Skip to content

fix(sandbox): make typecheck pass on Windows - #4482

Closed
rome-xi wants to merge 1 commit into
openai:mainfrom
rome-xi:contrib/openai-agents-python-4477
Closed

fix(sandbox): make typecheck pass on Windows#4482
rome-xi wants to merge 1 commit into
openai:mainfrom
rome-xi:contrib/openai-agents-python-4477

Conversation

@rome-xi

@rome-xi rome-xi commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Summary

make typecheck reports three mypy errors on Windows and none on Linux. On win32, typeshed types tempfile.TemporaryFile() as _TemporaryFileWrapper[bytes], which is not an IOBase subclass, so strip_tar_member_prefix and Docker hydrate fail. Windows mypy also treats process as unbound after the PTY try/except/else in unix_local.

Cast the TemporaryFile objects to io.IOBase at those two sites, and create the PTY session entry inside the else branch where process is defined. No public types are widened.

Test plan

  • uv run mypy --platform win32 --follow-imports=silent on the three affected modules
  • the same command with --platform linux stays clean
  • tests/sandbox/test_windows_tempfile_iobase.py covers the seekable-stream contract

Issue number

Fixes #4477

Signed-off-by: rome-xi <rome-xi@users.noreply.github.com>
@seratch

seratch commented Aug 17, 2026

Copy link
Copy Markdown
Member

Thanks for sending this. #4499 resolves the issue and its commit includes you as a co-author.

@seratch seratch closed this Aug 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

make typecheck reports three errors on Windows and none on Linux

2 participants