| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
If the underlying I/O class keeps a reference to the memory raise BufferError.
| } | ||
| return res; | ||
| } | ||
| res = PyObject_CallMethod(b, "take_bytes", NULL); |
There was a problem hiding this comment.
@vstinner : Not sure how common this "resize/discard then take_bytes" is going to be; might make sense to change to take_bytes(n=None, /, *, discard=False)
Sorry, something went wrong.
There was a problem hiding this comment.
for now planning to keep that in back pocket until need many ways (ba.resize(n) or del ba[:n] gives the same capability)
Sorry, something went wrong.
There was a problem hiding this comment.
Can you also update RawIOBase.read() in the _pyio module?
Sorry, something went wrong.
|
Have that in #141539 which does all the cases .take_bytes can be used in _pyio :). |
Sorry, something went wrong.
Co-authored-by: Victor Stinner <vstinner@python.org>
There was a problem hiding this comment.
LGTM
Sorry, something went wrong.
If the underlying I/O class keeps a reference to the memory, raise BufferError. Co-authored-by: Victor Stinner <vstinner@python.org>
If the underlying I/O class keeps a reference to the memory, raise BufferError. Co-authored-by: Victor Stinner <vstinner@python.org>
| Back | FazBrowse Home | New Git URL |
If the underlying I/O class keeps a reference to the memory raise BufferError.
Uses gh-139871 to implement.
--
If want to maintain closer compatibility when a BufferError occurs can fall back to a copy (copying is as safe as the original code). I have a slight preference to erroring as I think keeping a reference to the memory is uncommon (and probably unintended).