[Zope-Checkins] CVS: Packages/AccessControl - cAccessControl.c:1.20.2.19

Tim Peters tim.one at comcast.net
Tue Dec 14 11:42:36 EST 2004


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

Modified Files:
      Tag: Zope-2_7-branch
	cAccessControl.c 
Log Message:
guarded_getattr():

- If conversion to string failed, this passed the exception on to the
  caller.  I suppose that's fine.  But it was hard to see that's what it
  did, because the "return NULL" was separated from the first test for
  failure by about 70 lines of code.  Moved the "return NULL" immediately
  next to the first test for failure, and eliminated the second test
  for failure.

- This is the last of the "PyString_AsString()" checkins from me.


=== Packages/AccessControl/cAccessControl.c 1.20.2.18 => 1.20.2.19 ===
--- Packages/AccessControl/cAccessControl.c:1.20.2.18	Tue Dec 14 11:33:09 2004
+++ Packages/AccessControl/cAccessControl.c	Tue Dec 14 11:42:36 2004
@@ -2065,8 +2065,11 @@
   /* if name[:1] != '_': */
   if (PyString_Check(name) || PyUnicode_Check(name)) {
     char *name_s = PyString_AsString(name);
-    
-    if (name_s && name_s[0] != '_')
+
+    if (name_s == NULL)
+        return NULL;
+
+    if (name_s[0] != '_')
     {
 
       /*
@@ -2140,9 +2143,6 @@
     err:
       Py_DECREF(v);
       return NULL;
-    }
-    else if (! name_s) {
-        return NULL;
     }
   }
 



More information about the Zope-Checkins mailing list