Jun-24-2020, 05:55 AM
If the name is not a bytearray, you could convert it with
os.fspath()
to accept pathlike objects. This also saves a type check for bytes or str because you know that the value returned by os.fspath is one of them.