python: Translate NPNR_ASSERTs to Python
Signed-off-by: David Shah <davey1576@gmail.com>
This commit is contained in:
parent
3e8bdb5cbd
commit
f8ad2b31a9
@ -61,8 +61,15 @@ Context *load_design_shim(std::string filename, ArchArgs args)
|
|||||||
return d;
|
return d;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void translate_assertfail(const assertion_failure &e) {
|
||||||
|
// Use the Python 'C' API to set up an exception object
|
||||||
|
PyErr_SetString(PyExc_AssertionError, e.what());
|
||||||
|
}
|
||||||
|
|
||||||
BOOST_PYTHON_MODULE(MODULE_NAME)
|
BOOST_PYTHON_MODULE(MODULE_NAME)
|
||||||
{
|
{
|
||||||
|
register_exception_translator<assertion_failure>(&translate_assertfail);
|
||||||
|
|
||||||
using namespace PythonConversion;
|
using namespace PythonConversion;
|
||||||
|
|
||||||
class_<GraphicElement>("GraphicElement")
|
class_<GraphicElement>("GraphicElement")
|
||||||
|
Loading…
Reference in New Issue
Block a user