Originally reported bysbehnel (Bitbucket: sbehnel, GitHub: Unknown)
CTracer_handle_return() currently tries to read the byte code of the return statement as follows:
int bytecode = MyBytes_AS_STRING(frame->f_code->co_code)[frame->f_lasti];
It would be better to not rely blindly on its existence, even though the current code should not crash with Cython where f_lasti should currently be 0 and co_code points to the empty string, so the read will return 0 (the C string terminator) as byte code instruction. That means that it only accidentally works due to the "!=" test.
Original comment bysbehnel (Bitbucket: sbehnel, GitHub: Unknown)
co_code is empty in Cython because it doesn't have bytecode, only native
code. It uses CodeObjects to provide introspection information for its
native functions. The way it emulates (or fakes) the Python function
interface may evolve over time, but I doubt that it will ever try to mimic
the byte code interface.