mirror of
https://github.com/YosysHQ/yosys
synced 2025-04-23 00:55:32 +00:00
Merge branch 'YosysHQ:main' into main
This commit is contained in:
commit
f855b39dbb
16 changed files with 4870 additions and 128 deletions
|
@ -1273,6 +1273,11 @@ class WFunction:
|
|||
func.duplicate = False
|
||||
func.namespace = namespace
|
||||
str_def = str_def.replace("operator ","operator")
|
||||
|
||||
# remove attributes from the start
|
||||
if str.startswith(str_def, "[[") and "]]" in str_def:
|
||||
str_def = str_def[str_def.find("]]")+2:]
|
||||
|
||||
if str.startswith(str_def, "static "):
|
||||
func.is_static = True
|
||||
str_def = str_def[7:]
|
||||
|
@ -1574,10 +1579,15 @@ class WFunction:
|
|||
return_stmt = "return " if self.ret_type.name != "void" else ""
|
||||
|
||||
text += ")\n\t\t{"
|
||||
text += "\n\t\t\tif (boost::python::override py_" + self.alias + " = this->get_override(\"py_" + self.alias + "\"))"
|
||||
text += f"\n\t\t\t\t{return_stmt}" + call_string
|
||||
text += "\n\t\t\telse"
|
||||
text += "\n\t\t\tif (boost::python::override py_" + self.alias + " = this->get_override(\"py_" + self.alias + "\")) {"
|
||||
text += "\n\t\t\t\ttry {"
|
||||
text += f"\n\t\t\t\t\t{return_stmt}" + call_string
|
||||
text += "\n\t\t\t\t} catch (boost::python::error_already_set &) {"
|
||||
text += "\n\t\t\t\t\tlog_python_exception_as_error();"
|
||||
text += "\n\t\t\t\t}"
|
||||
text += "\n\t\t\t} else {"
|
||||
text += f"\n\t\t\t\t{return_stmt}" + self.member_of.name + "::" + call_string
|
||||
text += "\n\t\t\t}"
|
||||
text += "\n\t\t}"
|
||||
|
||||
text += "\n\n\t\t" + self.ret_type.gen_text() + " default_py_" + self.alias + "("
|
||||
|
@ -2330,6 +2340,11 @@ USING_YOSYS_NAMESPACE
|
|||
|
||||
namespace YOSYS_PYTHON {
|
||||
|
||||
[[noreturn]] static void log_python_exception_as_error() {
|
||||
PyErr_Print();
|
||||
log_error("Python interpreter encountered an exception.\\n");
|
||||
}
|
||||
|
||||
struct YosysStatics{};
|
||||
""")
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue