mirror of
https://github.com/samba-team/samba.git
synced 2024-12-22 13:34:15 +03:00
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>
This commit is contained in:
parent
2ba83ae49b
commit
ed11ce8f12
@ -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) {");
|
||||
|
Loading…
Reference in New Issue
Block a user