Lines Matching defs:instance

34 /// `pybind11_static_property.__get__()`: Always pass the class instead of the instance.
46 methods are modified to always use the object type instead of a concrete instance.
144 * when called on a class, or a PyMethod, when called on an instance. Override that behaviour here
199 /// base classes with pointers that are difference from the instance value pointer so that we can
201 inline void traverse_offset_bases(void *valueptr, const detail::type_info *tinfo, instance *self,
202 bool (*f)(void * /*parentptr*/, instance * /*self*/)) {
218 inline bool register_instance_impl(void *ptr, instance *self) {
222 inline bool deregister_instance_impl(void *ptr, instance *self) {
234 inline void register_instance(instance *self, void *valptr, const type_info *tinfo) {
240 inline bool deregister_instance(instance *self, void *valptr, const type_info *tinfo) {
247 /// Instance creation function for all pybind11 types. It allocates the internal instance layout for
248 /// holding C++ objects and holders. Allocation is done lazily (the first time the instance is cast
254 ssize_t instance_size = static_cast<ssize_t>(sizeof(instance));
260 auto inst = reinterpret_cast<instance *>(self);
292 auto instance = reinterpret_cast<detail::instance *>(nurse);
293 instance->has_patients = true;
299 auto instance = reinterpret_cast<detail::instance *>(self);
308 instance->has_patients = false;
313 /// Clears all internal data from the instance and removes it from registered instances in
316 auto instance = reinterpret_cast<detail::instance *>(self);
319 for (auto &v_h : values_and_holders(instance)) {
324 if (v_h.instance_registered() && !deregister_instance(instance, v_h.value_ptr(), v_h.type))
325 pybind11_fail("pybind11_object_dealloc(): Tried to deallocate unregistered instance!");
327 if (instance->owned || v_h.holder_constructed())
332 instance->deallocate_layout();
334 if (instance->weakrefs)
341 if (instance->has_patients)
385 type->tp_basicsize = static_cast<ssize_t>(sizeof(instance));
393 type->tp_weaklistoffset = offsetof(instance, weakrefs);
405 /// dynamic_attr: Support for `d = instance.__dict__`.
414 /// dynamic_attr: Support for `instance.__dict__ = dict()`.
428 /// dynamic_attr: Allow the garbage collector to traverse the internal instance `__dict__`.
578 type->tp_basicsize = static_cast<ssize_t>(sizeof(instance));