* 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.
diff --git a/Objects/object.c b/Objects/object.c
index e28158e..a469797 100644
--- a/Objects/object.c
+++ b/Objects/object.c
@@ -194,6 +194,20 @@
}
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;
char *name;