Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion mlir/cmake/modules/AddMLIRPython.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -704,7 +704,12 @@ function(add_mlir_python_extension libname extname)
# NanobindAdaptors.h uses PyClassMethod_New to build `pure_subclass`es but nanobind
# doesn't declare this API as undefined in its linker flags. So we need to declare it as such
# for downstream users that do not do something like `-undefined dynamic_lookup`.
target_link_options(${libname} PUBLIC "LINKER:-U,_PyClassMethod_New")
# Same for the rest.
target_link_options(${libname} PUBLIC
"LINKER:-U,_PyClassMethod_New"
"LINKER:-U,_PyCode_Addr2Location"
"LINKER:-U,_PyFrame_GetLasti"
)
endif()
endif()

Expand Down
4 changes: 2 additions & 2 deletions mlir/lib/Bindings/Python/IRCore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2810,7 +2810,7 @@ class PyOpAttributeMap {

// bpo-42262 added Py_XNewRef()
#if !defined(Py_XNewRef)
PyObject *_Py_XNewRef(PyObject *obj) {
[[maybe_unused]] PyObject *_Py_XNewRef(PyObject *obj) {
Py_XINCREF(obj);
return obj;
}
Expand All @@ -2819,7 +2819,7 @@ PyObject *_Py_XNewRef(PyObject *obj) {

// bpo-42262 added Py_NewRef()
#if !defined(Py_NewRef)
PyObject *_Py_NewRef(PyObject *obj) {
[[maybe_unused]] PyObject *_Py_NewRef(PyObject *obj) {
Py_INCREF(obj);
return obj;
}
Expand Down