Skip to content

Fix _encode_files detection for __getattr__-based file wrappers#7502

Merged
nateprewitt merged 1 commit into
psf:mainfrom
LoicPernod:loicp/fix-tempfile-requests
Jun 8, 2026
Merged

Fix _encode_files detection for __getattr__-based file wrappers#7502
nateprewitt merged 1 commit into
psf:mainfrom
LoicPernod:loicp/fix-tempfile-requests

Conversation

@LoicPernod

Copy link
Copy Markdown
Contributor

No description provided.

@LoicPernod

Copy link
Copy Markdown
Contributor Author

This is a follow up to #7433, that fixes support for NamedTemporaryFile following 561e4b6.

When checking out 2.33.1, the tests pass without the source change.
Without this PR, the test_post_named_tempfile test fails with:

TypeError: a bytes-like object is required, not '_TemporaryFileWrapper'

@nateprewitt nateprewitt left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this, @LoicPernod! I have a couple changes we should make but otherwise this seems reasonable. Also, please make sure you run pre-commit on the change before you push up the next round of changes.

Comment thread tests/test_requests.py Outdated
Comment thread tests/test_requests.py Outdated
@LoicPernod LoicPernod force-pushed the loicp/fix-tempfile-requests branch from e7de262 to be53ff1 Compare June 8, 2026 19:08
@LoicPernod LoicPernod requested a review from nateprewitt June 8, 2026 20:34

@nateprewitt nateprewitt left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks again, @LoicPernod!

@nateprewitt nateprewitt merged commit 6f205ff into psf:main Jun 8, 2026
57 of 58 checks passed
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.

2 participants