FileCookieJar and it's subclasses don't accept Paths and DirEntrys. Minimal code to reproduce: === import pathlib from http.cookiejar import FileCookieJar saved_cookies = pathlib.Path('my_cookies.txt') jar = FileCookieJar(saved_cookies) === Results in: "ValueError: filename must be string-like". Workaround is to convert Path explicitly or call load() which doesn't check for type, but it would be nice to see all APIs in standard library consistent. I also did quick and dirty patch which silently converts filename argument using os.fspath(). This way it won't break any existing code relying on FileCookieJar.filename being string.
This seems like a good change to me. GitHub PRs are accepted please see https://devguide.python.org/ . Since this is an enhancement it can only go as part of Python 3.8 if accepted.