Skip to content

Commit

Permalink
Refactor: Rename func to get_py_obj_ret_type_conv_fn_from_ttype()
Browse files Browse the repository at this point in the history
  • Loading branch information
Shaikh-Ubaid committed Jun 23, 2023
1 parent 185f70f commit 357669a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/libasr/codegen/asr_to_c_cpp.h
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,7 @@ R"(#include <stdio.h>
ASR::Variable_t* r_v = ASRUtils::EXPR2VAR(x.m_return_var);
std::string indent = "\n ";
std::string ret_var_decl = indent + CUtils::get_c_type_from_ttype_t(r_v->m_type) + " _lpython_return_variable;";
std::string py_val_cnvrt = BindPyUtils::get_py_obj_return_type_conv_func_from_ttype_t(r_v->m_type,
std::string py_val_cnvrt = BindPyUtils::get_py_obj_ret_type_conv_fn_from_ttype(r_v->m_type,
array_types_decls, c_ds_api, bind_py_utils_functions);
std::string ret_assign = indent + "_lpython_return_variable = " + py_val_cnvrt + "(pValue);";
std::string clear_pValue = indent + "Py_DECREF(pValue);";
Expand Down
8 changes: 4 additions & 4 deletions src/libasr/codegen/c_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -1836,7 +1836,7 @@ namespace BindPyUtils {
return type_src;
}

static inline std::string get_py_obj_return_type_conv_func_from_ttype_t(ASR::ttype_t* t,
static inline std::string get_py_obj_ret_type_conv_fn_from_ttype(ASR::ttype_t* t,
std::string &array_types_decls, std::unique_ptr<CCPPDSUtils> &c_ds_api,
std::unique_ptr<BindPyUtilFunctions> &bind_py_utils_functions) {
int kind = ASRUtils::extract_kind_from_ttype_t(t);
Expand All @@ -1857,7 +1857,7 @@ namespace BindPyUtils {
case 4: type_src = "PyLong_AsLong"; break;
case 8: type_src = "PyLong_AsLongLong"; break;
default:
throw CodeGenError("get_py_obj_return_type_conv_func_from_ttype_t: Unsupported kind in int type");
throw CodeGenError("get_py_obj_ret_type_conv_fn_from_ttype: Unsupported kind in int type");
}
break;
}
Expand All @@ -1867,7 +1867,7 @@ namespace BindPyUtils {
case 4: type_src = "PyLong_AsUnsignedLong"; break;
case 8: type_src = "PyLong_AsUnsignedLongLong"; break;
default:
throw CodeGenError("get_py_obj_return_type_conv_func_from_ttype_t: Unsupported kind in unsigned int type");
throw CodeGenError("get_py_obj_ret_type_conv_fn_from_ttype: Unsupported kind in unsigned int type");
}
break;
}
Expand All @@ -1880,7 +1880,7 @@ namespace BindPyUtils {
break;
}
default: {
throw CodeGenError("get_py_obj_return_type_conv_func_from_ttype_t: Type " + ASRUtils::type_to_str_python(t) + " not supported yet.");
throw CodeGenError("get_py_obj_ret_type_conv_fn_from_ttype: Type " + ASRUtils::type_to_str_python(t) + " not supported yet.");
}
}
return type_src;
Expand Down

0 comments on commit 357669a

Please sign in to comment.