No, it does not embed the code. It relies on being able to find the .pyx
file - if you move that file then you will get a traceback but without the original code.
If you inspect the generated C source you'll find that the error handling routine goes through __Pyx_AddTraceback
, then __Pyx_CreateCodeObjectForTraceback
, which creates a PyCodeObject linked to your .pyx
source file.
Under some circumstances (I'm not sure what though) it links to your .c
file instead. The same rules will apply though - if it can't find the source it won't show that line.
Even without the .pyx file you will still get a traceback with useful method names - these are preserved in the compiled executable.