-
Notifications
You must be signed in to change notification settings - Fork 7
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
Git merge status-callback #30022
Git merge status-callback #30022
Conversation
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
2e6a545
to
76f7a7b
Compare
include/pybind11/functional.h
Outdated
struct func_wrapper_base { | ||
func_handle hfunc; | ||
return_value_policy_pack rvpp; | ||
explicit func_wrapper_base(func_handle &&hf, const return_value_policy_pack &rvpp) noexcept |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This explicit
is not longer accurate/needed.
…ns to capture C++ exceptions. This change builds on google/pybind11clif#30022. PiperOrigin-RevId: 597047935
…ns to capture C++ exceptions. BEGIN_PUBLIC Change pybind11 handling of callbacks with `Status`, `StatusOr` returns to capture C++ exceptions. This change builds on google/pybind11clif#30022. END_PUBLIC The CL is mainly moving the `type_caster_std_function_specializations` code block from * google3/third_party/clif/pybind11/type_casters.h;l=42-74;rcl=532883006 into google3/third_party/pybind11_abseil/status_caster.h & google3/third_party/pybind11_abseil/statusor_caster.h. Additionally, the behavior for callbacks with a `Status` return is changed (`catch` `cast_error` in status_caster.h), to ensure that C++ exceptions do not unwind through C++ code built with exception handling disabled (see e.g. google3/third_party/pybind11_abseil/compat/README.md). Note that the added related test code (`testStatusWrongReturnType` in status_testing_no_cpp_eh_test_lib.py) exposed a behavior difference between PyCLIF-C-API and pybind11: returned objects are simply ignored by PyCLIF-C-API. Addressing this is left for later. All other changes are mainly to reorganize and expand the test code. (Note that the extensive, multi-year refactoring work around `Status`, `StatusOr`, `StatusNotOk` has left the related test code in a fairly unorganized state.) Notes for completeness: * This is a fairly fundamental behavior change, but somewhat surprisingly cl/596532587 was the only adjustment needed in google3. * TGP tested via child cl/578064081, which is only a very small additional production code change (fixing a very obvious bug), and will be submitted shortly after this CL. PiperOrigin-RevId: 597047935
Description
Merge pybind/pybind11#4597 (Allow specializations based on callback function return values and arguments) with pywrapcc.
Additionally make
func_wrapper
usereturn_value_policy_pack
.