mirror of
https://github.com/pybind/pybind11.git
synced 2025-01-20 01:42:37 +00:00
LOOOK to trace disowning
This commit is contained in:
parent
c5278145a0
commit
36bbac1b47
@ -600,6 +600,7 @@ struct value_and_holder_helper {
|
|||||||
+ "`: Python instance is uninitialized.");
|
+ "`: Python instance is uninitialized.");
|
||||||
}
|
}
|
||||||
if (!holder().has_pointee()) {
|
if (!holder().has_pointee()) {
|
||||||
|
printf("\nLOOOK throw(Python instance was disowned.)\n"); fflush(stdout); // NOLINT
|
||||||
throw value_error(missing_value_msg + clean_type_id(typeid_name)
|
throw value_error(missing_value_msg + clean_type_id(typeid_name)
|
||||||
+ "`: Python instance was disowned.");
|
+ "`: Python instance was disowned.");
|
||||||
}
|
}
|
||||||
@ -867,6 +868,8 @@ struct load_helper : value_and_holder_helper {
|
|||||||
template <typename D>
|
template <typename D>
|
||||||
std::unique_ptr<T, D> loaded_as_unique_ptr(void *raw_void_ptr,
|
std::unique_ptr<T, D> loaded_as_unique_ptr(void *raw_void_ptr,
|
||||||
const char *context = "loaded_as_unique_ptr") {
|
const char *context = "loaded_as_unique_ptr") {
|
||||||
|
printf("\nLOOOK %s:%d\n", __FILE__, __LINE__); fflush(stdout); // NOLINT
|
||||||
|
printf("\nLOOOK T=%s\n", clean_type_id(typeid(T).name()).c_str()); fflush(stdout); // NOLINT
|
||||||
if (!have_holder()) {
|
if (!have_holder()) {
|
||||||
return unique_with_deleter<T, D>(nullptr, std::unique_ptr<D>());
|
return unique_with_deleter<T, D>(nullptr, std::unique_ptr<D>());
|
||||||
}
|
}
|
||||||
@ -904,19 +907,25 @@ struct load_helper : value_and_holder_helper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Critical transfer-of-ownership section. This must stay together.
|
// Critical transfer-of-ownership section. This must stay together.
|
||||||
|
printf("\nLOOOK CRITICAL SECTION BEGIN.\n"); fflush(stdout); // NOLINT
|
||||||
if (self_life_support != nullptr) {
|
if (self_life_support != nullptr) {
|
||||||
|
printf("\nLOOOK holder().disown()\n"); fflush(stdout); // NOLINT
|
||||||
holder().disown();
|
holder().disown();
|
||||||
} else {
|
} else {
|
||||||
|
printf("\nLOOOK holder().release_ownership()\n"); fflush(stdout); // NOLINT
|
||||||
holder().release_ownership();
|
holder().release_ownership();
|
||||||
}
|
}
|
||||||
auto result = unique_with_deleter<T, D>(raw_type_ptr, std::move(extracted_deleter));
|
auto result = unique_with_deleter<T, D>(raw_type_ptr, std::move(extracted_deleter));
|
||||||
if (self_life_support != nullptr) {
|
if (self_life_support != nullptr) {
|
||||||
|
printf("\nLOOOK activate_life_support\n"); fflush(stdout); // NOLINT
|
||||||
self_life_support->activate_life_support(loaded_v_h);
|
self_life_support->activate_life_support(loaded_v_h);
|
||||||
} else {
|
} else {
|
||||||
void *value_void_ptr = loaded_v_h.value_ptr();
|
void *value_void_ptr = loaded_v_h.value_ptr();
|
||||||
loaded_v_h.value_ptr() = nullptr;
|
loaded_v_h.value_ptr() = nullptr;
|
||||||
|
printf("\nLOOOK deregister_instance\n"); fflush(stdout); // NOLINT
|
||||||
deregister_instance(loaded_v_h.inst, value_void_ptr, loaded_v_h.type);
|
deregister_instance(loaded_v_h.inst, value_void_ptr, loaded_v_h.type);
|
||||||
}
|
}
|
||||||
|
printf("\nLOOOK CRITICAL SECTION END.\n"); fflush(stdout); // NOLINT
|
||||||
// Critical section end.
|
// Critical section end.
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
Loading…
Reference in New Issue
Block a user