Skip to content

fix: refcount bug involving trampoline functions with PyObject * return type. #5156

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Jun 11, 2024
Prev Previous commit
Next Next commit
Add PYBIND11_WARNING_DISABLE_MSVC(4127) into `PYBIND11_OVERRIDE_IMP…
…L` macro.
  • Loading branch information
rwgk committed Jun 7, 2024
commit 98a5e3b5949a52be53b8bfb972c1c5ec66b64f21
3 changes: 3 additions & 0 deletions include/pybind11/pybind11.h
Original file line number Diff line number Diff line change
Expand Up @@ -2868,8 +2868,11 @@ function get_override(const T *this_ptr, const char *name) {
= pybind11::get_override(static_cast<const cname *>(this), name); \
if (override) { \
auto o = override(__VA_ARGS__); \
PYBIND11_WARNING_PUSH \
PYBIND11_WARNING_DISABLE_MSVC(4127) \
if (!pybind11::detail::is_same_ignoring_cvref<ret_type, PyObject *>::value \
&& pybind11::detail::cast_is_temporary_value_reference<ret_type>::value) { \
PYBIND11_WARNING_POP \
static pybind11::detail::override_caster_t<ret_type> caster; \
return pybind11::detail::cast_ref<ret_type>(std::move(o), caster); \
} \
Expand Down
Loading