def invoke_python(*inner_arguments): from qy import constant_pointer_to call_object = \ Function.named( "PyObject_CallObject", object_ptr_type, [object_ptr_type, object_ptr_type], ) argument_tuple = qy.py_tuple(*inner_arguments[1:]) call_result = call_object(inner_arguments[0], argument_tuple) qy.py_dec_ref(argument_tuple) qy.py_check_null(call_result) qy.py_dec_ref(call_result) qy.return_()
def get(self, name): """ Get an attribute. """ object_ptr_type = qy.object_ptr_type get_attr = \ Function.named( "PyObject_GetAttrString", object_ptr_type, [object_ptr_type, llvm.Type.pointer(llvm.Type.int(8))], ) result = get_attr(self, qy.string_literal(name)) qy.py_check_null(result) return Object(result._value)