def assure_generic_c_level_function(tt, offset):
"""
Makes sure that the given type tt uses the generic c-level function
for some of the magic methods such as repr(), str(), etc.
"""
ref_from_address = ctypes.c_ssize_t.from_address
tp_func_object = ref_from_address(id(Object) + offset)
tp_func_cursed = ref_from_address(id(tt) + offset)
tp_func_cursed.value = tp_func_object.value
评论列表
文章目录