clangformat
Signed-off-by: David Shah <dave@ds0.me>
This commit is contained in:
parent
839fbb3fe9
commit
1afa494e69
@ -23,8 +23,8 @@
|
|||||||
|
|
||||||
#include <Python.h>
|
#include <Python.h>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <pybind11/pybind11.h>
|
|
||||||
#include <pybind11/embed.h>
|
#include <pybind11/embed.h>
|
||||||
|
#include <pybind11/pybind11.h>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
#include "pycontainers.h"
|
#include "pycontainers.h"
|
||||||
@ -36,7 +36,6 @@ NEXTPNR_NAMESPACE_BEGIN
|
|||||||
|
|
||||||
namespace py = pybind11;
|
namespace py = pybind11;
|
||||||
|
|
||||||
|
|
||||||
std::string parse_python_exception();
|
std::string parse_python_exception();
|
||||||
|
|
||||||
template <typename Tn> void python_export_global(const char *name, Tn &x)
|
template <typename Tn> void python_export_global(const char *name, Tn &x)
|
||||||
@ -44,7 +43,7 @@ template <typename Tn> void python_export_global(const char *name, Tn &x)
|
|||||||
try {
|
try {
|
||||||
py::object obj = py::cast(x, py::return_value_policy::reference);
|
py::object obj = py::cast(x, py::return_value_policy::reference);
|
||||||
py::module::import("__main__").attr(name) = obj.ptr();
|
py::module::import("__main__").attr(name) = obj.ptr();
|
||||||
} catch (pybind11::error_already_set &) {
|
} catch (pybind11::error_already_set &) {
|
||||||
// Parse and output the exception
|
// Parse and output the exception
|
||||||
std::string perror_str = parse_python_exception();
|
std::string perror_str = parse_python_exception();
|
||||||
std::cout << "Error in Python: " << perror_str << std::endl;
|
std::cout << "Error in Python: " << perror_str << std::endl;
|
||||||
|
Loading…
Reference in New Issue
Block a user