aboutsummaryrefslogtreecommitdiffstats
path: root/tools/pidl/lib/Parse/Pidl
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2016-07-27 16:13:55 -0700
committerGuy Harris <guy@alum.mit.edu>2016-07-27 23:14:56 +0000
commitd47f174f9e518bdb2742e96fb01d045764415c7c (patch)
treedb0a3a4c2c043a82305607e84e10492f02af8253 /tools/pidl/lib/Parse/Pidl
parentbd0280e8d6570b5a1ce785b1518d3d7b6b68ec33 (diff)
Copy over change from Samba repository:
commit 9e07f3a13b41be1f019887581b2a2bd049039a3d Author: Andrew Bartlett <abartlet@samba.org> Date: Tue Feb 16 14:06:28 2016 +1300 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> Shouldn't affect us, but it makes diffing cleaner. Change-Id: If4a7d9d3f5eb0acf9f94b10af870a0e01fa52b5c Reviewed-on: https://code.wireshark.org/review/16737 Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'tools/pidl/lib/Parse/Pidl')
-rw-r--r--tools/pidl/lib/Parse/Pidl/Samba4/Python.pm12
1 files changed, 7 insertions, 5 deletions
diff --git a/tools/pidl/lib/Parse/Pidl/Samba4/Python.pm b/tools/pidl/lib/Parse/Pidl/Samba4/Python.pm
index 5a5159d12a..228081f0e8 100644
--- a/tools/pidl/lib/Parse/Pidl/Samba4/Python.pm
+++ b/tools/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");