[FRONTEND] Refresh cache when the source code of outlined functions are changed (#590)

This commit is contained in:
Keren Zhou
2022-07-20 17:34:07 -07:00
committed by GitHub
parent 9b2bc88d11
commit af85f5fa46
3 changed files with 31 additions and 5 deletions

View File

@@ -236,8 +236,14 @@ void parse_args(py::list& args, py::list do_not_specialize, const std::string& f
continue;
}
// argument is `constexpr`
if(py::hasattr(arg, "value")){
if (py::hasattr(arg, "value")) {
py::object value = arg.attr("value");
// check if value is a callable object using PyCallable_Check
if (PyCallable_Check(value.ptr())) {
throw std::runtime_error(
"constant argument cannot be a callable object: " +
std::string(py::str(arg)));
}
py::object name = arg_names[i];
constants[name] = value;
py::object repr = py::repr(value);