Skip to content

Honor caller-owned outfile in get_file - #2066

Open
Sanjays2402 wants to merge 1 commit into
fsspec:masterfrom
Sanjays2402:fix/get-file-outfile
Open

Honor caller-owned outfile in get_file#2066
Sanjays2402 wants to merge 1 commit into
fsspec:masterfrom
Sanjays2402:fix/get-file-outfile

Conversation

@Sanjays2402

Copy link
Copy Markdown
Contributor

get_file(..., outfile=stream) currently still requires and prepares lpath, then closes the caller-owned stream; when both are file-like, lpath also silently replaces the explicit outfile. This lets outfile stand in for lpath, gives the explicit argument precedence, and only closes streams opened by fsspec. Fixes #1841.

Allow outfile to replace lpath, preserve an explicitly supplied outfile when lpath is file-like, and only close streams opened internally.

Add regression coverage for both outfile-only and precedence behavior.

Fixes fsspec#1841
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.

Outfile is overridden by lpath unless lpath is not file-like, and it is always closed

1 participant