Skip to content

Commit d930755

Browse files
Compat
1 parent 3d1d32e commit d930755

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

include/pybind11/detail/internal_pytypes.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,11 @@ struct pybind_function_type_data {
208208

209209
set_vectorcall_set_offset(type, offsetof(pybind_function, vectorcall));
210210

211-
type.tp_flags = Py_TPFLAGS_METHOD_DESCRIPTOR | Py_TPFLAGS_DEFAULT | pybind_vectorcall_flag;
211+
type.tp_flags = Py_TPFLAGS_DEFAULT | pybind_vectorcall_flag;
212+
213+
#ifdef Py_TPFLAGS_METHOD_DESCRIPTOR
214+
type.tp_flags |= Py_TPFLAGS_METHOD_DESCRIPTOR;
215+
#endif
212216

213217
type.tp_descr_get = [](PyObject *self, PyObject *obj, PyObject *) -> PyObject * {
214218
// std::cout << "Ideally shouldn't be calling tp_descr_get ... " << obj << std::endl;

0 commit comments

Comments
 (0)