New submission from Alexander Kapshuna <kapsh...@gmail.com>:
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. ---------- components: Library (Lib) files: cookiejar_straightforward_convert.patch keywords: patch messages: 335993 nosy: Alexander Kapshuna priority: normal severity: normal status: open title: FileCookieJar constructor don't accept PathLike type: enhancement versions: Python 3.6, Python 3.7, Python 3.8 Added file: https://bugs.python.org/file48156/cookiejar_straightforward_convert.patch _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue36043> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com