[Zope-Checkins] CVS: Zope/lib/python/AccessControl - cAccessControl.c:1.29

Jeremy Hylton jeremy at zope.com
Wed Feb 18 12:55:44 EST 2004


Update of /cvs-repository/Zope/lib/python/AccessControl
In directory cvs.zope.org:/tmp/cvs-serv20679

Modified Files:
	cAccessControl.c 
Log Message:
Add two checks for errors from Python C API.


=== Zope/lib/python/AccessControl/cAccessControl.c 1.28 => 1.29 ===
--- Zope/lib/python/AccessControl/cAccessControl.c:1.28	Wed Feb 18 06:24:51 2004
+++ Zope/lib/python/AccessControl/cAccessControl.c	Wed Feb 18 12:55:43 2004
@@ -1899,6 +1899,8 @@
                     goto end;
                   result = PySequence_Concat(r, list_roles);
                   Py_DECREF(list_roles);
+		  if (result == NULL)
+		      goto end;
                 }
               goto end;
             }
@@ -1935,26 +1937,32 @@
                     r = list(roles)
                 else: r = r + list(roles)
           */
-          else if (PyObject_IsTrue(roles))
-            {
-              PyObject *list_roles = PySequence_List(roles);
-              Py_DECREF(roles);
-              if (list_roles == NULL)
-                goto end;
-              if (r == Py_None)
-                {
-                  Py_DECREF(r);
-                  r = list_roles;
-                }
-              else
-                {
-                  PyObject *tmp = PySequence_Concat(r, list_roles);
-                  Py_DECREF(list_roles);
-                  if (tmp == NULL)
-                    goto end;
-                  Py_DECREF(r);
-                  r = tmp;
-                }
+          else 
+  	    {
+	      int bool = PyObject_IsTrue(roles);
+	      if (bool < 0)
+		  goto end;
+	      if (bool)
+	        {
+		    PyObject *list_roles = PySequence_List(roles);
+		    Py_DECREF(roles);
+		    if (list_roles == NULL)
+			goto end;
+		    if (r == Py_None)
+		      {
+			  Py_DECREF(r);
+			  r = list_roles;
+		      }
+		    else
+		      {
+			  PyObject *tmp = PySequence_Concat(r, list_roles);
+			  Py_DECREF(list_roles);
+			  if (tmp == NULL)
+			      goto end;
+			  Py_DECREF(r);
+			  r = tmp;
+		      }
+		}
             }
         }
 




More information about the Zope-Checkins mailing list