Skip to content

fix: close file descriptors in Requests-style file tuples#414

Open
darshanm17 wants to merge 1 commit intoMarketSquare:masterfrom
darshanm17:bugfix/close-file-tuples
Open

fix: close file descriptors in Requests-style file tuples#414
darshanm17 wants to merge 1 commit intoMarketSquare:masterfrom
darshanm17:bugfix/close-file-tuples

Conversation

@darshanm17
Copy link

When users pass files using the Requests API format {'key': ('filename', fileobj, ...)}, the inner fileobj was not being closed by _close_file_descriptors.
This could lead to resource leaks in uploads.

  • Extend _close_file_descriptors to detect and close file objects inside file-tuple values.
  • Add unit test to verify the behavior.

When users pass files using the Requests API format
{'key': ('filename', fileobj, ...)}, the inner fileobj
was not being closed by _close_file_descriptors.
This could lead to resource leaks in uploads.

- Extend _close_file_descriptors to detect and close
  file objects inside file-tuple values.
- Add unit test to verify the behavior.
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.

1 participant