Make wrapped C++ functions pickleable (#5580)

* Backport of https://github.com/google/pybind11clif/pull/30099

* Add back `PYBIND11_WARNING_DISABLE_CLANG("-Wcast-function-type-mismatch")`

macos-13 • brew install llvm

```
/Users/runner/work/pybind11/pybind11/include/pybind11/detail/function_record_pyobject.h:40:26: error: cast from 'PyObject *(*)(PyObject *, PyObject *, PyObject *)' (aka '_object *(*)(_object *, _object *, _object *)') to 'PyCFunction' (aka '_object *(*)(_object *, _object *)') converts to incompatible function type [-Werror,-Wcast-function-type-mismatch]
   40 |     = {{"__reduce_ex__", (PyCFunction) reduce_ex_impl, METH_VARARGS | METH_KEYWORDS, nullptr},
      |                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
```

* Remove obsolete `PY_VERSION_HEX >= 0x03080000` (discovered by gh-henryiii)
This commit is contained in:
Ralf W. Grosse-Kunstleve
2025-03-28 11:50:37 -07:00
committed by GitHub
parent 8f00d1eea0
commit e7e5d6e5bb
9 changed files with 294 additions and 88 deletions

View File

@@ -65,6 +65,7 @@ detail_headers = {
"include/pybind11/detail/cpp_conduit.h",
"include/pybind11/detail/descr.h",
"include/pybind11/detail/dynamic_raw_ptr_cast_if_possible.h",
"include/pybind11/detail/function_record_pyobject.h",
"include/pybind11/detail/init.h",
"include/pybind11/detail/internals.h",
"include/pybind11/detail/native_enum_data.h",