report bad file-like objects, don't treat them as files

Closed Bitbucket Importer requested to merge bitbucket/declined-pr-52 into branch/2.2