file.name can be an integer for unnamed files in python3, it doesn't make much sense to use one here but it could happen in tests