Hi,
On Sat, 6 Aug 2022 at 13:16, AJ R <
sjeik...@gmail.com> wrote:
> yield ffi_string(buffer)[:ret]
We can't do anything more than guess from just a small function in
your code base. But I would guess that the line above unnecessarily
makes a (bytes or unicode) string, and then truncates it. I have no
idea about what you are really looking for, but the above line could
possibly be replaced with: "yield ffi_string(buffer, ret)". Or, if
you know that "ret" is exactly the length, you could do "yield
ffi.buffer(buffer, ret)[:]", which doesn't even scan the buffer for
zeroes.
A bientôt,
Armin Rigo