classification
Title: Support the buffer protocol in json.loads()
Type: enhancement Stage: patch review
Components: Library (Lib) Versions: Python 3.7
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: bob.ippolito Nosy List: bob.ippolito, ezio.melotti, fafhrd91, rhettinger, serhiy.storchaka
Priority: normal Keywords: patch

Created on 2017-04-27 22:55 by fafhrd91, last changed 2019-07-27 09:55 by flavianhautbois.

Pull Requests
URL Status Linked Edit
PR 1334 open fafhrd91, 2017-04-27 22:57
PR 14977 open flavianhautbois, 2019-07-27 09:55
Messages (5)
msg292487 - (view) Author: Nikolay Kim (fafhrd91) * Date: 2017-04-27 22:55
It is not possible to use buffer objects in json.loads()
msg292508 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2017-04-28 04:53
This isn't so easy. Supporting the buffer protocol can slowdown the common case -- str.

Do you have concrete use case for this feature or add it just as an extension of bytes and bytearray support?
msg292509 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2017-04-28 04:55
Withdraw my note about slowing down str.
msg293250 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2017-05-08 20:12
The proposed patch doesn't work with all objects supporting the buffer protocol, for example it doesn't work with array.array('u', '\ufeff[1,2,3]'). This is easy to fix. But I'm not sure that it is worth to complicate the code for adding support of the buffer protocol.
msg293251 - (view) Author: Nikolay Kim (fafhrd91) * Date: 2017-05-08 20:23
I am fine with any decision. close with "won't fix" is fine too
History
Date User Action Args
2019-07-27 09:55:07flavianhautboissetkeywords: + patch
pull_requests: + pull_request14746
2017-05-08 20:23:10fafhrd91setmessages: + msg293251
2017-05-08 20:22:27rhettingersetassignee: bob.ippolito
2017-05-08 20:12:41serhiy.storchakasetmessages: + msg293250
2017-04-28 04:55:51serhiy.storchakasetmessages: + msg292509
2017-04-28 04:53:24serhiy.storchakasettype: enhancement
title: Accept memoryview in json.loads() -> Support the buffer protocol in json.loads()
components: + Library (Lib)

nosy: + rhettinger, bob.ippolito, ezio.melotti
versions: - Python 3.6
messages: + msg292508
stage: patch review
2017-04-28 00:11:03vstinnersetnosy: + serhiy.storchaka
2017-04-28 00:10:51vstinnersettitle: Allow to load buffer objects with json.loads() -> Accept memoryview in json.loads()
2017-04-27 22:57:40fafhrd91setpull_requests: + pull_request1443
2017-04-27 22:55:44fafhrd91create