1cdef set appctx_registry = set() 2 3cdef inline object registerAppCtx(void *appctx): 4 cdef object key = <Py_uintptr_t> appctx 5 appctx_registry.add(key) 6 7cdef inline object toAppCtx(void *appctx): 8 cdef object key = <Py_uintptr_t> appctx 9 if key in appctx_registry: 10 return <object> appctx 11 else: 12 if appctx != NULL: 13 return PyLong_FromVoidPtr(appctx) 14 else: 15 return None 16