aboutsummaryrefslogtreecommitdiffstats
path: root/misc/py_wrap_generator.py
diff options
context:
space:
mode:
authorEddie Hung <eddie@fpgeh.com>2019-07-10 15:58:01 -0700
committerEddie Hung <eddie@fpgeh.com>2019-07-10 15:58:01 -0700
commitcea7441d8ae7df8d22f510e6a101ec46a9d7751e (patch)
tree8067ba09ecfaf6d9cf32e8ed9adba42be27b86a4 /misc/py_wrap_generator.py
parentc865559f9540c29cb9c6302edc8b4a2620c0b49d (diff)
parentbb2144ae733f1a2c5e629a8251bfbdcc15559aa4 (diff)
downloadyosys-cea7441d8ae7df8d22f510e6a101ec46a9d7751e.tar.gz
yosys-cea7441d8ae7df8d22f510e6a101ec46a9d7751e.tar.bz2
yosys-cea7441d8ae7df8d22f510e6a101ec46a9d7751e.zip
Merge remote-tracking branch 'origin/master' into xc7dsp
Diffstat (limited to 'misc/py_wrap_generator.py')
-rw-r--r--misc/py_wrap_generator.py3
1 files changed, 3 insertions, 0 deletions
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;"