renaming instance::owned to aaa_owned, to pin-point where it is used

parent e639c3a7
......@@ -392,7 +392,7 @@ PYBIND11_NOINLINE inline void instance::allocate_layout() {
#endif
nonsimple.status = reinterpret_cast<uint8_t *>(&nonsimple.values_and_holders[flags_at]);
}
owned = true;
aaa_owned = true;
}
PYBIND11_NOINLINE inline void instance::deallocate_layout() {
......@@ -518,20 +518,20 @@ public:
auto inst = reinterpret_steal<object>(make_new_instance(tinfo->type));
auto wrapper = reinterpret_cast<instance *>(inst.ptr());
wrapper->owned = false;
wrapper->aaa_owned = false;
void *&valueptr = values_and_holders(wrapper).begin()->xxx_value_ptr<void>(); // holder_type not available here.
switch (policy) {
case return_value_policy::automatic:
case return_value_policy::take_ownership:
valueptr = src;
wrapper->owned = true;
wrapper->aaa_owned = true;
break;
case return_value_policy::automatic_reference:
case return_value_policy::reference:
valueptr = src;
wrapper->owned = false;
wrapper->aaa_owned = false;
break;
case return_value_policy::copy:
......@@ -548,7 +548,7 @@ public:
type_name + " is non-copyable!");
#endif
}
wrapper->owned = true;
wrapper->aaa_owned = true;
break;
case return_value_policy::move:
......@@ -568,12 +568,12 @@ public:
type_name + " is neither movable nor copyable!");
#endif
}
wrapper->owned = true;
wrapper->aaa_owned = true;
break;
case return_value_policy::reference_internal:
valueptr = src;
wrapper->owned = false;
wrapper->aaa_owned = false;
keep_alive_impl(inst, parent);
break;
......
......@@ -340,7 +340,7 @@ inline PyObject *make_new_instance(PyTypeObject *type) {
// Allocate the value/holder internals:
inst->allocate_layout();
inst->owned = true;
inst->aaa_owned = true;
return self;
}
......@@ -398,7 +398,7 @@ inline void clear_instance(PyObject *self) {
if (v_h.instance_registered() && !deregister_instance(instance, v_h.xxx_value_ptr<void>(), v_h.type))
pybind11_fail("pybind11_object_dealloc(): Tried to deallocate unregistered instance!");
if (instance->owned || v_h.holder_constructed())
if (instance->aaa_owned || v_h.holder_constructed())
v_h.type->dealloc(v_h);
}
}
......
......@@ -426,7 +426,7 @@ struct instance {
/// Weak references
PyObject *weakrefs;
/// If true, the pointer is owned which means we're free to manage it with a holder.
bool owned : 1;
bool aaa_owned : 1;
/**
* An instance has two possible value/holder layouts.
*
......
......@@ -1464,7 +1464,7 @@ private:
}
} catch (const std::bad_weak_ptr &) {}
if (!v_h.holder_constructed() && inst->owned) {
if (!v_h.holder_constructed() && inst->aaa_owned) {
new (std::addressof(v_h.xxx_holder<holder_type>())) holder_type(v_h.xxx_value_ptr<type>()); // init_holder
v_h.set_holder_constructed();
}
......@@ -1486,7 +1486,7 @@ private:
if (holder_ptr) {
init_holder_from_existing(v_h, holder_ptr, std::is_copy_constructible<holder_type>());
v_h.set_holder_constructed();
} else if (inst->owned || detail::always_construct_holder<holder_type>::value) {
} else if (inst->aaa_owned || detail::always_construct_holder<holder_type>::value) {
new (std::addressof(v_h.xxx_holder<holder_type>())) holder_type(v_h.xxx_value_ptr<type>()); // init_holder
v_h.set_holder_constructed();
}
......@@ -1495,7 +1495,7 @@ private:
/// Performs instance initialization including constructing a holder and registering the known
/// instance. Should be called as soon as the `type` value_ptr is set for an instance. Takes an
/// optional pointer to an existing holder to use; if not specified and the instance is
/// `.owned`, a new holder will be constructed to manage the value pointer.
/// `.aaa_owned`, a new holder will be constructed to manage the value pointer.
static void init_instance(detail::instance *inst, const void *holder_ptr) {
auto v_h = inst->get_value_and_holder(detail::get_type_info(typeid(type)));
if (!v_h.instance_registered()) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment