mirror of
https://gitlab.com/apparmor/apparmor
synced 2025-08-31 14:25:52 +00:00
Use SWIG_fail in %exception upon throwing OSError for errno
Unfortunately SWIG_exception does not support throwing OSError, so this still requires Python-specific code. Unlike just returning NULL, this will clean up intermediate allocations. Signed-off-by: Ryan Lee <ryan.lee@canonical.com>
This commit is contained in:
@@ -31,8 +31,9 @@ extern int _aa_is_blacklisted(const char *name);
|
||||
%exception {
|
||||
$action
|
||||
if (result < 0) {
|
||||
// Unfortunately SWIG_exception does not support OSError
|
||||
PyErr_SetFromErrno(PyExc_OSError);
|
||||
return NULL;
|
||||
SWIG_fail;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user