Someone overlooked testing that method; the correct incantation is:
if not isinstance(filename, str):
# ...
because the rest of the code proceeds to turn it into a str
, for both Python 2 and Python 3.
I've issued a pull request, after talking with the maintainer on IRC.
Update: the patch has now been merged.