Skip to content

Commit 8b73479

Browse files
committed
[mlir] Annotate methods on a correct class in PybindAdaptors.h
The `.def` and `.def_property_readonly` functions in PybindAdaptors.h should construct the functions as method of the current class rather than as method of pybind11:none(), which is an object and not even a class. Depends On D117658 Reviewed By: gysit Differential Revision: https://reviews.llvm.org/D117659
1 parent c234b27 commit 8b73479

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

mlir/include/mlir/Bindings/Python/PybindAdaptors.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ class pure_subclass {
249249
template <typename Func, typename... Extra>
250250
pure_subclass &def(const char *name, Func &&f, const Extra &... extra) {
251251
py::cpp_function cf(
252-
std::forward<Func>(f), py::name(name), py::is_method(py::none()),
252+
std::forward<Func>(f), py::name(name), py::is_method(thisClass),
253253
py::sibling(py::getattr(thisClass, name, py::none())), extra...);
254254
thisClass.attr(cf.name()) = cf;
255255
return *this;
@@ -259,7 +259,7 @@ class pure_subclass {
259259
pure_subclass &def_property_readonly(const char *name, Func &&f,
260260
const Extra &... extra) {
261261
py::cpp_function cf(
262-
std::forward<Func>(f), py::name(name), py::is_method(py::none()),
262+
std::forward<Func>(f), py::name(name), py::is_method(thisClass),
263263
py::sibling(py::getattr(thisClass, name, py::none())), extra...);
264264
auto builtinProperty =
265265
py::reinterpret_borrow<py::object>((PyObject *)&PyProperty_Type);

0 commit comments

Comments
 (0)