HPy’s public API consists of three parts:
The Core API as defined in the Public API Header
HPy Helper functions
Inline Helper functions
The Core API consists of inline functions that call into the Python interpreter. Those functions will be implemented by each Python interpreter. In CPython ABI mode, many of these inline functions will just delegate to a C API functions. In HPy Universal ABI mode, they will call a function pointer from the HPy context. This is the source of the performance change between the modes.
HPy Helper Functions¶
HPy Helper functions are functions (written in C) that will be compiled together with the HPy extension’s sources. The appropriate source files are automatically added to the extension sources. The helper functions will, of course, use the core API to interact with the interpreter. The main reason for having the helper functions in the HPy extension is to avoid compatibility problems due to different compilers.
Inline Helper Functions¶
Inline Helper functions are
static inline functions (written in C).
Those functions are usually small convenience functions that everyone could
write but in order to avoid duplicated effort, they are defined by HPy.