Slide 14
Slide 14 text
Universal ABI
// hpy/universal.h
/* a word-sized opaque field: can be an index, a pointer, whatever */
typedef struct { HPy_ssize_t _i; } HPy;
struct _HPyContext_s {
int ctx_version;
...
HPy (*ctx_Dup)(HPyContext ctx, HPy h);
HPy (*ctx_Long_FromLong)(HPyContext ctx, long value);
...
};
typedef struct _HPyContext_s *HPyContext;
static inline HPy HPy_Dup(HPyContext ctx, HPy h) {
return ctx->ctx_Dup ( ctx, h );
}
static inline HPy HPyLong_FromLong(HPyContext ctx, long value) {
return ctx->ctx_Long_FromLong ( ctx, value );
}
antocuni (Python Language Summit 2020) HPy 13 / 16