Feature or enhancement
Proposal:
There's new PyBytesWriter() API:
There's an ongoing effort of introducing it in various places:
With its PyList_Append
|
r = PyList_Append(chunks, data); |
and PyBytes_Join:
https://github.com/python/cpython/blob/2ca3c85054b231505c5e6f5f3209eb5f63942dce/Modules/_io/iobase.c#L1010C14-L1010C26
the io.RawIOBase.readall looks like the ideal candidate for PyBytesWriter.
Notably, io.RawIOBase is used internally across many modules:
https://github.com/search?q=repo%3Apython%2Fcpython+io.RawIOBase+path%3A%2F%5ELib%5C%2F%2F&type=code
and some even call readall explicitly sometimes:
Has this already been discussed elsewhere?
No response given
Links to previous discussion of this feature:
No response
Linked PRs
Feature or enhancement
Proposal:
There's new
PyBytesWriter()API:There's an ongoing effort of introducing it in various places:
With its
PyList_Appendcpython/Modules/_io/iobase.c
Line 1003 in 2ca3c85
and
PyBytes_Join:https://github.com/python/cpython/blob/2ca3c85054b231505c5e6f5f3209eb5f63942dce/Modules/_io/iobase.c#L1010C14-L1010C26
the
io.RawIOBase.readalllooks like the ideal candidate forPyBytesWriter.Notably,
io.RawIOBaseis used internally across many modules:https://github.com/search?q=repo%3Apython%2Fcpython+io.RawIOBase+path%3A%2F%5ELib%5C%2F%2F&type=code
and some even call
readallexplicitly sometimes:cpython/Lib/gzip.py
Line 545 in 2ca3c85
Has this already been discussed elsewhere?
No response given
Links to previous discussion of this feature:
No response
Linked PRs
PyBytesWriterinio.RawIOBase.readall; 3.98x faster #140139