Skip to content

fix: support PathLike content in file tuples - #1771

Open
nightcityblade wants to merge 1 commit into
anthropics:mainfrom
nightcityblade:fix/issue-1769
Open

fix: support PathLike content in file tuples#1771
nightcityblade wants to merge 1 commit into
anthropics:mainfrom
nightcityblade:fix/issue-1769

Conversation

@nightcityblade

Copy link
Copy Markdown

Fixes #1769

Summary

  • convert PathLike file content inside tuple-form uploads before passing files to httpx
  • preserve the caller-provided tuple filename and any optional content type or headers
  • add synchronous and asynchronous regression coverage

Testing

  • uv run pytest tests/test_files.py -n0 (16 passed)
  • uv run ruff check src/anthropic/_files.py tests/test_files.py
  • uv run ruff format --check src/anthropic/_files.py tests/test_files.py
  • uv run pyright (0 errors)
  • uv run mypy . (success across 1084 source files)
  • uv run python -c 'import anthropic'

@nightcityblade
nightcityblade requested a review from a team as a code owner July 22, 2026 15:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AttributeError: 'WindowsPath' object has no attribute 'read'

1 participant