BUG: do not stringify file-like objects
- [x] closes #38125
- [x] tests added / passed
- [x] passes `black pandas`
- [x] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [x] whatsnew entry

I will finish this PR (fix the mypy issues) after #38018 is merged.
