From b0e66d441cf584e7e48049d4f07afcc8e743309a Mon Sep 17 00:00:00 2001 From: David Shah Date: Thu, 7 Jun 2018 12:57:52 +0200 Subject: Global design object working Signed-off-by: David Shah --- common/pybindings.cc | 6 ++++++ common/pybindings.h | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'common') diff --git a/common/pybindings.cc b/common/pybindings.cc index 4ae83cb0..a051eea6 100644 --- a/common/pybindings.cc +++ b/common/pybindings.cc @@ -66,6 +66,12 @@ BOOST_PYTHON_MODULE (MODULE_NAME) { class_>("PortRefVector") .def(vector_indexing_suite>()); + enum_("PortType") + .value("PORT_IN", PORT_IN) + .value("PORT_OUT", PORT_OUT) + .value("PORT_INOUT", PORT_INOUT) + .export_values(); + class_("PortInfo") .def_readwrite("name", &PortInfo::name) .def_readwrite("net", &PortInfo::net) diff --git a/common/pybindings.h b/common/pybindings.h index 44898198..a99ad51b 100644 --- a/common/pybindings.h +++ b/common/pybindings.h @@ -94,7 +94,7 @@ void python_export_global(const char *name, Tn &x) { return; d = PyModule_GetDict(m); try { - PyObject * p = object(boost::ref(x)).ptr(); + PyObject * p = incref(object(boost::ref(x)).ptr()); PyDict_SetItemString(d, name, p); } catch (boost::python::error_already_set const &) { // Parse and output the exception -- cgit v1.2.3