Skip to content

fix: copy mutable file tuple containers#1548

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

fix: copy mutable file tuple containers#1548
nightcityblade wants to merge 1 commit into
anthropics:mainfrom
nightcityblade:fix/issue-1202

Conversation

@nightcityblade
Copy link
Copy Markdown

Summary

Prevent file upload helpers from sharing mutable containers nested inside file tuples, such as per-file headers dictionaries.

Changes

  • Copy tuple entries that are on extracted file paths while preserving immutable file content references.
  • Add regression coverage for a file tuple with mutable headers.

Testing

  • uv run pyright src/anthropic/_files.py tests/test_files.py
  • uv run ruff check src/anthropic/_files.py tests/test_files.py
  • uv run pytest tests/test_files.py -q

Fixes #1202

@nightcityblade nightcityblade requested a review from a team as a code owner May 15, 2026 03:29
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.

Use of deepcopy_minimal in files.beta.upload mutates dict in place

1 participant