Ralf W. Grosse-Kunstleve
4638e017b6
Modify py::trampoline_self_life_support semantics: if trampoline class does not inherit from this class, preserve established Inheritance Slicing behavior.
rwgk reached this point with the help of ChatGPT:
* https://chatgpt.com/share/68056498-7d94-8008-8ff0-232e2aba451c
The only production code change in this commit is:
```
diff --git a/include/pybind11/detail/type_caster_base.h b/include/pybind11/detail/type_caster_base.h
index d4f9a41e..f3d45301 100644
--- a/include/pybind11/detail/type_caster_base.h
+++ b/include/pybind11/detail/type_caster_base.h
@@ -776,6 +776,14 @@ struct load_helper : value_and_holder_helper {
if (released_ptr) {
return std::shared_ptr<T>(released_ptr, type_raw_ptr);
}
+ auto *self_life_support
+ = dynamic_raw_ptr_cast_if_possible<trampoline_self_life_support>(type_raw_ptr);
+ if (self_life_support == nullptr) {
+ std::shared_ptr<void> void_shd_ptr = hld.template as_shared_ptr<void>();
+ std::shared_ptr<T> to_be_released(void_shd_ptr, type_raw_ptr);
+ vptr_gd_ptr->released_ptr = to_be_released;
+ return to_be_released;
+ }
std::shared_ptr<T> to_be_released(
type_raw_ptr, shared_ptr_trampoline_self_life_support(loaded_v_h.inst));
vptr_gd_ptr->released_ptr = to_be_released;
```
2025-04-20 14:14:47 -07:00
..
2025-04-14 17:25:32 -04:00
2024-06-22 00:55:00 -04:00
2025-04-08 20:46:24 -07:00
2025-03-31 22:50:40 -04:00
2025-03-17 17:18:00 -04:00
2025-04-19 12:35:50 -07:00
2025-04-03 22:08:56 -04:00
2024-11-18 14:39:59 -08:00
2024-06-18 13:54:38 -07:00
2024-06-18 13:54:38 -07:00
2024-09-17 09:47:20 -07:00
2024-06-18 13:54:38 -07:00
2025-04-09 09:09:15 -07:00
2024-11-10 12:17:35 -08:00
2024-09-13 00:18:29 -04:00
2024-09-13 00:18:29 -04:00
2024-08-22 00:27:50 -04:00
2022-02-10 12:17:07 -08:00
2024-06-18 13:54:38 -07:00
2025-04-03 22:08:56 -04:00
2024-11-07 09:32:09 -08:00
2024-08-14 18:21:04 -04:00
2025-04-04 12:35:55 -07:00
2025-04-14 17:25:32 -04:00
2022-02-10 12:17:07 -08:00
2024-09-03 10:51:21 -04:00
2025-04-10 18:31:28 -04:00
2025-04-13 19:47:19 -07:00
2025-03-18 07:56:34 -07:00
2025-03-18 07:56:34 -07:00
2024-10-07 14:12:04 -07:00
2024-10-25 08:28:15 -07:00
2025-03-28 11:36:02 -04:00
2025-04-09 09:09:15 -07:00
2022-02-10 12:17:07 -08:00
2024-06-22 00:55:00 -04:00
2025-02-16 11:01:41 -08:00
2025-02-16 11:01:41 -08:00
2025-03-05 12:40:53 -08:00
2025-03-05 12:40:53 -08:00
2025-03-05 12:40:53 -08:00
2025-03-05 12:40:53 -08:00
2025-03-05 12:40:53 -08:00
2025-03-05 12:40:53 -08:00
2025-03-05 12:40:53 -08:00
2025-03-05 12:40:53 -08:00
2025-03-05 12:40:53 -08:00
2025-03-05 12:40:53 -08:00
2025-03-05 12:40:53 -08:00
2025-03-05 12:40:53 -08:00
2025-03-05 12:40:53 -08:00
2025-03-05 12:40:53 -08:00
2025-03-05 12:40:53 -08:00
2025-03-05 12:40:53 -08:00
2025-03-05 12:40:53 -08:00
2025-03-05 12:40:53 -08:00
2025-03-05 12:40:53 -08:00
2025-03-05 12:40:53 -08:00
2025-03-05 12:40:53 -08:00
2025-03-05 12:40:53 -08:00
2025-03-05 12:40:53 -08:00
2025-03-05 12:40:53 -08:00
2025-04-20 14:14:47 -07:00
2025-03-05 12:40:53 -08:00
2025-03-05 12:40:53 -08:00
2025-03-05 12:40:53 -08:00
2025-04-20 14:14:47 -07:00
2025-04-20 14:14:47 -07:00
2025-03-05 12:40:53 -08:00
2025-03-05 12:40:53 -08:00
2025-03-05 12:40:53 -08:00
2025-03-05 12:40:53 -08:00
2025-03-05 12:40:53 -08:00
2025-03-05 12:40:53 -08:00
2025-04-20 14:14:47 -07:00
2025-04-20 14:14:47 -07:00
2025-04-08 23:43:49 -04:00
2025-03-18 07:56:34 -07:00
2022-02-14 11:36:22 -08:00
2024-06-22 00:55:00 -04:00
2024-03-26 13:57:05 -04:00
2024-06-22 00:55:00 -04:00
2024-06-24 08:59:55 -07:00
2024-10-25 08:28:15 -07:00
2024-09-13 00:18:29 -04:00
2024-09-13 00:18:29 -04:00
2024-09-13 00:18:29 -04:00
2024-10-07 14:12:04 -07:00
2024-04-02 11:14:08 -04:00
2025-03-18 07:56:34 -07:00
2021-09-24 12:08:22 -07:00
2024-10-07 14:12:04 -07:00
2025-01-24 17:01:06 -05:00
2024-12-08 11:30:49 -08:00
2024-04-02 11:14:08 -04:00
2025-03-18 07:56:34 -07:00
2025-02-17 23:13:05 -08:00
2025-02-17 23:13:05 -08:00
2022-12-20 05:34:00 -08:00
2024-07-29 11:10:03 -07:00
2025-02-17 23:13:05 -08:00
2025-03-24 20:31:59 -07:00
2025-04-10 18:31:28 -04:00
2024-06-22 00:55:00 -04:00
2022-02-10 12:17:07 -08:00
2024-10-07 14:12:04 -07:00
2024-09-17 09:47:20 -07:00
2023-08-07 20:48:20 -07:00
2025-03-20 22:41:33 -07:00
2022-02-14 11:36:22 -08:00
2025-03-18 07:56:34 -07:00
2022-10-30 08:57:23 -07:00
2025-02-04 07:48:47 -08:00
2022-02-14 11:36:22 -08:00
2024-11-18 14:39:59 -08:00
2024-11-11 14:51:01 -08:00
2025-04-13 19:47:19 -07:00
2022-02-10 12:17:07 -08:00
2025-03-23 20:35:14 -07:00
2024-11-11 15:35:28 -08:00
2025-03-18 07:56:34 -07:00
2024-07-29 11:10:03 -07:00
2025-03-28 09:57:39 -07:00
2022-02-10 12:17:07 -08:00
2025-03-23 20:35:14 -07:00
2025-04-15 21:38:15 -07:00
2025-04-15 21:38:15 -07:00
2025-02-17 23:13:05 -08:00
2025-03-20 20:57:51 -07:00
2025-03-06 00:19:54 -08:00
2025-04-03 22:08:56 -04:00
2022-05-26 11:07:40 -04:00
2025-03-18 07:56:34 -07:00
2025-04-10 18:31:28 -04:00
2025-03-18 11:29:57 -07:00
2022-11-28 07:39:38 -08:00
2025-03-31 22:50:55 -04:00
2022-05-02 12:39:36 -07:00
2025-03-30 19:56:07 -07:00
2023-11-08 12:44:04 -08:00
2024-06-22 00:55:00 -04:00
2025-04-16 18:42:34 -04:00
2025-04-16 18:42:34 -04:00
2024-08-22 00:27:50 -04:00
2024-11-11 15:35:28 -08:00
2025-04-10 12:37:50 -07:00
2025-04-10 12:37:50 -07:00
2024-04-02 11:14:08 -04:00
2024-10-08 10:49:35 -07:00
2025-04-13 19:47:19 -07:00
2025-04-13 19:47:19 -07:00
2024-08-22 00:27:50 -04:00
2024-06-22 00:55:00 -04:00
2025-01-16 11:13:21 -08:00
2025-01-16 11:13:21 -08:00
2024-10-07 14:12:04 -07:00
2025-03-18 07:56:34 -07:00
2024-08-09 13:28:12 -07:00
2024-08-09 13:28:12 -07:00
2019-06-11 23:28:58 +02:00
2024-06-22 00:55:00 -04:00
2025-02-19 09:24:02 -08:00
2025-02-19 09:24:02 -08:00
2023-04-25 14:03:24 -07:00
2024-06-22 00:55:00 -04:00
2023-04-27 07:24:48 -07:00
2024-06-22 00:55:00 -04:00
2024-08-22 00:27:50 -04:00
2024-10-07 14:12:04 -07:00
2024-08-28 20:55:50 -07:00
2024-08-28 20:55:50 -07:00
2021-07-04 19:58:35 -04:00
2021-01-31 17:29:09 -05:00