git add -f bin/default/librpc/gen_ndr/*.{c,h,ndr,pidl} bin/default/source*/librpc...
[metze/samba/wip.git] / bin / default / librpc / gen_ndr / py_orpc.c
index 32507101b567f6c91888f324209bafcd2bb86f20..2a4a6e23eb420e385654c0f97f6371337967f554 100644 (file)
@@ -1,5 +1,6 @@
 
 /* Python wrapper functions auto-generated by pidl */
+#define PY_SSIZE_T_CLEAN 1 /* We use Py_ssize_t for PyArg_ParseTupleAndKeywords */
 #include <Python.h>
 #include "includes.h"
 #include <pytalloc.h>
@@ -9,7 +10,7 @@
 #include "bin/default/librpc/gen_ndr/ndr_orpc_c.h"
 
 /*
- * These functions are here to ensure they can be optomised out by
+ * These functions are here to ensure they can be optimized out by
  * the compiler based on the constant input values
  */
 
@@ -83,7 +84,7 @@ union OBJREF_Types *py_export_OBJREF_Types(TALLOC_CTX *mem_ctx, int level, PyObj
 static PyTypeObject OBJREF_Type;
 static PyTypeObject MInterfacePointer_Type;
 
-void initorpc(void);static PyTypeObject *Object_Type;
+void initorpc(void);static PyTypeObject *BaseObject_Type;
 static PyTypeObject *GUID_Type;
 
 static PyObject *py_COMVERSION_get_MajorVersion(PyObject *obj, void *closure)
@@ -97,6 +98,10 @@ static PyObject *py_COMVERSION_get_MajorVersion(PyObject *obj, void *closure)
 static int py_COMVERSION_set_MajorVersion(PyObject *py_obj, PyObject *value, void *closure)
 {
        struct COMVERSION *object = (struct COMVERSION *)pytalloc_get_ptr(py_obj);
+       if (value == NULL) {
+               PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->MajorVersion");
+               return -1;
+       }
        {
                const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->MajorVersion));
                if (PyLong_Check(value)) {
@@ -140,6 +145,10 @@ static PyObject *py_COMVERSION_get_MinorVersion(PyObject *obj, void *closure)
 static int py_COMVERSION_set_MinorVersion(PyObject *py_obj, PyObject *value, void *closure)
 {
        struct COMVERSION *object = (struct COMVERSION *)pytalloc_get_ptr(py_obj);
+       if (value == NULL) {
+               PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->MinorVersion");
+               return -1;
+       }
        {
                const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->MinorVersion));
                if (PyLong_Check(value)) {
@@ -173,9 +182,19 @@ static int py_COMVERSION_set_MinorVersion(PyObject *py_obj, PyObject *value, voi
 }
 
 static PyGetSetDef py_COMVERSION_getsetters[] = {
-       { discard_const_p(char, "MajorVersion"), py_COMVERSION_get_MajorVersion, py_COMVERSION_set_MajorVersion },
-       { discard_const_p(char, "MinorVersion"), py_COMVERSION_get_MinorVersion, py_COMVERSION_set_MinorVersion },
-       { NULL }
+       {
+               .name = discard_const_p(char, "MajorVersion"),
+               .get = py_COMVERSION_get_MajorVersion,
+               .set = py_COMVERSION_set_MajorVersion,
+               .doc = discard_const_p(char, "PIDL-generated element MajorVersion")
+       },
+       {
+               .name = discard_const_p(char, "MinorVersion"),
+               .get = py_COMVERSION_get_MinorVersion,
+               .set = py_COMVERSION_set_MinorVersion,
+               .doc = discard_const_p(char, "PIDL-generated element MinorVersion")
+       },
+       { .name = NULL }
 };
 
 static PyObject *py_COMVERSION_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
@@ -186,22 +205,31 @@ static PyObject *py_COMVERSION_new(PyTypeObject *type, PyObject *args, PyObject
 static PyObject *py_COMVERSION_ndr_pack(PyObject *py_obj)
 {
        struct COMVERSION *object = (struct COMVERSION *)pytalloc_get_ptr(py_obj);
+       PyObject *ret = NULL;
        DATA_BLOB blob;
        enum ndr_err_code err;
-       err = ndr_push_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_push_flags_fn_t)ndr_push_COMVERSION);
+       TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
+       if (tmp_ctx == NULL) {
+               PyErr_SetNdrError(NDR_ERR_ALLOC);
+               return NULL;
+       }
+       err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_COMVERSION);
        if (err != NDR_ERR_SUCCESS) {
+               TALLOC_FREE(tmp_ctx);
                PyErr_SetNdrError(err);
                return NULL;
        }
 
-       return PyString_FromStringAndSize((char *)blob.data, blob.length);
+       ret = PyString_FromStringAndSize((char *)blob.data, blob.length);
+       TALLOC_FREE(tmp_ctx);
+       return ret;
 }
 
 static PyObject *py_COMVERSION_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
 {
        struct COMVERSION *object = (struct COMVERSION *)pytalloc_get_ptr(py_obj);
        DATA_BLOB blob;
-       int blob_length = 0;
+       Py_ssize_t blob_length = 0;
        enum ndr_err_code err;
        const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
        PyObject *allow_remaining_obj = NULL;
@@ -259,7 +287,6 @@ static PyTypeObject COMVERSION_Type = {
        .tp_getset = py_COMVERSION_getsetters,
        .tp_methods = py_COMVERSION_methods,
        .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
-       .tp_basicsize = sizeof(pytalloc_Object),
        .tp_new = py_COMVERSION_new,
 };
 
@@ -275,6 +302,10 @@ static PyObject *py_ORPC_EXTENT_get_id(PyObject *obj, void *closure)
 static int py_ORPC_EXTENT_set_id(PyObject *py_obj, PyObject *value, void *closure)
 {
        struct ORPC_EXTENT *object = (struct ORPC_EXTENT *)pytalloc_get_ptr(py_obj);
+       if (value == NULL) {
+               PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->id");
+               return -1;
+       }
        PY_CHECK_TYPE(GUID_Type, value, return -1;);
        if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
                PyErr_NoMemory();
@@ -295,6 +326,10 @@ static PyObject *py_ORPC_EXTENT_get_size(PyObject *obj, void *closure)
 static int py_ORPC_EXTENT_set_size(PyObject *py_obj, PyObject *value, void *closure)
 {
        struct ORPC_EXTENT *object = (struct ORPC_EXTENT *)pytalloc_get_ptr(py_obj);
+       if (value == NULL) {
+               PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->size");
+               return -1;
+       }
        {
                const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->size));
                if (PyLong_Check(value)) {
@@ -349,6 +384,10 @@ static PyObject *py_ORPC_EXTENT_get_data(PyObject *obj, void *closure)
 static int py_ORPC_EXTENT_set_data(PyObject *py_obj, PyObject *value, void *closure)
 {
        struct ORPC_EXTENT *object = (struct ORPC_EXTENT *)pytalloc_get_ptr(py_obj);
+       if (value == NULL) {
+               PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->data");
+               return -1;
+       }
        PY_CHECK_TYPE(&PyList_Type, value, return -1;);
        {
                int data_cntr_0;
@@ -356,6 +395,10 @@ static int py_ORPC_EXTENT_set_data(PyObject *py_obj, PyObject *value, void *clos
                if (!object->data) { return -1;; }
                talloc_set_name_const(object->data, "ARRAY: object->data");
                for (data_cntr_0 = 0; data_cntr_0 < PyList_GET_SIZE(value); data_cntr_0++) {
+                       if (PyList_GET_ITEM(value, data_cntr_0) == NULL) {
+                               PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->data[data_cntr_0]");
+                               return -1;
+                       }
                        {
                                const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->data[data_cntr_0]));
                                if (PyLong_Check(PyList_GET_ITEM(value, data_cntr_0))) {
@@ -391,10 +434,25 @@ static int py_ORPC_EXTENT_set_data(PyObject *py_obj, PyObject *value, void *clos
 }
 
 static PyGetSetDef py_ORPC_EXTENT_getsetters[] = {
-       { discard_const_p(char, "id"), py_ORPC_EXTENT_get_id, py_ORPC_EXTENT_set_id },
-       { discard_const_p(char, "size"), py_ORPC_EXTENT_get_size, py_ORPC_EXTENT_set_size },
-       { discard_const_p(char, "data"), py_ORPC_EXTENT_get_data, py_ORPC_EXTENT_set_data },
-       { NULL }
+       {
+               .name = discard_const_p(char, "id"),
+               .get = py_ORPC_EXTENT_get_id,
+               .set = py_ORPC_EXTENT_set_id,
+               .doc = discard_const_p(char, "PIDL-generated element id")
+       },
+       {
+               .name = discard_const_p(char, "size"),
+               .get = py_ORPC_EXTENT_get_size,
+               .set = py_ORPC_EXTENT_set_size,
+               .doc = discard_const_p(char, "PIDL-generated element size")
+       },
+       {
+               .name = discard_const_p(char, "data"),
+               .get = py_ORPC_EXTENT_get_data,
+               .set = py_ORPC_EXTENT_set_data,
+               .doc = discard_const_p(char, "PIDL-generated element data")
+       },
+       { .name = NULL }
 };
 
 static PyObject *py_ORPC_EXTENT_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
@@ -405,22 +463,31 @@ static PyObject *py_ORPC_EXTENT_new(PyTypeObject *type, PyObject *args, PyObject
 static PyObject *py_ORPC_EXTENT_ndr_pack(PyObject *py_obj)
 {
        struct ORPC_EXTENT *object = (struct ORPC_EXTENT *)pytalloc_get_ptr(py_obj);
+       PyObject *ret = NULL;
        DATA_BLOB blob;
        enum ndr_err_code err;
-       err = ndr_push_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_push_flags_fn_t)ndr_push_ORPC_EXTENT);
+       TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
+       if (tmp_ctx == NULL) {
+               PyErr_SetNdrError(NDR_ERR_ALLOC);
+               return NULL;
+       }
+       err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_ORPC_EXTENT);
        if (err != NDR_ERR_SUCCESS) {
+               TALLOC_FREE(tmp_ctx);
                PyErr_SetNdrError(err);
                return NULL;
        }
 
-       return PyString_FromStringAndSize((char *)blob.data, blob.length);
+       ret = PyString_FromStringAndSize((char *)blob.data, blob.length);
+       TALLOC_FREE(tmp_ctx);
+       return ret;
 }
 
 static PyObject *py_ORPC_EXTENT_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
 {
        struct ORPC_EXTENT *object = (struct ORPC_EXTENT *)pytalloc_get_ptr(py_obj);
        DATA_BLOB blob;
-       int blob_length = 0;
+       Py_ssize_t blob_length = 0;
        enum ndr_err_code err;
        const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
        PyObject *allow_remaining_obj = NULL;
@@ -478,7 +545,6 @@ static PyTypeObject ORPC_EXTENT_Type = {
        .tp_getset = py_ORPC_EXTENT_getsetters,
        .tp_methods = py_ORPC_EXTENT_methods,
        .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
-       .tp_basicsize = sizeof(pytalloc_Object),
        .tp_new = py_ORPC_EXTENT_new,
 };
 
@@ -494,6 +560,10 @@ static PyObject *py_ORPC_EXTENT_ARRAY_get_size(PyObject *obj, void *closure)
 static int py_ORPC_EXTENT_ARRAY_set_size(PyObject *py_obj, PyObject *value, void *closure)
 {
        struct ORPC_EXTENT_ARRAY *object = (struct ORPC_EXTENT_ARRAY *)pytalloc_get_ptr(py_obj);
+       if (value == NULL) {
+               PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->size");
+               return -1;
+       }
        {
                const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->size));
                if (PyLong_Check(value)) {
@@ -537,6 +607,10 @@ static PyObject *py_ORPC_EXTENT_ARRAY_get_reserved(PyObject *obj, void *closure)
 static int py_ORPC_EXTENT_ARRAY_set_reserved(PyObject *py_obj, PyObject *value, void *closure)
 {
        struct ORPC_EXTENT_ARRAY *object = (struct ORPC_EXTENT_ARRAY *)pytalloc_get_ptr(py_obj);
+       if (value == NULL) {
+               PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->reserved");
+               return -1;
+       }
        {
                const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->reserved));
                if (PyLong_Check(value)) {
@@ -602,10 +676,18 @@ static int py_ORPC_EXTENT_ARRAY_set_extent(PyObject *py_obj, PyObject *value, vo
 {
        struct ORPC_EXTENT_ARRAY *object = (struct ORPC_EXTENT_ARRAY *)pytalloc_get_ptr(py_obj);
        talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->extent));
+       if (value == NULL) {
+               PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->extent");
+               return -1;
+       }
        if (value == Py_None) {
                object->extent = NULL;
        } else {
                object->extent = NULL;
+               if (value == NULL) {
+                       PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct *object->extent");
+                       return -1;
+               }
                PY_CHECK_TYPE(&PyList_Type, value, return -1;);
                {
                        int extent_cntr_1;
@@ -613,10 +695,18 @@ static int py_ORPC_EXTENT_ARRAY_set_extent(PyObject *py_obj, PyObject *value, vo
                        if (!object->extent) { return -1;; }
                        talloc_set_name_const(object->extent, "ARRAY: object->extent");
                        for (extent_cntr_1 = 0; extent_cntr_1 < PyList_GET_SIZE(value); extent_cntr_1++) {
+                               if (PyList_GET_ITEM(value, extent_cntr_1) == NULL) {
+                                       PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->extent[extent_cntr_1]");
+                                       return -1;
+                               }
                                if (PyList_GET_ITEM(value, extent_cntr_1) == Py_None) {
                                        object->extent[extent_cntr_1] = NULL;
                                } else {
                                        object->extent[extent_cntr_1] = NULL;
+                                       if (PyList_GET_ITEM(value, extent_cntr_1) == NULL) {
+                                               PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct *object->extent[extent_cntr_1]");
+                                               return -1;
+                                       }
                                        PY_CHECK_TYPE(&ORPC_EXTENT_Type, PyList_GET_ITEM(value, extent_cntr_1), return -1;);
                                        if (talloc_reference(object->extent, pytalloc_get_mem_ctx(PyList_GET_ITEM(value, extent_cntr_1))) == NULL) {
                                                PyErr_NoMemory();
@@ -631,10 +721,25 @@ static int py_ORPC_EXTENT_ARRAY_set_extent(PyObject *py_obj, PyObject *value, vo
 }
 
 static PyGetSetDef py_ORPC_EXTENT_ARRAY_getsetters[] = {
-       { discard_const_p(char, "size"), py_ORPC_EXTENT_ARRAY_get_size, py_ORPC_EXTENT_ARRAY_set_size },
-       { discard_const_p(char, "reserved"), py_ORPC_EXTENT_ARRAY_get_reserved, py_ORPC_EXTENT_ARRAY_set_reserved },
-       { discard_const_p(char, "extent"), py_ORPC_EXTENT_ARRAY_get_extent, py_ORPC_EXTENT_ARRAY_set_extent },
-       { NULL }
+       {
+               .name = discard_const_p(char, "size"),
+               .get = py_ORPC_EXTENT_ARRAY_get_size,
+               .set = py_ORPC_EXTENT_ARRAY_set_size,
+               .doc = discard_const_p(char, "PIDL-generated element size")
+       },
+       {
+               .name = discard_const_p(char, "reserved"),
+               .get = py_ORPC_EXTENT_ARRAY_get_reserved,
+               .set = py_ORPC_EXTENT_ARRAY_set_reserved,
+               .doc = discard_const_p(char, "PIDL-generated element reserved")
+       },
+       {
+               .name = discard_const_p(char, "extent"),
+               .get = py_ORPC_EXTENT_ARRAY_get_extent,
+               .set = py_ORPC_EXTENT_ARRAY_set_extent,
+               .doc = discard_const_p(char, "PIDL-generated element extent")
+       },
+       { .name = NULL }
 };
 
 static PyObject *py_ORPC_EXTENT_ARRAY_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
@@ -649,7 +754,6 @@ static PyTypeObject ORPC_EXTENT_ARRAY_Type = {
        .tp_getset = py_ORPC_EXTENT_ARRAY_getsetters,
        .tp_methods = NULL,
        .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
-       .tp_basicsize = sizeof(pytalloc_Object),
        .tp_new = py_ORPC_EXTENT_ARRAY_new,
 };
 
@@ -665,6 +769,10 @@ static PyObject *py_ORPCTHIS_get_version(PyObject *obj, void *closure)
 static int py_ORPCTHIS_set_version(PyObject *py_obj, PyObject *value, void *closure)
 {
        struct ORPCTHIS *object = (struct ORPCTHIS *)pytalloc_get_ptr(py_obj);
+       if (value == NULL) {
+               PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->version");
+               return -1;
+       }
        PY_CHECK_TYPE(&COMVERSION_Type, value, return -1;);
        if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
                PyErr_NoMemory();
@@ -685,6 +793,10 @@ static PyObject *py_ORPCTHIS_get_flags(PyObject *obj, void *closure)
 static int py_ORPCTHIS_set_flags(PyObject *py_obj, PyObject *value, void *closure)
 {
        struct ORPCTHIS *object = (struct ORPCTHIS *)pytalloc_get_ptr(py_obj);
+       if (value == NULL) {
+               PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->flags");
+               return -1;
+       }
        {
                const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->flags));
                if (PyLong_Check(value)) {
@@ -728,6 +840,10 @@ static PyObject *py_ORPCTHIS_get_reserved1(PyObject *obj, void *closure)
 static int py_ORPCTHIS_set_reserved1(PyObject *py_obj, PyObject *value, void *closure)
 {
        struct ORPCTHIS *object = (struct ORPCTHIS *)pytalloc_get_ptr(py_obj);
+       if (value == NULL) {
+               PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->reserved1");
+               return -1;
+       }
        {
                const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->reserved1));
                if (PyLong_Check(value)) {
@@ -771,6 +887,10 @@ static PyObject *py_ORPCTHIS_get_cid(PyObject *obj, void *closure)
 static int py_ORPCTHIS_set_cid(PyObject *py_obj, PyObject *value, void *closure)
 {
        struct ORPCTHIS *object = (struct ORPCTHIS *)pytalloc_get_ptr(py_obj);
+       if (value == NULL) {
+               PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->cid");
+               return -1;
+       }
        PY_CHECK_TYPE(GUID_Type, value, return -1;);
        if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
                PyErr_NoMemory();
@@ -797,10 +917,18 @@ static int py_ORPCTHIS_set_extensions(PyObject *py_obj, PyObject *value, void *c
 {
        struct ORPCTHIS *object = (struct ORPCTHIS *)pytalloc_get_ptr(py_obj);
        talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->extensions));
+       if (value == NULL) {
+               PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->extensions");
+               return -1;
+       }
        if (value == Py_None) {
                object->extensions = NULL;
        } else {
                object->extensions = NULL;
+               if (value == NULL) {
+                       PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct *object->extensions");
+                       return -1;
+               }
                PY_CHECK_TYPE(&ORPC_EXTENT_ARRAY_Type, value, return -1;);
                if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
                        PyErr_NoMemory();
@@ -812,12 +940,37 @@ static int py_ORPCTHIS_set_extensions(PyObject *py_obj, PyObject *value, void *c
 }
 
 static PyGetSetDef py_ORPCTHIS_getsetters[] = {
-       { discard_const_p(char, "version"), py_ORPCTHIS_get_version, py_ORPCTHIS_set_version },
-       { discard_const_p(char, "flags"), py_ORPCTHIS_get_flags, py_ORPCTHIS_set_flags },
-       { discard_const_p(char, "reserved1"), py_ORPCTHIS_get_reserved1, py_ORPCTHIS_set_reserved1 },
-       { discard_const_p(char, "cid"), py_ORPCTHIS_get_cid, py_ORPCTHIS_set_cid },
-       { discard_const_p(char, "extensions"), py_ORPCTHIS_get_extensions, py_ORPCTHIS_set_extensions },
-       { NULL }
+       {
+               .name = discard_const_p(char, "version"),
+               .get = py_ORPCTHIS_get_version,
+               .set = py_ORPCTHIS_set_version,
+               .doc = discard_const_p(char, "PIDL-generated element version")
+       },
+       {
+               .name = discard_const_p(char, "flags"),
+               .get = py_ORPCTHIS_get_flags,
+               .set = py_ORPCTHIS_set_flags,
+               .doc = discard_const_p(char, "PIDL-generated element flags")
+       },
+       {
+               .name = discard_const_p(char, "reserved1"),
+               .get = py_ORPCTHIS_get_reserved1,
+               .set = py_ORPCTHIS_set_reserved1,
+               .doc = discard_const_p(char, "PIDL-generated element reserved1")
+       },
+       {
+               .name = discard_const_p(char, "cid"),
+               .get = py_ORPCTHIS_get_cid,
+               .set = py_ORPCTHIS_set_cid,
+               .doc = discard_const_p(char, "PIDL-generated element cid")
+       },
+       {
+               .name = discard_const_p(char, "extensions"),
+               .get = py_ORPCTHIS_get_extensions,
+               .set = py_ORPCTHIS_set_extensions,
+               .doc = discard_const_p(char, "PIDL-generated element extensions")
+       },
+       { .name = NULL }
 };
 
 static PyObject *py_ORPCTHIS_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
@@ -828,22 +981,31 @@ static PyObject *py_ORPCTHIS_new(PyTypeObject *type, PyObject *args, PyObject *k
 static PyObject *py_ORPCTHIS_ndr_pack(PyObject *py_obj)
 {
        struct ORPCTHIS *object = (struct ORPCTHIS *)pytalloc_get_ptr(py_obj);
+       PyObject *ret = NULL;
        DATA_BLOB blob;
        enum ndr_err_code err;
-       err = ndr_push_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_push_flags_fn_t)ndr_push_ORPCTHIS);
+       TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
+       if (tmp_ctx == NULL) {
+               PyErr_SetNdrError(NDR_ERR_ALLOC);
+               return NULL;
+       }
+       err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_ORPCTHIS);
        if (err != NDR_ERR_SUCCESS) {
+               TALLOC_FREE(tmp_ctx);
                PyErr_SetNdrError(err);
                return NULL;
        }
 
-       return PyString_FromStringAndSize((char *)blob.data, blob.length);
+       ret = PyString_FromStringAndSize((char *)blob.data, blob.length);
+       TALLOC_FREE(tmp_ctx);
+       return ret;
 }
 
 static PyObject *py_ORPCTHIS_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
 {
        struct ORPCTHIS *object = (struct ORPCTHIS *)pytalloc_get_ptr(py_obj);
        DATA_BLOB blob;
-       int blob_length = 0;
+       Py_ssize_t blob_length = 0;
        enum ndr_err_code err;
        const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
        PyObject *allow_remaining_obj = NULL;
@@ -901,7 +1063,6 @@ static PyTypeObject ORPCTHIS_Type = {
        .tp_getset = py_ORPCTHIS_getsetters,
        .tp_methods = py_ORPCTHIS_methods,
        .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
-       .tp_basicsize = sizeof(pytalloc_Object),
        .tp_new = py_ORPCTHIS_new,
 };
 
@@ -917,6 +1078,10 @@ static PyObject *py_ORPCTHAT_get_flags(PyObject *obj, void *closure)
 static int py_ORPCTHAT_set_flags(PyObject *py_obj, PyObject *value, void *closure)
 {
        struct ORPCTHAT *object = (struct ORPCTHAT *)pytalloc_get_ptr(py_obj);
+       if (value == NULL) {
+               PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->flags");
+               return -1;
+       }
        {
                const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->flags));
                if (PyLong_Check(value)) {
@@ -966,10 +1131,18 @@ static int py_ORPCTHAT_set_extensions(PyObject *py_obj, PyObject *value, void *c
 {
        struct ORPCTHAT *object = (struct ORPCTHAT *)pytalloc_get_ptr(py_obj);
        talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->extensions));
+       if (value == NULL) {
+               PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->extensions");
+               return -1;
+       }
        if (value == Py_None) {
                object->extensions = NULL;
        } else {
                object->extensions = NULL;
+               if (value == NULL) {
+                       PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct *object->extensions");
+                       return -1;
+               }
                PY_CHECK_TYPE(&ORPC_EXTENT_ARRAY_Type, value, return -1;);
                if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
                        PyErr_NoMemory();
@@ -981,9 +1154,19 @@ static int py_ORPCTHAT_set_extensions(PyObject *py_obj, PyObject *value, void *c
 }
 
 static PyGetSetDef py_ORPCTHAT_getsetters[] = {
-       { discard_const_p(char, "flags"), py_ORPCTHAT_get_flags, py_ORPCTHAT_set_flags },
-       { discard_const_p(char, "extensions"), py_ORPCTHAT_get_extensions, py_ORPCTHAT_set_extensions },
-       { NULL }
+       {
+               .name = discard_const_p(char, "flags"),
+               .get = py_ORPCTHAT_get_flags,
+               .set = py_ORPCTHAT_set_flags,
+               .doc = discard_const_p(char, "PIDL-generated element flags")
+       },
+       {
+               .name = discard_const_p(char, "extensions"),
+               .get = py_ORPCTHAT_get_extensions,
+               .set = py_ORPCTHAT_set_extensions,
+               .doc = discard_const_p(char, "PIDL-generated element extensions")
+       },
+       { .name = NULL }
 };
 
 static PyObject *py_ORPCTHAT_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
@@ -994,22 +1177,31 @@ static PyObject *py_ORPCTHAT_new(PyTypeObject *type, PyObject *args, PyObject *k
 static PyObject *py_ORPCTHAT_ndr_pack(PyObject *py_obj)
 {
        struct ORPCTHAT *object = (struct ORPCTHAT *)pytalloc_get_ptr(py_obj);
+       PyObject *ret = NULL;
        DATA_BLOB blob;
        enum ndr_err_code err;
-       err = ndr_push_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_push_flags_fn_t)ndr_push_ORPCTHAT);
+       TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
+       if (tmp_ctx == NULL) {
+               PyErr_SetNdrError(NDR_ERR_ALLOC);
+               return NULL;
+       }
+       err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_ORPCTHAT);
        if (err != NDR_ERR_SUCCESS) {
+               TALLOC_FREE(tmp_ctx);
                PyErr_SetNdrError(err);
                return NULL;
        }
 
-       return PyString_FromStringAndSize((char *)blob.data, blob.length);
+       ret = PyString_FromStringAndSize((char *)blob.data, blob.length);
+       TALLOC_FREE(tmp_ctx);
+       return ret;
 }
 
 static PyObject *py_ORPCTHAT_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
 {
        struct ORPCTHAT *object = (struct ORPCTHAT *)pytalloc_get_ptr(py_obj);
        DATA_BLOB blob;
-       int blob_length = 0;
+       Py_ssize_t blob_length = 0;
        enum ndr_err_code err;
        const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
        PyObject *allow_remaining_obj = NULL;
@@ -1067,7 +1259,6 @@ static PyTypeObject ORPCTHAT_Type = {
        .tp_getset = py_ORPCTHAT_getsetters,
        .tp_methods = py_ORPCTHAT_methods,
        .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
-       .tp_basicsize = sizeof(pytalloc_Object),
        .tp_new = py_ORPCTHAT_new,
 };
 
@@ -1083,6 +1274,10 @@ static PyObject *py_STRINGBINDING_get_wTowerId(PyObject *obj, void *closure)
 static int py_STRINGBINDING_set_wTowerId(PyObject *py_obj, PyObject *value, void *closure)
 {
        struct STRINGBINDING *object = (struct STRINGBINDING *)pytalloc_get_ptr(py_obj);
+       if (value == NULL) {
+               PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->wTowerId");
+               return -1;
+       }
        {
                const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->wTowerId));
                if (PyLong_Check(value)) {
@@ -1126,14 +1321,54 @@ static PyObject *py_STRINGBINDING_get_NetworkAddr(PyObject *obj, void *closure)
 static int py_STRINGBINDING_set_NetworkAddr(PyObject *py_obj, PyObject *value, void *closure)
 {
        struct STRINGBINDING *object = (struct STRINGBINDING *)pytalloc_get_ptr(py_obj);
-       object->NetworkAddr = talloc_strdup(pytalloc_get_mem_ctx(py_obj), PyString_AS_STRING(value));
+       if (value == NULL) {
+               PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->NetworkAddr");
+               return -1;
+       }
+       {
+               const char *test_str;
+               const char *talloc_str;
+               PyObject *unicode = NULL;
+               if (PyUnicode_Check(value)) {
+                       unicode = PyUnicode_AsEncodedString(value, "utf-8", "ignore");
+                       if (unicode == NULL) {
+                               PyErr_NoMemory();
+                               return -1;
+                       }
+                       test_str = PyString_AS_STRING(unicode);
+               } else if (PyString_Check(value)) {
+                       test_str = PyString_AS_STRING(value);
+               } else {
+                       PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(value)->tp_name);
+                       return -1;
+               }
+               talloc_str = talloc_strdup(pytalloc_get_mem_ctx(py_obj), test_str);
+               if (unicode != NULL) {
+                       Py_DECREF(unicode);
+               }
+               if (talloc_str == NULL) {
+                       PyErr_NoMemory();
+                       return -1;
+               }
+               object->NetworkAddr = talloc_str;
+       }
        return 0;
 }
 
 static PyGetSetDef py_STRINGBINDING_getsetters[] = {
-       { discard_const_p(char, "wTowerId"), py_STRINGBINDING_get_wTowerId, py_STRINGBINDING_set_wTowerId },
-       { discard_const_p(char, "NetworkAddr"), py_STRINGBINDING_get_NetworkAddr, py_STRINGBINDING_set_NetworkAddr },
-       { NULL }
+       {
+               .name = discard_const_p(char, "wTowerId"),
+               .get = py_STRINGBINDING_get_wTowerId,
+               .set = py_STRINGBINDING_set_wTowerId,
+               .doc = discard_const_p(char, "PIDL-generated element wTowerId")
+       },
+       {
+               .name = discard_const_p(char, "NetworkAddr"),
+               .get = py_STRINGBINDING_get_NetworkAddr,
+               .set = py_STRINGBINDING_set_NetworkAddr,
+               .doc = discard_const_p(char, "PIDL-generated element NetworkAddr")
+       },
+       { .name = NULL }
 };
 
 static PyObject *py_STRINGBINDING_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
@@ -1144,22 +1379,31 @@ static PyObject *py_STRINGBINDING_new(PyTypeObject *type, PyObject *args, PyObje
 static PyObject *py_STRINGBINDING_ndr_pack(PyObject *py_obj)
 {
        struct STRINGBINDING *object = (struct STRINGBINDING *)pytalloc_get_ptr(py_obj);
+       PyObject *ret = NULL;
        DATA_BLOB blob;
        enum ndr_err_code err;
-       err = ndr_push_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_push_flags_fn_t)ndr_push_STRINGBINDING);
+       TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
+       if (tmp_ctx == NULL) {
+               PyErr_SetNdrError(NDR_ERR_ALLOC);
+               return NULL;
+       }
+       err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_STRINGBINDING);
        if (err != NDR_ERR_SUCCESS) {
+               TALLOC_FREE(tmp_ctx);
                PyErr_SetNdrError(err);
                return NULL;
        }
 
-       return PyString_FromStringAndSize((char *)blob.data, blob.length);
+       ret = PyString_FromStringAndSize((char *)blob.data, blob.length);
+       TALLOC_FREE(tmp_ctx);
+       return ret;
 }
 
 static PyObject *py_STRINGBINDING_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
 {
        struct STRINGBINDING *object = (struct STRINGBINDING *)pytalloc_get_ptr(py_obj);
        DATA_BLOB blob;
-       int blob_length = 0;
+       Py_ssize_t blob_length = 0;
        enum ndr_err_code err;
        const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
        PyObject *allow_remaining_obj = NULL;
@@ -1217,7 +1461,6 @@ static PyTypeObject STRINGBINDING_Type = {
        .tp_getset = py_STRINGBINDING_getsetters,
        .tp_methods = py_STRINGBINDING_methods,
        .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
-       .tp_basicsize = sizeof(pytalloc_Object),
        .tp_new = py_STRINGBINDING_new,
 };
 
@@ -1244,14 +1487,26 @@ static int py_STRINGARRAY_set_stringbindings(PyObject *py_obj, PyObject *value,
 {
        struct STRINGARRAY *object = (struct STRINGARRAY *)pytalloc_get_ptr(py_obj);
        talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->stringbindings));
+       if (value == NULL) {
+               PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->stringbindings");
+               return -1;
+       }
        if (value == Py_None) {
                object->stringbindings = NULL;
        } else {
                object->stringbindings = NULL;
+               if (value == NULL) {
+                       PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct *object->stringbindings");
+                       return -1;
+               }
                if (value == Py_None) {
                        *object->stringbindings = NULL;
                } else {
                        *object->stringbindings = NULL;
+                       if (value == NULL) {
+                               PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct **object->stringbindings");
+                               return -1;
+                       }
                        PY_CHECK_TYPE(&STRINGBINDING_Type, value, return -1;);
                        if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
                                PyErr_NoMemory();
@@ -1264,8 +1519,13 @@ static int py_STRINGARRAY_set_stringbindings(PyObject *py_obj, PyObject *value,
 }
 
 static PyGetSetDef py_STRINGARRAY_getsetters[] = {
-       { discard_const_p(char, "stringbindings"), py_STRINGARRAY_get_stringbindings, py_STRINGARRAY_set_stringbindings },
-       { NULL }
+       {
+               .name = discard_const_p(char, "stringbindings"),
+               .get = py_STRINGARRAY_get_stringbindings,
+               .set = py_STRINGARRAY_set_stringbindings,
+               .doc = discard_const_p(char, "PIDL-generated element stringbindings")
+       },
+       { .name = NULL }
 };
 
 static PyObject *py_STRINGARRAY_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
@@ -1276,22 +1536,31 @@ static PyObject *py_STRINGARRAY_new(PyTypeObject *type, PyObject *args, PyObject
 static PyObject *py_STRINGARRAY_ndr_pack(PyObject *py_obj)
 {
        struct STRINGARRAY *object = (struct STRINGARRAY *)pytalloc_get_ptr(py_obj);
+       PyObject *ret = NULL;
        DATA_BLOB blob;
        enum ndr_err_code err;
-       err = ndr_push_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_push_flags_fn_t)ndr_push_STRINGARRAY);
+       TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
+       if (tmp_ctx == NULL) {
+               PyErr_SetNdrError(NDR_ERR_ALLOC);
+               return NULL;
+       }
+       err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_STRINGARRAY);
        if (err != NDR_ERR_SUCCESS) {
+               TALLOC_FREE(tmp_ctx);
                PyErr_SetNdrError(err);
                return NULL;
        }
 
-       return PyString_FromStringAndSize((char *)blob.data, blob.length);
+       ret = PyString_FromStringAndSize((char *)blob.data, blob.length);
+       TALLOC_FREE(tmp_ctx);
+       return ret;
 }
 
 static PyObject *py_STRINGARRAY_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
 {
        struct STRINGARRAY *object = (struct STRINGARRAY *)pytalloc_get_ptr(py_obj);
        DATA_BLOB blob;
-       int blob_length = 0;
+       Py_ssize_t blob_length = 0;
        enum ndr_err_code err;
        const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
        PyObject *allow_remaining_obj = NULL;
@@ -1349,7 +1618,6 @@ static PyTypeObject STRINGARRAY_Type = {
        .tp_getset = py_STRINGARRAY_getsetters,
        .tp_methods = py_STRINGARRAY_methods,
        .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
-       .tp_basicsize = sizeof(pytalloc_Object),
        .tp_new = py_STRINGARRAY_new,
 };
 
@@ -1376,14 +1644,26 @@ static int py_DUALSTRINGARRAY_set_stringbindings(PyObject *py_obj, PyObject *val
 {
        struct DUALSTRINGARRAY *object = (struct DUALSTRINGARRAY *)pytalloc_get_ptr(py_obj);
        talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->stringbindings));
+       if (value == NULL) {
+               PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->stringbindings");
+               return -1;
+       }
        if (value == Py_None) {
                object->stringbindings = NULL;
        } else {
                object->stringbindings = NULL;
+               if (value == NULL) {
+                       PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct *object->stringbindings");
+                       return -1;
+               }
                if (value == Py_None) {
                        *object->stringbindings = NULL;
                } else {
                        *object->stringbindings = NULL;
+                       if (value == NULL) {
+                               PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct **object->stringbindings");
+                               return -1;
+                       }
                        PY_CHECK_TYPE(&STRINGBINDING_Type, value, return -1;);
                        if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
                                PyErr_NoMemory();
@@ -1417,14 +1697,26 @@ static int py_DUALSTRINGARRAY_set_securitybindings(PyObject *py_obj, PyObject *v
 {
        struct DUALSTRINGARRAY *object = (struct DUALSTRINGARRAY *)pytalloc_get_ptr(py_obj);
        talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->securitybindings));
+       if (value == NULL) {
+               PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->securitybindings");
+               return -1;
+       }
        if (value == Py_None) {
                object->securitybindings = NULL;
        } else {
                object->securitybindings = NULL;
+               if (value == NULL) {
+                       PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct *object->securitybindings");
+                       return -1;
+               }
                if (value == Py_None) {
                        *object->securitybindings = NULL;
                } else {
                        *object->securitybindings = NULL;
+                       if (value == NULL) {
+                               PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct **object->securitybindings");
+                               return -1;
+                       }
                        PY_CHECK_TYPE(&SECURITYBINDING_Type, value, return -1;);
                        if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
                                PyErr_NoMemory();
@@ -1437,9 +1729,19 @@ static int py_DUALSTRINGARRAY_set_securitybindings(PyObject *py_obj, PyObject *v
 }
 
 static PyGetSetDef py_DUALSTRINGARRAY_getsetters[] = {
-       { discard_const_p(char, "stringbindings"), py_DUALSTRINGARRAY_get_stringbindings, py_DUALSTRINGARRAY_set_stringbindings },
-       { discard_const_p(char, "securitybindings"), py_DUALSTRINGARRAY_get_securitybindings, py_DUALSTRINGARRAY_set_securitybindings },
-       { NULL }
+       {
+               .name = discard_const_p(char, "stringbindings"),
+               .get = py_DUALSTRINGARRAY_get_stringbindings,
+               .set = py_DUALSTRINGARRAY_set_stringbindings,
+               .doc = discard_const_p(char, "PIDL-generated element stringbindings")
+       },
+       {
+               .name = discard_const_p(char, "securitybindings"),
+               .get = py_DUALSTRINGARRAY_get_securitybindings,
+               .set = py_DUALSTRINGARRAY_set_securitybindings,
+               .doc = discard_const_p(char, "PIDL-generated element securitybindings")
+       },
+       { .name = NULL }
 };
 
 static PyObject *py_DUALSTRINGARRAY_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
@@ -1450,22 +1752,31 @@ static PyObject *py_DUALSTRINGARRAY_new(PyTypeObject *type, PyObject *args, PyOb
 static PyObject *py_DUALSTRINGARRAY_ndr_pack(PyObject *py_obj)
 {
        struct DUALSTRINGARRAY *object = (struct DUALSTRINGARRAY *)pytalloc_get_ptr(py_obj);
+       PyObject *ret = NULL;
        DATA_BLOB blob;
        enum ndr_err_code err;
-       err = ndr_push_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_push_flags_fn_t)ndr_push_DUALSTRINGARRAY);
+       TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
+       if (tmp_ctx == NULL) {
+               PyErr_SetNdrError(NDR_ERR_ALLOC);
+               return NULL;
+       }
+       err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_DUALSTRINGARRAY);
        if (err != NDR_ERR_SUCCESS) {
+               TALLOC_FREE(tmp_ctx);
                PyErr_SetNdrError(err);
                return NULL;
        }
 
-       return PyString_FromStringAndSize((char *)blob.data, blob.length);
+       ret = PyString_FromStringAndSize((char *)blob.data, blob.length);
+       TALLOC_FREE(tmp_ctx);
+       return ret;
 }
 
 static PyObject *py_DUALSTRINGARRAY_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
 {
        struct DUALSTRINGARRAY *object = (struct DUALSTRINGARRAY *)pytalloc_get_ptr(py_obj);
        DATA_BLOB blob;
-       int blob_length = 0;
+       Py_ssize_t blob_length = 0;
        enum ndr_err_code err;
        const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
        PyObject *allow_remaining_obj = NULL;
@@ -1523,7 +1834,6 @@ static PyTypeObject DUALSTRINGARRAY_Type = {
        .tp_getset = py_DUALSTRINGARRAY_getsetters,
        .tp_methods = py_DUALSTRINGARRAY_methods,
        .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
-       .tp_basicsize = sizeof(pytalloc_Object),
        .tp_new = py_DUALSTRINGARRAY_new,
 };
 
@@ -1539,6 +1849,10 @@ static PyObject *py_SECURITYBINDING_get_wAuthnSvc(PyObject *obj, void *closure)
 static int py_SECURITYBINDING_set_wAuthnSvc(PyObject *py_obj, PyObject *value, void *closure)
 {
        struct SECURITYBINDING *object = (struct SECURITYBINDING *)pytalloc_get_ptr(py_obj);
+       if (value == NULL) {
+               PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->wAuthnSvc");
+               return -1;
+       }
        {
                const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->wAuthnSvc));
                if (PyLong_Check(value)) {
@@ -1582,6 +1896,10 @@ static PyObject *py_SECURITYBINDING_get_wAuthzSvc(PyObject *obj, void *closure)
 static int py_SECURITYBINDING_set_wAuthzSvc(PyObject *py_obj, PyObject *value, void *closure)
 {
        struct SECURITYBINDING *object = (struct SECURITYBINDING *)pytalloc_get_ptr(py_obj);
+       if (value == NULL) {
+               PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->wAuthzSvc");
+               return -1;
+       }
        {
                const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->wAuthzSvc));
                if (PyLong_Check(value)) {
@@ -1625,15 +1943,60 @@ static PyObject *py_SECURITYBINDING_get_PrincName(PyObject *obj, void *closure)
 static int py_SECURITYBINDING_set_PrincName(PyObject *py_obj, PyObject *value, void *closure)
 {
        struct SECURITYBINDING *object = (struct SECURITYBINDING *)pytalloc_get_ptr(py_obj);
-       object->PrincName = talloc_strdup(pytalloc_get_mem_ctx(py_obj), PyString_AS_STRING(value));
+       if (value == NULL) {
+               PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->PrincName");
+               return -1;
+       }
+       {
+               const char *test_str;
+               const char *talloc_str;
+               PyObject *unicode = NULL;
+               if (PyUnicode_Check(value)) {
+                       unicode = PyUnicode_AsEncodedString(value, "utf-8", "ignore");
+                       if (unicode == NULL) {
+                               PyErr_NoMemory();
+                               return -1;
+                       }
+                       test_str = PyString_AS_STRING(unicode);
+               } else if (PyString_Check(value)) {
+                       test_str = PyString_AS_STRING(value);
+               } else {
+                       PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(value)->tp_name);
+                       return -1;
+               }
+               talloc_str = talloc_strdup(pytalloc_get_mem_ctx(py_obj), test_str);
+               if (unicode != NULL) {
+                       Py_DECREF(unicode);
+               }
+               if (talloc_str == NULL) {
+                       PyErr_NoMemory();
+                       return -1;
+               }
+               object->PrincName = talloc_str;
+       }
        return 0;
 }
 
 static PyGetSetDef py_SECURITYBINDING_getsetters[] = {
-       { discard_const_p(char, "wAuthnSvc"), py_SECURITYBINDING_get_wAuthnSvc, py_SECURITYBINDING_set_wAuthnSvc },
-       { discard_const_p(char, "wAuthzSvc"), py_SECURITYBINDING_get_wAuthzSvc, py_SECURITYBINDING_set_wAuthzSvc },
-       { discard_const_p(char, "PrincName"), py_SECURITYBINDING_get_PrincName, py_SECURITYBINDING_set_PrincName },
-       { NULL }
+       {
+               .name = discard_const_p(char, "wAuthnSvc"),
+               .get = py_SECURITYBINDING_get_wAuthnSvc,
+               .set = py_SECURITYBINDING_set_wAuthnSvc,
+               .doc = discard_const_p(char, "PIDL-generated element wAuthnSvc")
+       },
+       {
+               .name = discard_const_p(char, "wAuthzSvc"),
+               .get = py_SECURITYBINDING_get_wAuthzSvc,
+               .set = py_SECURITYBINDING_set_wAuthzSvc,
+               .doc = discard_const_p(char, "PIDL-generated element wAuthzSvc")
+       },
+       {
+               .name = discard_const_p(char, "PrincName"),
+               .get = py_SECURITYBINDING_get_PrincName,
+               .set = py_SECURITYBINDING_set_PrincName,
+               .doc = discard_const_p(char, "PIDL-generated element PrincName")
+       },
+       { .name = NULL }
 };
 
 static PyObject *py_SECURITYBINDING_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
@@ -1644,22 +2007,31 @@ static PyObject *py_SECURITYBINDING_new(PyTypeObject *type, PyObject *args, PyOb
 static PyObject *py_SECURITYBINDING_ndr_pack(PyObject *py_obj)
 {
        struct SECURITYBINDING *object = (struct SECURITYBINDING *)pytalloc_get_ptr(py_obj);
+       PyObject *ret = NULL;
        DATA_BLOB blob;
        enum ndr_err_code err;
-       err = ndr_push_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_push_flags_fn_t)ndr_push_SECURITYBINDING);
+       TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
+       if (tmp_ctx == NULL) {
+               PyErr_SetNdrError(NDR_ERR_ALLOC);
+               return NULL;
+       }
+       err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_SECURITYBINDING);
        if (err != NDR_ERR_SUCCESS) {
+               TALLOC_FREE(tmp_ctx);
                PyErr_SetNdrError(err);
                return NULL;
        }
 
-       return PyString_FromStringAndSize((char *)blob.data, blob.length);
+       ret = PyString_FromStringAndSize((char *)blob.data, blob.length);
+       TALLOC_FREE(tmp_ctx);
+       return ret;
 }
 
 static PyObject *py_SECURITYBINDING_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
 {
        struct SECURITYBINDING *object = (struct SECURITYBINDING *)pytalloc_get_ptr(py_obj);
        DATA_BLOB blob;
-       int blob_length = 0;
+       Py_ssize_t blob_length = 0;
        enum ndr_err_code err;
        const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
        PyObject *allow_remaining_obj = NULL;
@@ -1717,7 +2089,6 @@ static PyTypeObject SECURITYBINDING_Type = {
        .tp_getset = py_SECURITYBINDING_getsetters,
        .tp_methods = py_SECURITYBINDING_methods,
        .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
-       .tp_basicsize = sizeof(pytalloc_Object),
        .tp_new = py_SECURITYBINDING_new,
 };
 
@@ -1733,6 +2104,10 @@ static PyObject *py_STDOBJREF_get_flags(PyObject *obj, void *closure)
 static int py_STDOBJREF_set_flags(PyObject *py_obj, PyObject *value, void *closure)
 {
        struct STDOBJREF *object = (struct STDOBJREF *)pytalloc_get_ptr(py_obj);
+       if (value == NULL) {
+               PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->flags");
+               return -1;
+       }
        {
                const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->flags));
                if (PyLong_Check(value)) {
@@ -1776,6 +2151,10 @@ static PyObject *py_STDOBJREF_get_cPublicRefs(PyObject *obj, void *closure)
 static int py_STDOBJREF_set_cPublicRefs(PyObject *py_obj, PyObject *value, void *closure)
 {
        struct STDOBJREF *object = (struct STDOBJREF *)pytalloc_get_ptr(py_obj);
+       if (value == NULL) {
+               PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->cPublicRefs");
+               return -1;
+       }
        {
                const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->cPublicRefs));
                if (PyLong_Check(value)) {
@@ -1819,6 +2198,10 @@ static PyObject *py_STDOBJREF_get_oxid(PyObject *obj, void *closure)
 static int py_STDOBJREF_set_oxid(PyObject *py_obj, PyObject *value, void *closure)
 {
        struct STDOBJREF *object = (struct STDOBJREF *)pytalloc_get_ptr(py_obj);
+       if (value == NULL) {
+               PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->oxid");
+               return -1;
+       }
        {
                const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->oxid));
                if (PyLong_Check(value)) {
@@ -1862,6 +2245,10 @@ static PyObject *py_STDOBJREF_get_oid(PyObject *obj, void *closure)
 static int py_STDOBJREF_set_oid(PyObject *py_obj, PyObject *value, void *closure)
 {
        struct STDOBJREF *object = (struct STDOBJREF *)pytalloc_get_ptr(py_obj);
+       if (value == NULL) {
+               PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->oid");
+               return -1;
+       }
        {
                const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->oid));
                if (PyLong_Check(value)) {
@@ -1905,6 +2292,10 @@ static PyObject *py_STDOBJREF_get_ipid(PyObject *obj, void *closure)
 static int py_STDOBJREF_set_ipid(PyObject *py_obj, PyObject *value, void *closure)
 {
        struct STDOBJREF *object = (struct STDOBJREF *)pytalloc_get_ptr(py_obj);
+       if (value == NULL) {
+               PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->ipid");
+               return -1;
+       }
        PY_CHECK_TYPE(GUID_Type, value, return -1;);
        if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
                PyErr_NoMemory();
@@ -1915,12 +2306,37 @@ static int py_STDOBJREF_set_ipid(PyObject *py_obj, PyObject *value, void *closur
 }
 
 static PyGetSetDef py_STDOBJREF_getsetters[] = {
-       { discard_const_p(char, "flags"), py_STDOBJREF_get_flags, py_STDOBJREF_set_flags },
-       { discard_const_p(char, "cPublicRefs"), py_STDOBJREF_get_cPublicRefs, py_STDOBJREF_set_cPublicRefs },
-       { discard_const_p(char, "oxid"), py_STDOBJREF_get_oxid, py_STDOBJREF_set_oxid },
-       { discard_const_p(char, "oid"), py_STDOBJREF_get_oid, py_STDOBJREF_set_oid },
-       { discard_const_p(char, "ipid"), py_STDOBJREF_get_ipid, py_STDOBJREF_set_ipid },
-       { NULL }
+       {
+               .name = discard_const_p(char, "flags"),
+               .get = py_STDOBJREF_get_flags,
+               .set = py_STDOBJREF_set_flags,
+               .doc = discard_const_p(char, "PIDL-generated element flags")
+       },
+       {
+               .name = discard_const_p(char, "cPublicRefs"),
+               .get = py_STDOBJREF_get_cPublicRefs,
+               .set = py_STDOBJREF_set_cPublicRefs,
+               .doc = discard_const_p(char, "PIDL-generated element cPublicRefs")
+       },
+       {
+               .name = discard_const_p(char, "oxid"),
+               .get = py_STDOBJREF_get_oxid,
+               .set = py_STDOBJREF_set_oxid,
+               .doc = discard_const_p(char, "PIDL-generated element oxid")
+       },
+       {
+               .name = discard_const_p(char, "oid"),
+               .get = py_STDOBJREF_get_oid,
+               .set = py_STDOBJREF_set_oid,
+               .doc = discard_const_p(char, "PIDL-generated element oid")
+       },
+       {
+               .name = discard_const_p(char, "ipid"),
+               .get = py_STDOBJREF_get_ipid,
+               .set = py_STDOBJREF_set_ipid,
+               .doc = discard_const_p(char, "PIDL-generated element ipid")
+       },
+       { .name = NULL }
 };
 
 static PyObject *py_STDOBJREF_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
@@ -1931,22 +2347,31 @@ static PyObject *py_STDOBJREF_new(PyTypeObject *type, PyObject *args, PyObject *
 static PyObject *py_STDOBJREF_ndr_pack(PyObject *py_obj)
 {
        struct STDOBJREF *object = (struct STDOBJREF *)pytalloc_get_ptr(py_obj);
+       PyObject *ret = NULL;
        DATA_BLOB blob;
        enum ndr_err_code err;
-       err = ndr_push_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_push_flags_fn_t)ndr_push_STDOBJREF);
+       TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
+       if (tmp_ctx == NULL) {
+               PyErr_SetNdrError(NDR_ERR_ALLOC);
+               return NULL;
+       }
+       err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_STDOBJREF);
        if (err != NDR_ERR_SUCCESS) {
+               TALLOC_FREE(tmp_ctx);
                PyErr_SetNdrError(err);
                return NULL;
        }
 
-       return PyString_FromStringAndSize((char *)blob.data, blob.length);
+       ret = PyString_FromStringAndSize((char *)blob.data, blob.length);
+       TALLOC_FREE(tmp_ctx);
+       return ret;
 }
 
 static PyObject *py_STDOBJREF_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
 {
        struct STDOBJREF *object = (struct STDOBJREF *)pytalloc_get_ptr(py_obj);
        DATA_BLOB blob;
-       int blob_length = 0;
+       Py_ssize_t blob_length = 0;
        enum ndr_err_code err;
        const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
        PyObject *allow_remaining_obj = NULL;
@@ -2004,7 +2429,6 @@ static PyTypeObject STDOBJREF_Type = {
        .tp_getset = py_STDOBJREF_getsetters,
        .tp_methods = py_STDOBJREF_methods,
        .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
-       .tp_basicsize = sizeof(pytalloc_Object),
        .tp_new = py_STDOBJREF_new,
 };
 
@@ -2020,6 +2444,10 @@ static PyObject *py_u_standard_get_std(PyObject *obj, void *closure)
 static int py_u_standard_set_std(PyObject *py_obj, PyObject *value, void *closure)
 {
        struct u_standard *object = (struct u_standard *)pytalloc_get_ptr(py_obj);
+       if (value == NULL) {
+               PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->std");
+               return -1;
+       }
        PY_CHECK_TYPE(&STDOBJREF_Type, value, return -1;);
        if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
                PyErr_NoMemory();
@@ -2040,6 +2468,10 @@ static PyObject *py_u_standard_get_saResAddr(PyObject *obj, void *closure)
 static int py_u_standard_set_saResAddr(PyObject *py_obj, PyObject *value, void *closure)
 {
        struct u_standard *object = (struct u_standard *)pytalloc_get_ptr(py_obj);
+       if (value == NULL) {
+               PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->saResAddr");
+               return -1;
+       }
        PY_CHECK_TYPE(&STRINGARRAY_Type, value, return -1;);
        if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
                PyErr_NoMemory();
@@ -2050,9 +2482,19 @@ static int py_u_standard_set_saResAddr(PyObject *py_obj, PyObject *value, void *
 }
 
 static PyGetSetDef py_u_standard_getsetters[] = {
-       { discard_const_p(char, "std"), py_u_standard_get_std, py_u_standard_set_std },
-       { discard_const_p(char, "saResAddr"), py_u_standard_get_saResAddr, py_u_standard_set_saResAddr },
-       { NULL }
+       {
+               .name = discard_const_p(char, "std"),
+               .get = py_u_standard_get_std,
+               .set = py_u_standard_set_std,
+               .doc = discard_const_p(char, "PIDL-generated element std")
+       },
+       {
+               .name = discard_const_p(char, "saResAddr"),
+               .get = py_u_standard_get_saResAddr,
+               .set = py_u_standard_set_saResAddr,
+               .doc = discard_const_p(char, "PIDL-generated element saResAddr")
+       },
+       { .name = NULL }
 };
 
 static PyObject *py_u_standard_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
@@ -2067,7 +2509,6 @@ static PyTypeObject u_standard_Type = {
        .tp_getset = py_u_standard_getsetters,
        .tp_methods = NULL,
        .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
-       .tp_basicsize = sizeof(pytalloc_Object),
        .tp_new = py_u_standard_new,
 };
 
@@ -2083,6 +2524,10 @@ static PyObject *py_u_handler_get_std(PyObject *obj, void *closure)
 static int py_u_handler_set_std(PyObject *py_obj, PyObject *value, void *closure)
 {
        struct u_handler *object = (struct u_handler *)pytalloc_get_ptr(py_obj);
+       if (value == NULL) {
+               PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->std");
+               return -1;
+       }
        PY_CHECK_TYPE(&STDOBJREF_Type, value, return -1;);
        if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
                PyErr_NoMemory();
@@ -2103,6 +2548,10 @@ static PyObject *py_u_handler_get_clsid(PyObject *obj, void *closure)
 static int py_u_handler_set_clsid(PyObject *py_obj, PyObject *value, void *closure)
 {
        struct u_handler *object = (struct u_handler *)pytalloc_get_ptr(py_obj);
+       if (value == NULL) {
+               PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->clsid");
+               return -1;
+       }
        PY_CHECK_TYPE(GUID_Type, value, return -1;);
        if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
                PyErr_NoMemory();
@@ -2123,6 +2572,10 @@ static PyObject *py_u_handler_get_saResAddr(PyObject *obj, void *closure)
 static int py_u_handler_set_saResAddr(PyObject *py_obj, PyObject *value, void *closure)
 {
        struct u_handler *object = (struct u_handler *)pytalloc_get_ptr(py_obj);
+       if (value == NULL) {
+               PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->saResAddr");
+               return -1;
+       }
        PY_CHECK_TYPE(&STRINGARRAY_Type, value, return -1;);
        if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
                PyErr_NoMemory();
@@ -2133,10 +2586,25 @@ static int py_u_handler_set_saResAddr(PyObject *py_obj, PyObject *value, void *c
 }
 
 static PyGetSetDef py_u_handler_getsetters[] = {
-       { discard_const_p(char, "std"), py_u_handler_get_std, py_u_handler_set_std },
-       { discard_const_p(char, "clsid"), py_u_handler_get_clsid, py_u_handler_set_clsid },
-       { discard_const_p(char, "saResAddr"), py_u_handler_get_saResAddr, py_u_handler_set_saResAddr },
-       { NULL }
+       {
+               .name = discard_const_p(char, "std"),
+               .get = py_u_handler_get_std,
+               .set = py_u_handler_set_std,
+               .doc = discard_const_p(char, "PIDL-generated element std")
+       },
+       {
+               .name = discard_const_p(char, "clsid"),
+               .get = py_u_handler_get_clsid,
+               .set = py_u_handler_set_clsid,
+               .doc = discard_const_p(char, "PIDL-generated element clsid")
+       },
+       {
+               .name = discard_const_p(char, "saResAddr"),
+               .get = py_u_handler_get_saResAddr,
+               .set = py_u_handler_set_saResAddr,
+               .doc = discard_const_p(char, "PIDL-generated element saResAddr")
+       },
+       { .name = NULL }
 };
 
 static PyObject *py_u_handler_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
@@ -2151,7 +2619,6 @@ static PyTypeObject u_handler_Type = {
        .tp_getset = py_u_handler_getsetters,
        .tp_methods = NULL,
        .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
-       .tp_basicsize = sizeof(pytalloc_Object),
        .tp_new = py_u_handler_new,
 };
 
@@ -2167,6 +2634,10 @@ static PyObject *py_u_custom_get_clsid(PyObject *obj, void *closure)
 static int py_u_custom_set_clsid(PyObject *py_obj, PyObject *value, void *closure)
 {
        struct u_custom *object = (struct u_custom *)pytalloc_get_ptr(py_obj);
+       if (value == NULL) {
+               PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->clsid");
+               return -1;
+       }
        PY_CHECK_TYPE(GUID_Type, value, return -1;);
        if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
                PyErr_NoMemory();
@@ -2187,6 +2658,10 @@ static PyObject *py_u_custom_get_cbExtension(PyObject *obj, void *closure)
 static int py_u_custom_set_cbExtension(PyObject *py_obj, PyObject *value, void *closure)
 {
        struct u_custom *object = (struct u_custom *)pytalloc_get_ptr(py_obj);
+       if (value == NULL) {
+               PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->cbExtension");
+               return -1;
+       }
        {
                const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->cbExtension));
                if (PyLong_Check(value)) {
@@ -2230,6 +2705,10 @@ static PyObject *py_u_custom_get_size(PyObject *obj, void *closure)
 static int py_u_custom_set_size(PyObject *py_obj, PyObject *value, void *closure)
 {
        struct u_custom *object = (struct u_custom *)pytalloc_get_ptr(py_obj);
+       if (value == NULL) {
+               PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->size");
+               return -1;
+       }
        {
                const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->size));
                if (PyLong_Check(value)) {
@@ -2284,6 +2763,10 @@ static PyObject *py_u_custom_get_pData(PyObject *obj, void *closure)
 static int py_u_custom_set_pData(PyObject *py_obj, PyObject *value, void *closure)
 {
        struct u_custom *object = (struct u_custom *)pytalloc_get_ptr(py_obj);
+       if (value == NULL) {
+               PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->pData");
+               return -1;
+       }
        PY_CHECK_TYPE(&PyList_Type, value, return -1;);
        {
                int pData_cntr_0;
@@ -2291,6 +2774,10 @@ static int py_u_custom_set_pData(PyObject *py_obj, PyObject *value, void *closur
                if (!object->pData) { return -1;; }
                talloc_set_name_const(object->pData, "ARRAY: object->pData");
                for (pData_cntr_0 = 0; pData_cntr_0 < PyList_GET_SIZE(value); pData_cntr_0++) {
+                       if (PyList_GET_ITEM(value, pData_cntr_0) == NULL) {
+                               PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->pData[pData_cntr_0]");
+                               return -1;
+                       }
                        {
                                const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->pData[pData_cntr_0]));
                                if (PyLong_Check(PyList_GET_ITEM(value, pData_cntr_0))) {
@@ -2326,11 +2813,31 @@ static int py_u_custom_set_pData(PyObject *py_obj, PyObject *value, void *closur
 }
 
 static PyGetSetDef py_u_custom_getsetters[] = {
-       { discard_const_p(char, "clsid"), py_u_custom_get_clsid, py_u_custom_set_clsid },
-       { discard_const_p(char, "cbExtension"), py_u_custom_get_cbExtension, py_u_custom_set_cbExtension },
-       { discard_const_p(char, "size"), py_u_custom_get_size, py_u_custom_set_size },
-       { discard_const_p(char, "pData"), py_u_custom_get_pData, py_u_custom_set_pData },
-       { NULL }
+       {
+               .name = discard_const_p(char, "clsid"),
+               .get = py_u_custom_get_clsid,
+               .set = py_u_custom_set_clsid,
+               .doc = discard_const_p(char, "PIDL-generated element clsid")
+       },
+       {
+               .name = discard_const_p(char, "cbExtension"),
+               .get = py_u_custom_get_cbExtension,
+               .set = py_u_custom_set_cbExtension,
+               .doc = discard_const_p(char, "PIDL-generated element cbExtension")
+       },
+       {
+               .name = discard_const_p(char, "size"),
+               .get = py_u_custom_get_size,
+               .set = py_u_custom_set_size,
+               .doc = discard_const_p(char, "PIDL-generated element size")
+       },
+       {
+               .name = discard_const_p(char, "pData"),
+               .get = py_u_custom_get_pData,
+               .set = py_u_custom_set_pData,
+               .doc = discard_const_p(char, "PIDL-generated element pData")
+       },
+       { .name = NULL }
 };
 
 static PyObject *py_u_custom_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
@@ -2345,7 +2852,6 @@ static PyTypeObject u_custom_Type = {
        .tp_getset = py_u_custom_getsetters,
        .tp_methods = NULL,
        .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
-       .tp_basicsize = sizeof(pytalloc_Object),
        .tp_new = py_u_custom_new,
 };
 
@@ -2362,7 +2868,6 @@ static PyTypeObject u_null_Type = {
        .tp_getset = NULL,
        .tp_methods = NULL,
        .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
-       .tp_basicsize = sizeof(pytalloc_Object),
        .tp_new = py_u_null_new,
 };
 
@@ -2397,6 +2902,10 @@ union OBJREF_Types *py_export_OBJREF_Types(TALLOC_CTX *mem_ctx, int level, PyObj
        union OBJREF_Types *ret = talloc_zero(mem_ctx, union OBJREF_Types);
        switch (level) {
                case OBJREF_NULL:
+                       if (in == NULL) {
+                               PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct ret->u_null");
+                               talloc_free(ret); return NULL;
+                       }
                        PY_CHECK_TYPE(&u_null_Type, in, talloc_free(ret); return NULL;);
                        if (talloc_reference(mem_ctx, pytalloc_get_mem_ctx(in)) == NULL) {
                                PyErr_NoMemory();
@@ -2406,6 +2915,10 @@ union OBJREF_Types *py_export_OBJREF_Types(TALLOC_CTX *mem_ctx, int level, PyObj
                        break;
 
                case OBJREF_STANDARD:
+                       if (in == NULL) {
+                               PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct ret->u_standard");
+                               talloc_free(ret); return NULL;
+                       }
                        PY_CHECK_TYPE(&u_standard_Type, in, talloc_free(ret); return NULL;);
                        if (talloc_reference(mem_ctx, pytalloc_get_mem_ctx(in)) == NULL) {
                                PyErr_NoMemory();
@@ -2415,6 +2928,10 @@ union OBJREF_Types *py_export_OBJREF_Types(TALLOC_CTX *mem_ctx, int level, PyObj
                        break;
 
                case OBJREF_HANDLER:
+                       if (in == NULL) {
+                               PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct ret->u_handler");
+                               talloc_free(ret); return NULL;
+                       }
                        PY_CHECK_TYPE(&u_handler_Type, in, talloc_free(ret); return NULL;);
                        if (talloc_reference(mem_ctx, pytalloc_get_mem_ctx(in)) == NULL) {
                                PyErr_NoMemory();
@@ -2424,6 +2941,10 @@ union OBJREF_Types *py_export_OBJREF_Types(TALLOC_CTX *mem_ctx, int level, PyObj
                        break;
 
                case OBJREF_CUSTOM:
+                       if (in == NULL) {
+                               PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct ret->u_custom");
+                               talloc_free(ret); return NULL;
+                       }
                        PY_CHECK_TYPE(&u_custom_Type, in, talloc_free(ret); return NULL;);
                        if (talloc_reference(mem_ctx, pytalloc_get_mem_ctx(in)) == NULL) {
                                PyErr_NoMemory();
@@ -2453,6 +2974,10 @@ static PyObject *py_OBJREF_get_signature(PyObject *obj, void *closure)
 static int py_OBJREF_set_signature(PyObject *py_obj, PyObject *value, void *closure)
 {
        struct OBJREF *object = (struct OBJREF *)pytalloc_get_ptr(py_obj);
+       if (value == NULL) {
+               PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->signature");
+               return -1;
+       }
        {
                const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->signature));
                if (PyLong_Check(value)) {
@@ -2496,6 +3021,10 @@ static PyObject *py_OBJREF_get_flags(PyObject *obj, void *closure)
 static int py_OBJREF_set_flags(PyObject *py_obj, PyObject *value, void *closure)
 {
        struct OBJREF *object = (struct OBJREF *)pytalloc_get_ptr(py_obj);
+       if (value == NULL) {
+               PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->flags");
+               return -1;
+       }
        {
                const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->flags));
                if (PyLong_Check(value)) {
@@ -2539,6 +3068,10 @@ static PyObject *py_OBJREF_get_iid(PyObject *obj, void *closure)
 static int py_OBJREF_set_iid(PyObject *py_obj, PyObject *value, void *closure)
 {
        struct OBJREF *object = (struct OBJREF *)pytalloc_get_ptr(py_obj);
+       if (value == NULL) {
+               PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->iid");
+               return -1;
+       }
        PY_CHECK_TYPE(GUID_Type, value, return -1;);
        if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
                PyErr_NoMemory();
@@ -2562,6 +3095,10 @@ static PyObject *py_OBJREF_get_u_objref(PyObject *obj, void *closure)
 static int py_OBJREF_set_u_objref(PyObject *py_obj, PyObject *value, void *closure)
 {
        struct OBJREF *object = (struct OBJREF *)pytalloc_get_ptr(py_obj);
+       if (value == NULL) {
+               PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->u_objref");
+               return -1;
+       }
        {
                union OBJREF_Types *u_objref_switch_0;
                u_objref_switch_0 = py_export_OBJREF_Types(pytalloc_get_mem_ctx(py_obj), object->flags, value);
@@ -2574,11 +3111,31 @@ static int py_OBJREF_set_u_objref(PyObject *py_obj, PyObject *value, void *closu
 }
 
 static PyGetSetDef py_OBJREF_getsetters[] = {
-       { discard_const_p(char, "signature"), py_OBJREF_get_signature, py_OBJREF_set_signature },
-       { discard_const_p(char, "flags"), py_OBJREF_get_flags, py_OBJREF_set_flags },
-       { discard_const_p(char, "iid"), py_OBJREF_get_iid, py_OBJREF_set_iid },
-       { discard_const_p(char, "u_objref"), py_OBJREF_get_u_objref, py_OBJREF_set_u_objref },
-       { NULL }
+       {
+               .name = discard_const_p(char, "signature"),
+               .get = py_OBJREF_get_signature,
+               .set = py_OBJREF_set_signature,
+               .doc = discard_const_p(char, "PIDL-generated element signature")
+       },
+       {
+               .name = discard_const_p(char, "flags"),
+               .get = py_OBJREF_get_flags,
+               .set = py_OBJREF_set_flags,
+               .doc = discard_const_p(char, "PIDL-generated element flags")
+       },
+       {
+               .name = discard_const_p(char, "iid"),
+               .get = py_OBJREF_get_iid,
+               .set = py_OBJREF_set_iid,
+               .doc = discard_const_p(char, "PIDL-generated element iid")
+       },
+       {
+               .name = discard_const_p(char, "u_objref"),
+               .get = py_OBJREF_get_u_objref,
+               .set = py_OBJREF_set_u_objref,
+               .doc = discard_const_p(char, "PIDL-generated element u_objref")
+       },
+       { .name = NULL }
 };
 
 static PyObject *py_OBJREF_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
@@ -2589,22 +3146,31 @@ static PyObject *py_OBJREF_new(PyTypeObject *type, PyObject *args, PyObject *kwa
 static PyObject *py_OBJREF_ndr_pack(PyObject *py_obj)
 {
        struct OBJREF *object = (struct OBJREF *)pytalloc_get_ptr(py_obj);
+       PyObject *ret = NULL;
        DATA_BLOB blob;
        enum ndr_err_code err;
-       err = ndr_push_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_push_flags_fn_t)ndr_push_OBJREF);
+       TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
+       if (tmp_ctx == NULL) {
+               PyErr_SetNdrError(NDR_ERR_ALLOC);
+               return NULL;
+       }
+       err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_OBJREF);
        if (err != NDR_ERR_SUCCESS) {
+               TALLOC_FREE(tmp_ctx);
                PyErr_SetNdrError(err);
                return NULL;
        }
 
-       return PyString_FromStringAndSize((char *)blob.data, blob.length);
+       ret = PyString_FromStringAndSize((char *)blob.data, blob.length);
+       TALLOC_FREE(tmp_ctx);
+       return ret;
 }
 
 static PyObject *py_OBJREF_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
 {
        struct OBJREF *object = (struct OBJREF *)pytalloc_get_ptr(py_obj);
        DATA_BLOB blob;
-       int blob_length = 0;
+       Py_ssize_t blob_length = 0;
        enum ndr_err_code err;
        const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
        PyObject *allow_remaining_obj = NULL;
@@ -2662,7 +3228,6 @@ static PyTypeObject OBJREF_Type = {
        .tp_getset = py_OBJREF_getsetters,
        .tp_methods = py_OBJREF_methods,
        .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
-       .tp_basicsize = sizeof(pytalloc_Object),
        .tp_new = py_OBJREF_new,
 };
 
@@ -2678,6 +3243,10 @@ static PyObject *py_MInterfacePointer_get_size(PyObject *obj, void *closure)
 static int py_MInterfacePointer_set_size(PyObject *py_obj, PyObject *value, void *closure)
 {
        struct MInterfacePointer *object = (struct MInterfacePointer *)pytalloc_get_ptr(py_obj);
+       if (value == NULL) {
+               PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->size");
+               return -1;
+       }
        {
                const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->size));
                if (PyLong_Check(value)) {
@@ -2721,6 +3290,14 @@ static PyObject *py_MInterfacePointer_get_obj(PyObject *obj, void *closure)
 static int py_MInterfacePointer_set_obj(PyObject *py_obj, PyObject *value, void *closure)
 {
        struct MInterfacePointer *object = (struct MInterfacePointer *)pytalloc_get_ptr(py_obj);
+       if (value == NULL) {
+               PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->obj");
+               return -1;
+       }
+       if (value == NULL) {
+               PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->obj");
+               return -1;
+       }
        PY_CHECK_TYPE(&OBJREF_Type, value, return -1;);
        if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
                PyErr_NoMemory();
@@ -2731,9 +3308,19 @@ static int py_MInterfacePointer_set_obj(PyObject *py_obj, PyObject *value, void
 }
 
 static PyGetSetDef py_MInterfacePointer_getsetters[] = {
-       { discard_const_p(char, "size"), py_MInterfacePointer_get_size, py_MInterfacePointer_set_size },
-       { discard_const_p(char, "obj"), py_MInterfacePointer_get_obj, py_MInterfacePointer_set_obj },
-       { NULL }
+       {
+               .name = discard_const_p(char, "size"),
+               .get = py_MInterfacePointer_get_size,
+               .set = py_MInterfacePointer_set_size,
+               .doc = discard_const_p(char, "PIDL-generated element size")
+       },
+       {
+               .name = discard_const_p(char, "obj"),
+               .get = py_MInterfacePointer_get_obj,
+               .set = py_MInterfacePointer_set_obj,
+               .doc = discard_const_p(char, "PIDL-generated element obj")
+       },
+       { .name = NULL }
 };
 
 static PyObject *py_MInterfacePointer_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
@@ -2744,22 +3331,31 @@ static PyObject *py_MInterfacePointer_new(PyTypeObject *type, PyObject *args, Py
 static PyObject *py_MInterfacePointer_ndr_pack(PyObject *py_obj)
 {
        struct MInterfacePointer *object = (struct MInterfacePointer *)pytalloc_get_ptr(py_obj);
+       PyObject *ret = NULL;
        DATA_BLOB blob;
        enum ndr_err_code err;
-       err = ndr_push_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_push_flags_fn_t)ndr_push_MInterfacePointer);
+       TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
+       if (tmp_ctx == NULL) {
+               PyErr_SetNdrError(NDR_ERR_ALLOC);
+               return NULL;
+       }
+       err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_MInterfacePointer);
        if (err != NDR_ERR_SUCCESS) {
+               TALLOC_FREE(tmp_ctx);
                PyErr_SetNdrError(err);
                return NULL;
        }
 
-       return PyString_FromStringAndSize((char *)blob.data, blob.length);
+       ret = PyString_FromStringAndSize((char *)blob.data, blob.length);
+       TALLOC_FREE(tmp_ctx);
+       return ret;
 }
 
 static PyObject *py_MInterfacePointer_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
 {
        struct MInterfacePointer *object = (struct MInterfacePointer *)pytalloc_get_ptr(py_obj);
        DATA_BLOB blob;
-       int blob_length = 0;
+       Py_ssize_t blob_length = 0;
        enum ndr_err_code err;
        const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
        PyObject *allow_remaining_obj = NULL;
@@ -2817,7 +3413,6 @@ static PyTypeObject MInterfacePointer_Type = {
        .tp_getset = py_MInterfacePointer_getsetters,
        .tp_methods = py_MInterfacePointer_methods,
        .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
-       .tp_basicsize = sizeof(pytalloc_Object),
        .tp_new = py_MInterfacePointer_new,
 };
 
@@ -2839,45 +3434,61 @@ void initorpc(void)
        if (dep_talloc == NULL)
                return;
 
-       Object_Type = (PyTypeObject *)PyObject_GetAttrString(dep_talloc, "Object");
-       if (Object_Type == NULL)
+       BaseObject_Type = (PyTypeObject *)PyObject_GetAttrString(dep_talloc, "BaseObject");
+       if (BaseObject_Type == NULL)
                return;
 
        GUID_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_misc, "GUID");
        if (GUID_Type == NULL)
                return;
 
-       COMVERSION_Type.tp_base = Object_Type;
+       COMVERSION_Type.tp_base = BaseObject_Type;
+       COMVERSION_Type.tp_basicsize = pytalloc_BaseObject_size();
 
-       ORPC_EXTENT_Type.tp_base = Object_Type;
+       ORPC_EXTENT_Type.tp_base = BaseObject_Type;
+       ORPC_EXTENT_Type.tp_basicsize = pytalloc_BaseObject_size();
 
-       ORPC_EXTENT_ARRAY_Type.tp_base = Object_Type;
+       ORPC_EXTENT_ARRAY_Type.tp_base = BaseObject_Type;
+       ORPC_EXTENT_ARRAY_Type.tp_basicsize = pytalloc_BaseObject_size();
 
-       ORPCTHIS_Type.tp_base = Object_Type;
+       ORPCTHIS_Type.tp_base = BaseObject_Type;
+       ORPCTHIS_Type.tp_basicsize = pytalloc_BaseObject_size();
 
-       ORPCTHAT_Type.tp_base = Object_Type;
+       ORPCTHAT_Type.tp_base = BaseObject_Type;
+       ORPCTHAT_Type.tp_basicsize = pytalloc_BaseObject_size();
 
-       STRINGBINDING_Type.tp_base = Object_Type;
+       STRINGBINDING_Type.tp_base = BaseObject_Type;
+       STRINGBINDING_Type.tp_basicsize = pytalloc_BaseObject_size();
 
-       STRINGARRAY_Type.tp_base = Object_Type;
+       STRINGARRAY_Type.tp_base = BaseObject_Type;
+       STRINGARRAY_Type.tp_basicsize = pytalloc_BaseObject_size();
 
-       DUALSTRINGARRAY_Type.tp_base = Object_Type;
+       DUALSTRINGARRAY_Type.tp_base = BaseObject_Type;
+       DUALSTRINGARRAY_Type.tp_basicsize = pytalloc_BaseObject_size();
 
-       SECURITYBINDING_Type.tp_base = Object_Type;
+       SECURITYBINDING_Type.tp_base = BaseObject_Type;
+       SECURITYBINDING_Type.tp_basicsize = pytalloc_BaseObject_size();
 
-       STDOBJREF_Type.tp_base = Object_Type;
+       STDOBJREF_Type.tp_base = BaseObject_Type;
+       STDOBJREF_Type.tp_basicsize = pytalloc_BaseObject_size();
 
-       u_standard_Type.tp_base = Object_Type;
+       u_standard_Type.tp_base = BaseObject_Type;
+       u_standard_Type.tp_basicsize = pytalloc_BaseObject_size();
 
-       u_handler_Type.tp_base = Object_Type;
+       u_handler_Type.tp_base = BaseObject_Type;
+       u_handler_Type.tp_basicsize = pytalloc_BaseObject_size();
 
-       u_custom_Type.tp_base = Object_Type;
+       u_custom_Type.tp_base = BaseObject_Type;
+       u_custom_Type.tp_basicsize = pytalloc_BaseObject_size();
 
-       u_null_Type.tp_base = Object_Type;
+       u_null_Type.tp_base = BaseObject_Type;
+       u_null_Type.tp_basicsize = pytalloc_BaseObject_size();
 
-       OBJREF_Type.tp_base = Object_Type;
+       OBJREF_Type.tp_base = BaseObject_Type;
+       OBJREF_Type.tp_basicsize = pytalloc_BaseObject_size();
 
-       MInterfacePointer_Type.tp_base = Object_Type;
+       MInterfacePointer_Type.tp_base = BaseObject_Type;
+       MInterfacePointer_Type.tp_basicsize = pytalloc_BaseObject_size();
 
        if (PyType_Ready(&COMVERSION_Type) < 0)
                return;