Issue 36043: FileCookieJar constructor don't accept PathLike (original) (raw)

Created on 2019-02-19 18:26 by kapsh, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
cookiejar_straightforward_convert.patch kapsh,2019-02-19 18:26 one minute patch
Pull Requests
URL Status Linked Edit
PR 11945 merged matrixise,2019-02-19 18:54
Messages (6)
msg335993 - (view) Author: Alexander Kapshuna (kapsh) Date: 2019-02-19 18:26
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.
msg335996 - (view) Author: Karthikeyan Singaravelan (xtreak) * (Python committer) Date: 2019-02-19 18:44
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.
msg335997 - (view) Author: Stéphane Wirtel (matrixise) * (Python committer) Date: 2019-02-19 18:52
@xtreak sorry, but I have already worked on this issue :/ can I publish my PR?
msg335998 - (view) Author: Stéphane Wirtel (matrixise) * (Python committer) Date: 2019-02-19 18:55
in fact, I have published my PR because I have already the tests and I have another approach for this issue.
msg336238 - (view) Author: Alexander Kapshuna (kapsh) Date: 2019-02-21 17:09
Oh sorry, I just thought that everybody has forgotten about this part of library. Nevermind my patch then, your work is certainly better, matrixise.
msg336955 - (view) Author: miss-islington (miss-islington) Date: 2019-03-01 20:40
New changeset 4b219ce81ed04234648a4ce4f0cb0865818abb38 by Miss Islington (bot) (Stéphane Wirtel) in branch 'master': bpo-36043: FileCookieJar supports os.PathLike (GH-11945) https://github.com/python/cpython/commit/4b219ce81ed04234648a4ce4f0cb0865818abb38
History
Date User Action Args
2022-04-11 14:59:11 admin set github: 80224
2019-03-01 20:41:46 brett.cannon set status: open -> closedresolution: fixedstage: resolved
2019-03-01 20:40:58 miss-islington set nosy: + miss-islingtonmessages: +
2019-02-21 17:09:12 kapsh set messages: +
2019-02-19 18:55:40 matrixise set messages: + stage: patch review -> (no value)
2019-02-19 18:54:44 matrixise set stage: patch reviewpull_requests: + <pull%5Frequest11969>
2019-02-19 18:52:28 matrixise set nosy: + matrixisemessages: + versions: + Python 3.6, Python 3.7
2019-02-19 18:44:58 xtreak set nosy: + xtreakmessages: + versions: - Python 3.6, Python 3.7
2019-02-19 18:26:02 kapsh create