13#ifndef CIRCT_BINDINGS_PYTHON_PYBINDUTILS_H
14#define CIRCT_BINDINGS_PYTHON_PYBINDUTILS_H
18#include <nanobind/nanobind.h>
20#include "mlir-c/Bindings/Python/Interop.h"
22#include "mlir-c/Pass.h"
40 return [](MlirStringRef part,
void *userData) {
41 nanobind::gil_scoped_acquire();
45 nanobind::bytes pyBytes(part.data, part.length);
48 nanobind::str pyStr(part.data,
68 const char *message) {
69 PyErr_SetString(exc_class, message);
70 return nanobind::python_error();
Taken from NanobindUtils.h in MLIR.
MlirStringCallback getCallback()
nanobind::object pyWriteFunction
PyFileAccumulator(nanobind::object fileObject, bool binary)
The InstanceGraph op interface, see InstanceGraphInterface.td for more details.
nanobind::python_error raisePyError(PyObject *exc_class, const char *message)
Raises a python exception with the given message.
nanobind::python_error raiseValueError(const char *message)
Raises a value error with the given message.