mirror of
https://github.com/pybind/pybind11.git
synced 2024-11-11 16:13:53 +00:00
Converting C assert to pybind11_fail (to play safe).
This commit is contained in:
parent
5af253d66c
commit
f128f1b6db
@ -18,7 +18,6 @@
|
|||||||
#include "type_caster_base.h"
|
#include "type_caster_base.h"
|
||||||
#include "typeid.h"
|
#include "typeid.h"
|
||||||
|
|
||||||
#include <cassert>
|
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <new>
|
#include <new>
|
||||||
@ -419,8 +418,10 @@ struct smart_holder_type_caster_load {
|
|||||||
if (sptsls_ptr != nullptr) {
|
if (sptsls_ptr != nullptr) {
|
||||||
// This code is reachable only if there are multiple registered_instances for the
|
// This code is reachable only if there are multiple registered_instances for the
|
||||||
// same pointee.
|
// same pointee.
|
||||||
assert(reinterpret_cast<PyObject *>(load_impl.loaded_v_h.inst)
|
if (reinterpret_cast<PyObject *>(load_impl.loaded_v_h.inst) == sptsls_ptr->self) {
|
||||||
!= sptsls_ptr->self);
|
pybind11_fail("smart_holder_type_casters loaded_as_shared_ptr failure: "
|
||||||
|
"load_impl.loaded_v_h.inst == sptsls_ptr->self");
|
||||||
|
}
|
||||||
return std::shared_ptr<T>(
|
return std::shared_ptr<T>(
|
||||||
type_raw_ptr,
|
type_raw_ptr,
|
||||||
shared_ptr_trampoline_self_life_support(load_impl.loaded_v_h.inst));
|
shared_ptr_trampoline_self_life_support(load_impl.loaded_v_h.inst));
|
||||||
|
Loading…
Reference in New Issue
Block a user