Issue36378
Created on 2019-03-20 08:44 by DaniFojo, last changed 2022-04-11 14:59 by admin. This issue is now closed.
| Pull Requests | |||
|---|---|---|---|
| URL | Status | Linked | Edit |
| PR 12465 | closed | python-dev, 2019-03-20 08:49 | |
| Messages (3) | |||
|---|---|---|---|
| msg338442 - (view) | Author: Dani Fojo (DaniFojo) * | Date: 2019-03-20 08:44 | |
Add support to json.load to read from a string or Path object containing the path to a json file. Many libraries (like Numpy) support this behavior. |
|||
| msg338448 - (view) | Author: Karthikeyan Singaravelan (xtreak) * ![]() |
Date: 2019-03-20 10:02 | |
This expands the API where json.load now only accepts open file objects to support str and pathlike objects. This was discussed in https://mail.python.org/pipermail/python-ideas/2017-March/045303.html where there were alternatives proposed as below : with path.open() as f: obj = json.load(f) some_path.write_text(json.dumps(obj), encoding='utf8') json.loads(some_path.read_text(encoding='utf8')) Also supporting str and pathlib passes responsibility to json.load to open them and also close them properly? I think this needs a python-ideas discussion if the proposal has something to add other than the previous thread where many alternatives were mentioned for terse code. |
|||
| msg339974 - (view) | Author: Inada Naoki (methane) * ![]() |
Date: 2019-04-11 13:45 | |
I close this because PR is closed already, and same idea was discussed on -ideas ML. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:59:12 | admin | set | github: 80559 |
| 2019-07-18 06:18:56 | serhiy.storchaka | link | issue37615 superseder |
| 2019-04-11 13:45:33 | methane | set | status: open -> closed nosy:
+ methane resolution: rejected |
| 2019-03-20 10:02:10 | xtreak | set | messages: + msg338448 |
| 2019-03-20 09:07:28 | xtreak | set | nosy:
+ xtreak |
| 2019-03-20 08:49:21 | python-dev | set | keywords:
+ patch stage: patch review pull_requests: + pull_request12417 |
| 2019-03-20 08:47:20 | SilentGhost | set | nosy:
+ rhettinger, ezio.melotti |
| 2019-03-20 08:44:18 | DaniFojo | create | |
