[Zope-Checkins] CVS: Packages/AccessControl -
cAccessControl.c:1.20.2.15
Tim Peters
tim.one at comcast.net
Tue Dec 14 10:56:24 EST 2004
Update of /cvs-repository/Packages/AccessControl
In directory cvs.zope.org:/tmp/cvs-serv9522/lib/python/AccessControl
Modified Files:
Tag: Zope-2_7-branch
cAccessControl.c
Log Message:
SecurityManager_getattro():
- Failure to convert to string must be explicitly dealt with. Unclear
what to do then. This passes the exception on to the caller.
- Don't call PyString_AsString(name) up to 3 additional times -- use the
value that was already computed.
=== Packages/AccessControl/cAccessControl.c 1.20.2.14 => 1.20.2.15 ===
--- Packages/AccessControl/cAccessControl.c:1.20.2.14 Tue Dec 14 10:48:10 2004
+++ Packages/AccessControl/cAccessControl.c Tue Dec 14 10:56:23 2004
@@ -1440,19 +1440,19 @@
if (PyString_Check(name) || PyUnicode_Check(name)) {
char *name_s = PyString_AsString(name);
- if (name_s && name_s[0]=='_') {
- if (! strcmp(PyString_AsString(name), "_thread_id")
- && self->thread_id) {
+ if (name_s == NULL)
+ return NULL;
+
+ if (name_s[0] == '_') {
+ if (! strcmp(name_s, "_thread_id") && self->thread_id) {
Py_INCREF(self->thread_id);
return self->thread_id;
}
- else if (! strcmp(PyString_AsString(name), "_context")
- && self->context) {
+ else if (! strcmp(name_s, "_context") && self->context) {
Py_INCREF(self->context);
return self->context;
}
- else if (! strcmp(PyString_AsString(name), "_policy")
- && self->policy) {
+ else if (! strcmp(name_s, "_policy") && self->policy) {
Py_INCREF(self->policy);
return self->policy;
}
More information about the Zope-Checkins
mailing list