I am trying to build a library using this C++ code:
#include <pybind11/pybind11.h>

namespace py = pybind11;

PyObject* func() {
    return Py_BuildValue("iii", 1, 2, 3);
}

PYBIND11_MODULE(example, m) {
    m.def("func", &func);
}

But when I tried to run this Python 3 code:
import example
print(example.func())

It gives me following error:
TypeError: Unregistered type : _object

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
TypeError: Unable to convert function return value to a Python type! The signature was
        () -> _object

Why it is happening and how to fix it?

Why pybind11 can not recognize PyObject* as a Python object and how to fix it?
So, first off, what are you trying to do with your function? Making a raw python API call (Py_BuildValue, https://docs.python.org/3/c-api/arg.html#c.Py_BuildValue) is strongly discouraged, that is why you are using PyBind11, to handle that for you.
What are you trying to do with this line?
Py_BuildValue("iii", 1, 2, 3)

It looks like you are trying to return a tuple of 3 ints. Perhaps something like this would work instead:
py::tuple func() {
    return py::make_tuple(1, 2, 3);
}

With that said, I think the error is from Python not understanding what a PyObject* is. So you will need to expose the PyObject to Python using a py::class. I'm not sure if that makes sense though, I would need to test this.
From the docs I linked, it looks like Py_BuildValue might return a tuple. In which case I can suggest wrapping the return value in a py::tuple.
