diff options
author | Andrew Bartlett <abartlet@samba.org> | 2016-02-16 14:06:28 +1300 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2016-03-08 01:58:26 +0100 |
commit | 9e07f3a13b41be1f019887581b2a2bd049039a3d (patch) | |
tree | aeda3d511450482a450d6ebb0483d5b0acde08c4 /pidl | |
parent | 627fdf0468e9f575ea1a5de1fd57a87a239a4b96 (diff) | |
download | samba-9e07f3a13b41be1f019887581b2a2bd049039a3d.tar.gz |
pidl: Fix our python reference handling
The new talloc.BaseObject allow us to hold a talloc context per
python object (there may be many referring to the same C object)
and the talloc context that the actual object pointer is under.
Another advantage is that talloc.BaseObject(), has less of
an ABI surface.
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Diffstat (limited to 'pidl')
-rw-r--r-- | pidl/lib/Parse/Pidl/Samba4/Python.pm | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/pidl/lib/Parse/Pidl/Samba4/Python.pm b/pidl/lib/Parse/Pidl/Samba4/Python.pm index f2cb5387751..29fb6e00084 100644 --- a/pidl/lib/Parse/Pidl/Samba4/Python.pm +++ b/pidl/lib/Parse/Pidl/Samba4/Python.pm @@ -376,15 +376,16 @@ sub PythonStruct($$$$$$) } $self->pidl(".tp_methods = $py_methods,"); $self->pidl(".tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,"); - $self->pidl(".tp_basicsize = sizeof(pytalloc_Object),"); $self->pidl(".tp_new = py_$name\_new,"); $self->deindent; $self->pidl("};"); $self->pidl(""); - my $talloc_typename = $self->import_type_variable("talloc", "Object"); - $self->register_module_prereadycode(["$name\_Type.tp_base = $talloc_typename;", ""]); + my $talloc_typename = $self->import_type_variable("talloc", "BaseObject"); + $self->register_module_prereadycode(["$name\_Type.tp_base = $talloc_typename;", + "$name\_Type.tp_basicsize = pytalloc_BaseObject_size();", + ""]); return "&$typeobject"; } @@ -810,7 +811,6 @@ sub Interface($$$) $self->indent; $self->pidl("PyObject_HEAD_INIT(NULL) 0,"); $self->pidl(".tp_name = \"$basename.$interface->{NAME}\","); - $self->pidl(".tp_basicsize = sizeof(pytalloc_Object),"); $self->pidl(".tp_doc = $docstring,"); $self->pidl(".tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,"); $self->pidl(".tp_new = syntax_$interface->{NAME}_new,"); @@ -821,7 +821,9 @@ sub Interface($$$) $self->register_module_typeobject("abstract_syntax", "&$syntax_typename"); my $ndr_typename = $self->import_type_variable("samba.dcerpc.misc", "ndr_syntax_id"); - $self->register_module_prereadycode(["$syntax_typename.tp_base = $ndr_typename;", ""]); + $self->register_module_prereadycode(["$syntax_typename.tp_base = $ndr_typename;", + "$syntax_typename.tp_basicsize = pytalloc_BaseObject_size();", + ""]); } $self->pidl_hdr("\n"); |