|
|
@@ -458,31 +458,24 @@ PyObject *DTool_CreatePyInstanceTyped(void *local_this_in, Dtool_PyTypedObject &
|
|
|
Dtool_PyTypedObject *target_class = (Dtool_PyTypedObject *)TypeHandle::from_index(type_index).get_python_type();
|
|
|
if (target_class != nullptr) {
|
|
|
// cast to the type...
|
|
|
- void *new_local_this = target_class->_Dtool_DowncastInterface(local_this_in, &known_class_type);
|
|
|
- if (new_local_this != nullptr) {
|
|
|
- // ask class to allocate an instance..
|
|
|
- Dtool_PyInstDef *self = (Dtool_PyInstDef *) target_class->_PyType.tp_new(&target_class->_PyType, nullptr, nullptr);
|
|
|
- if (self != nullptr) {
|
|
|
- self->_ptr_to_object = new_local_this;
|
|
|
- self->_memory_rules = memory_rules;
|
|
|
- self->_is_const = is_const;
|
|
|
- // self->_signature = PY_PANDA_SIGNATURE;
|
|
|
- self->_My_Type = target_class;
|
|
|
- return (PyObject *)self;
|
|
|
- }
|
|
|
+ Dtool_PyInstDef *self = target_class->_Dtool_WrapInterface(local_this_in, &known_class_type);
|
|
|
+ if (self != nullptr) {
|
|
|
+ self->_memory_rules = memory_rules;
|
|
|
+ self->_is_const = is_const;
|
|
|
+ return (PyObject *)self;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
// if we get this far .. just wrap the thing in the known type ?? better
|
|
|
// than aborting...I guess....
|
|
|
- Dtool_PyInstDef *self = (Dtool_PyInstDef *) known_class_type._PyType.tp_new(&known_class_type._PyType, nullptr, nullptr);
|
|
|
+ Dtool_PyInstDef *self = (Dtool_PyInstDef *)PyType_GenericAlloc(&known_class_type._PyType, 0);
|
|
|
if (self != nullptr) {
|
|
|
+ self->_signature = PY_PANDA_SIGNATURE;
|
|
|
+ self->_My_Type = &known_class_type;
|
|
|
self->_ptr_to_object = local_this_in;
|
|
|
self->_memory_rules = memory_rules;
|
|
|
self->_is_const = is_const;
|
|
|
- // self->_signature = PY_PANDA_SIGNATURE;
|
|
|
- self->_My_Type = &known_class_type;
|
|
|
}
|
|
|
return (PyObject *)self;
|
|
|
}
|
|
|
@@ -497,13 +490,14 @@ PyObject *DTool_CreatePyInstance(void *local_this, Dtool_PyTypedObject &in_class
|
|
|
return Py_None;
|
|
|
}
|
|
|
|
|
|
- Dtool_PyTypedObject *classdef = &in_classdef;
|
|
|
- Dtool_PyInstDef *self = (Dtool_PyInstDef *) classdef->_PyType.tp_new(&classdef->_PyType, nullptr, nullptr);
|
|
|
+ Dtool_PyInstDef *self = (Dtool_PyInstDef *)PyType_GenericAlloc(&in_classdef._PyType, 0);
|
|
|
if (self != nullptr) {
|
|
|
+ self->_signature = PY_PANDA_SIGNATURE;
|
|
|
+ self->_My_Type = &in_classdef;
|
|
|
self->_ptr_to_object = local_this;
|
|
|
self->_memory_rules = memory_rules;
|
|
|
self->_is_const = is_const;
|
|
|
- self->_My_Type = classdef;
|
|
|
+ self->_My_Type = &in_classdef;
|
|
|
}
|
|
|
return (PyObject *)self;
|
|
|
}
|