The swig typemap
|
%typemap(in,noblock=1,numinputs=0) char ** (char * temp = 0) { |
|
$1 = &temp; |
|
} |
added in
9639f5d leads to wrong wrapper code being generated:
selinux.py:
def security_load_policy(len):
return _selinux.security_load_policy(len)
selinuxswig_python_wrap.c:
SWIGINTERN PyObject *_wrap_security_load_policy(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
void *arg1 = (void *) 0 ;
size_t arg2 ;
char *temp1 = NULL ;
size_t val2 ;
int ecode2 = 0 ;
PyObject *swig_obj[1] ;
int result;
{
arg1 = temp1; // <- assignment to NULL
}
if (!args) SWIG_fail;
swig_obj[0] = args;
ecode2 = SWIG_AsVal_size_t(swig_obj[0], &val2);
if (!SWIG_IsOK(ecode2)) {
SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "security_load_policy" "', argument " "2"" of type '" "size_t""'");
}
arg2 = (size_t)(val2);
{
result = (int)security_load_policy(arg1,arg2); // <- arg1 is always NULL
if (result < 0) {
PyErr_SetFromErrno(PyExc_OSError);
SWIG_fail;
}
}
resultobj = SWIG_From_int((int)(result));
return resultobj;
fail:
return NULL;
}
The typemap might have been indented for selinux_getenforcemode(3) only but does affect many more functions, e.g. selinux_check_access(3).
The swig typemap
selinux/libselinux/src/selinuxswig_python.i
Lines 131 to 133 in 0a8c177
selinux.py:
selinuxswig_python_wrap.c:
The typemap might have been indented for selinux_getenforcemode(3) only but does affect many more functions, e.g. selinux_check_access(3).