* accessobject.c (ownercheck): allow a base class access to protected

objects of its derived classes; allow anything that has an attribute
  named "__privileged__" access to anything.
* object.[ch]: added hasattr() -- test whether getattr() will succeed.
This commit is contained in:
Guido van Rossum 1993-07-11 19:55:34 +00:00
parent 697e7abbc8
commit ed18fdc9fc
3 changed files with 42 additions and 15 deletions

View file

@ -193,6 +193,20 @@ getattr(v, name)
}
}
int
hasattr(v, name)
object *v;
char *name;
{
object *res = getattr(v, name);
if (res != NULL) {
DECREF(res);
return 1;
}
err_clear();
return 0;
}
int
setattr(v, name, w)
object *v;