HPy Object

int HPy_IsTrue(HPyContext *ctx, HPy h)
[source]
HPy HPy_GetAttr(HPyContext *ctx, HPy obj, HPy name)
[source]
HPy HPy_GetAttr_s(HPyContext *ctx, HPy obj, const char *utf8_name)
[source]
int HPy_HasAttr(HPyContext *ctx, HPy obj, HPy name)
[source]
int HPy_HasAttr_s(HPyContext *ctx, HPy obj, const char *utf8_name)
[source]
int HPy_SetAttr(HPyContext *ctx, HPy obj, HPy name, HPy value)
[source]
int HPy_SetAttr_s(HPyContext *ctx, HPy obj, const char *utf8_name, HPy value)
[source]
HPy HPy_GetItem(HPyContext *ctx, HPy obj, HPy key)
[source]
HPy HPy_GetItem_s(HPyContext *ctx, HPy obj, const char *utf8_key)
[source]
HPy HPy_GetItem_i(HPyContext *ctx, HPy obj, HPy_ssize_t idx)
[source]
int HPy_SetItem(HPyContext *ctx, HPy obj, HPy key, HPy value)
[source]
int HPy_SetItem_s(HPyContext *ctx, HPy obj, const char *utf8_key, HPy value)
[source]
int HPy_SetItem_i(HPyContext *ctx, HPy obj, HPy_ssize_t idx, HPy value)
[source]
int HPy_DelItem(HPyContext *ctx, HPy obj, HPy key)
[source]
int HPy_DelItem_s(HPyContext *ctx, HPy obj, const char *utf8_key)
[source]
int HPy_DelItem_i(HPyContext *ctx, HPy obj, HPy_ssize_t idx)
[source]
HPy HPy_Type(HPyContext *ctx, HPy obj)
[source]

Returns the type of the given object obj.

On failure, raises SystemError and returns HPy_NULL. This is equivalent to the Python expression``type(obj)``.

Parameters
  • ctx – The execution context.

  • obj – a Python object (must not be HPy_NULL)

Returns

The type of obj or HPy_NULL in case of errors.

int HPy_TypeCheck(HPyContext *ctx, HPy obj, HPy type)
[source]

Checks if ob is an instance of type or any subtype of type.

Parameters
  • ctx – The execution context.

  • obj – a Python object (must not be HPy_NULL)

  • type – A Python type object. This argument must not be HPy_NULL and must be a type (i.e. it must inherit from Python type). If this is not the case, the behavior is undefined (verification of the argument is only done in debug mode).

Returns

Non-zero if object obj is an instance of type type or an instance of a subtype of type, and 0 otherwise.

int HPy_Is(HPyContext *ctx, HPy obj, HPy other)
[source]
HPy HPy_Repr(HPyContext *ctx, HPy obj)
[source]
HPy HPy_Str(HPyContext *ctx, HPy obj)
[source]
HPy HPy_ASCII(HPyContext *ctx, HPy obj)
[source]
HPy HPy_Bytes(HPyContext *ctx, HPy obj)
[source]
HPy HPy_RichCompare(HPyContext *ctx, HPy v, HPy w, int op)
[source]
int HPy_RichCompareBool(HPyContext *ctx, HPy v, HPy w, int op)
[source]
HPy_hash_t HPy_Hash(HPyContext *ctx, HPy obj)
[source]