From: Clifford Wolf Date: Fri, 5 Jul 2019 09:57:41 +0000 (+0200) Subject: Merge pull request #1159 from btut/fix/1090_segfault_cell_and_wire X-Git-Tag: yosys-0.9~21 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=17e0cc010c12fc69fdadc2c342da1ef8e16a2d91;p=yosys.git Merge pull request #1159 from btut/fix/1090_segfault_cell_and_wire Throw runtime exception when trying to convert inexistend C++ object to Python --- diff --git a/misc/py_wrap_generator.py b/misc/py_wrap_generator.py index 9e5727499..66d661fa1 100644 --- a/misc/py_wrap_generator.py +++ b/misc/py_wrap_generator.py @@ -779,6 +779,9 @@ class WClass: #if self.link_type != link_types.pointer: text += "\n\t\tstatic " + self.name + "* get_py_obj(" + long_name + "* ref)\n\t\t{" + text += "\n\t\t\tif(ref == nullptr){" + text += "\n\t\t\t\tthrow std::runtime_error(\"" + self.name + " does not exist.\");" + text += "\n\t\t\t}" text += "\n\t\t\t" + self.name + "* ret = (" + self.name + "*)malloc(sizeof(" + self.name + "));" if self.link_type == link_types.pointer: text += "\n\t\t\tret->ref_obj = ref;"