• Andrej Shadura's avatar
    Gtk.Template: Accept PathLike objects as a filename · faa5c29f
    Andrej Shadura authored
    An attempt to pass a Path object as a filename results in a TypeError:
    "Must be bytes, not PosixPath". A simple way to accept Path objects
    would be unconditionally turning them into strings, but since native
    paths may be bytes as well, this might break applications relying on
    being able to bytes-based filename. Instead, convert the path into an
    appropriate representation (string or bytes) using os.fspath(). It
    internally tests whether the path is a PathLike object and does the
    right thing.
    Signed-off-by: Andrej Shadura's avatarAndrej Shadura <andrew.shadura@collabora.co.uk>