Commit 0682879a authored by Jeremy Hylton's avatar Jeremy Hylton

Add two checks for errors from Python C API.

parent c7d58894
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
DAMAGE. DAMAGE.
$Id: cAccessControl.c,v 1.28 2004/02/18 11:24:51 jim Exp $ $Id: cAccessControl.c,v 1.29 2004/02/18 17:55:43 jeremy Exp $
If you have questions regarding this software, If you have questions regarding this software,
contact: contact:
...@@ -1899,6 +1899,8 @@ c_rolesForPermissionOn(PyObject *perm, PyObject *object, ...@@ -1899,6 +1899,8 @@ c_rolesForPermissionOn(PyObject *perm, PyObject *object,
goto end; goto end;
result = PySequence_Concat(r, list_roles); result = PySequence_Concat(r, list_roles);
Py_DECREF(list_roles); Py_DECREF(list_roles);
if (result == NULL)
goto end;
} }
goto end; goto end;
} }
...@@ -1935,7 +1937,12 @@ c_rolesForPermissionOn(PyObject *perm, PyObject *object, ...@@ -1935,7 +1937,12 @@ c_rolesForPermissionOn(PyObject *perm, PyObject *object,
r = list(roles) r = list(roles)
else: r = r + list(roles) else: r = r + list(roles)
*/ */
else if (PyObject_IsTrue(roles)) else
{
int bool = PyObject_IsTrue(roles);
if (bool < 0)
goto end;
if (bool)
{ {
PyObject *list_roles = PySequence_List(roles); PyObject *list_roles = PySequence_List(roles);
Py_DECREF(roles); Py_DECREF(roles);
...@@ -1957,6 +1964,7 @@ c_rolesForPermissionOn(PyObject *perm, PyObject *object, ...@@ -1957,6 +1964,7 @@ c_rolesForPermissionOn(PyObject *perm, PyObject *object,
} }
} }
} }
}
else /* roles == NULL */ else /* roles == NULL */
PyErr_Clear(); PyErr_Clear();
...@@ -2305,7 +2313,7 @@ void initcAccessControl(void) { ...@@ -2305,7 +2313,7 @@ void initcAccessControl(void) {
module = Py_InitModule3("cAccessControl", module = Py_InitModule3("cAccessControl",
cAccessControl_methods, cAccessControl_methods,
"$Id: cAccessControl.c,v 1.28 2004/02/18 11:24:51 jim Exp $\n"); "$Id: cAccessControl.c,v 1.29 2004/02/18 17:55:43 jeremy Exp $\n");
aq_init(); /* For Python <= 2.1.1, aq_init() should be after aq_init(); /* For Python <= 2.1.1, aq_init() should be after
Py_InitModule(). */ Py_InitModule(). */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment