diff options
author | Guy Harris <guy@alum.mit.edu> | 2016-07-27 16:21:46 -0700 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2016-07-27 23:22:47 +0000 |
commit | 62eb424d804942592b8ecf8b9212730e99ce9bae (patch) | |
tree | 2037f6341c7900387460946268ce7fc47a774692 /tools/pidl/lib/Parse/Pidl/Samba4/Python.pm | |
parent | f0ed91f79dd0e252296cae608673dcf503196d59 (diff) |
Copy over change from Samba repository:
commit ed11ce8f12d567a3e0edc1d24aab1784a171ac33
Author: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Date: Wed May 4 16:51:37 2016 +1200
Python pidl: avoid segfault with "del obj->attr"
Deleting an attribute in Python (using the "del" statement) is (at
some stages along a winding path, for C objects) converted into
setting the attribute to NULL. Not None, actual NULL. The way we
handled this NULL was to dereference it. This changes the behaviour to
raising an AttributeError, which is more or less what Python does in
similar situations with builtin objects.
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Shouldn't affect us, but it makes diffing cleaner.
Change-Id: I8e681dc79c8f4e62b74e2aa5ac2b4924134735c4
Reviewed-on: https://code.wireshark.org/review/16741
Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'tools/pidl/lib/Parse/Pidl/Samba4/Python.pm')
-rw-r--r-- | tools/pidl/lib/Parse/Pidl/Samba4/Python.pm | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/tools/pidl/lib/Parse/Pidl/Samba4/Python.pm b/tools/pidl/lib/Parse/Pidl/Samba4/Python.pm index 566eaac395..07c18de3fb 100644 --- a/tools/pidl/lib/Parse/Pidl/Samba4/Python.pm +++ b/tools/pidl/lib/Parse/Pidl/Samba4/Python.pm @@ -1218,6 +1218,14 @@ sub ConvertObjectFromPythonLevel($$$$$$$$) $pl = GetPrevLevel($e, $pl); } + $self->pidl("if ($py_var == NULL) {"); + $self->indent; + $self->pidl("PyErr_Format(PyExc_AttributeError, \"Cannot delete NDR object: " . + mapTypeName($var_name) . "\");"); + $self->pidl($fail); + $self->deindent; + $self->pidl("}"); + if ($l->{TYPE} eq "POINTER") { if ($l->{POINTER_TYPE} ne "ref") { $self->pidl("if ($py_var == Py_None) {"); |