This prevents a stack trace in Python 3 when the result is an empty file since the file is open in binary mode and a native string in Python 3 is str, not bytes. (cherry picked from commit 8b1ae30e2e)
8b1ae30e2e