picop.cycontextvars#

contextvars helpers.

picop.cycontextvars.context_eq(a, b)#

Return True if Context values match (identity + richcompare; same as Context.__eq__). :type a: object :param a: :type b: object :param b:

Return type:

bool

picop.cycontextvars.ctx_check_exact(obj)#

Return True if type(obj) is contextvars.Context. :type obj: object :param obj:

Return type:

bool

picop.cycontextvars.ctx_copy(ctx)#

Return a copy of ctx (PyContext_Copy). :type ctx: object :param ctx:

Return type:

object

picop.cycontextvars.ctx_copy_current()#

Return a copy of the current context (PyContext_CopyCurrent).

Return type:

object

picop.cycontextvars.ctx_enter(ctx)#

Enter context ctx (PyContext_Enter).

Notes

Returns 0 on success; errors raise — do not use the status as a bool.

Parameters:

ctx (object)

Return type:

int

picop.cycontextvars.ctx_exit(ctx)#

Exit context ctx (PyContext_Exit).

Notes

Returns 0 on success; errors raise — do not use the status as a bool.

Parameters:

ctx (object)

Return type:

int

picop.cycontextvars.ctx_new()#

Return a new empty Context (PyContext_New).

Return type:

object

picop.cycontextvars.ctxtoken_check_exact(obj)#

Return True if type(obj) is contextvars.Token. :type obj: object :param obj:

Return type:

bool

picop.cycontextvars.ctxvar_check_exact(obj)#

Return True if type(obj) is contextvars.ContextVar. :type obj: object :param obj:

Return type:

bool

picop.cycontextvars.ctxvar_new(name, default_value=None)#

Return a new ContextVar (PyContextVar_New).

Notes

name must be bytes, not str.

Parameters:
Return type:

object

picop.cycontextvars.ctxvar_reset(var, token)#

Reset var using token (PyContextVar_Reset).

Notes

Returns 0 on success; errors raise — do not use the status as a bool.

Parameters:
Return type:

int

picop.cycontextvars.ctxvar_set(var, value)#

Set var to value; return a reset token (PyContextVar_Set). :type var: object :param var: :type value: object :param value:

Return type:

object