Skip to content

Commit a8b430e

Browse files
committed
Guard no GIL flag to only be active when GIL is disabled in the build
1 parent 1c4eedb commit a8b430e

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

cpp/wrapper.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,14 @@ PySolver::PySolver(py::object A, const bool upper=false){
123123
}
124124

125125

126-
127-
126+
// py:mod_gil_not_used() is only available on newer pybind versions, and
127+
// is only needed when the GIL is disabled, so hide its use unless we actually
128+
// need it.
129+
#ifdef Py_GIL_DISABLED
128130
PYBIND11_MODULE(qdldl, m, py::mod_gil_not_used()) {
131+
#else
132+
PYBIND11_MODULE(qdldl, m) {
133+
#endif
129134
m.doc() = "QDLDL wrapper";
130135
py::class_<PySolver>(m, "Solver")
131136
.def(py::init<py::object, bool>(), py::arg("A"), py::arg("upper") = false)

0 commit comments

Comments
 (0)