Note: This change is the result of exploring and discarding multiple approaches to fixing the zero-refcount bug in a more general way. The only approach that worked out is this local fix in the callback code. Fundamentally, code involving `StatusOr<PyObject *>` objects is inherently unsafe and bug prone, because ownership of the Python reference is not managed automatically. Ideally use of `StatusOr<PyObject *>` would generate compilation errors (e.g. via `static_assert`), which would be easy to achieve just in the pybind11_abseil repo, but would require significant sprawling changes around the Google codebase. Unfortunately, currently this is infeasible. The command used for manual leak checking (see `# Manual verification` comments in status_testing_no_cpp_eh_test_lib.py) was: ``` blaze run //third_party/pybind11_abseil/tests:status_testing_no_cpp_eh_test ``` The `top` command was used to visually monitor `RES` for about 10 seconds, for each test case. PiperOrigin-RevId: 597061300
| Name |
Last commit
|
Last Update |
|---|---|---|
| .. | ||
| compat | Loading commit data... | |
| cpp_capsule_tools | Loading commit data... | |
| tests | Loading commit data... | |
| BUILD | Loading commit data... | |
| CMakeLists.txt | Loading commit data... | |
| __init__.py | Loading commit data... | |
| absl_casters.h | Loading commit data... | |
| check_status_module_imported.h | Loading commit data... | |
| display_source_location_in_python.cc | Loading commit data... | |
| display_source_location_in_python.h | Loading commit data... | |
| import_status_module.cc | Loading commit data... | |
| import_status_module.h | Loading commit data... | |
| init_from_tag.h | Loading commit data... | |
| no_throw_status.h | Loading commit data... | |
| ok_status_singleton_lib.cc | Loading commit data... | |
| ok_status_singleton_lib.h | Loading commit data... | |
| ok_status_singleton_py_extension_stub.cc | Loading commit data... | |
| ok_status_singleton_pyinit_google3.cc | Loading commit data... | |
| register_status_bindings.cc | Loading commit data... | |
| register_status_bindings.h | Loading commit data... | |
| status_caster.h | Loading commit data... | |
| status_casters.h | Loading commit data... | |
| status_not_ok_exception.h | Loading commit data... | |
| status_py_extension_stub.cc | Loading commit data... | |
| status_pyinit_google3.cc | Loading commit data... | |
| statusor_caster.h | Loading commit data... | |
| utils_pybind11_absl.cc | Loading commit data... | |
| utils_pybind11_absl.h | Loading commit data... |