Closed JamesTheAwesomeDude closed 4 months ago
Not gonna be so easy.
What I tried:
PyObject* f(PyObject* m, PyObject* sk);
apparently cannot be exposed by CFFI.PyObject* f(uint8_t* m, size_t mlen, uint8_t* sk)
apparently does not allow actually "exfiltrating" the created object. Even ffi.from_handle(f(…))
raises TypeError: expected a 'cdata' object with a 'void *' out of new_handle(), got 'PyObject *'
I think if we want to construct the PyBytes
object manually to avoid the extra copy, we'll have to ditch CFFI and just do things raw.
As much as I'd like to ditch CFFI due to its throwing a wrench in #1, that would be a lot of work I'm not up for.
I'm closing this as "I won't fix it right now", but I would be glad to re-open this if anyone wants to help.
Should get rid of the non-lazy """casts""" from FFI-Owned Memory to Python Bytes Objects
Obviously this is a nearly irrelevant performance improvement, premature optimization yadda yadda, but it's still something that's clearly the wrong thing to do, so we should do the right thing at some point.