summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
Diffstat (limited to 'Objects')
-rw-r--r--Objects/dictobject.c6
-rw-r--r--Objects/mappingobject.c6
-rw-r--r--Objects/object.c21
3 files changed, 33 insertions, 0 deletions
diff --git a/Objects/dictobject.c b/Objects/dictobject.c
index f655828..605c6db 100644
--- a/Objects/dictobject.c
+++ b/Objects/dictobject.c
@@ -769,6 +769,9 @@ getattro(v, name)
object *v;
object *name;
{
+ if (v->ob_type->tp_getattro != NULL)
+ return (*v->ob_type->tp_getattro)(v, name);
+
if (name != last_name_object) {
XDECREF(last_name_object);
INCREF(name);
@@ -784,6 +787,9 @@ setattro(v, name, value)
object *name;
object *value;
{
+ if (v->ob_type->tp_setattro != NULL)
+ return (*v->ob_type->tp_setattro)(v, name, value);
+
if (name != last_name_object) {
XDECREF(last_name_object);
INCREF(name);
diff --git a/Objects/mappingobject.c b/Objects/mappingobject.c
index f655828..605c6db 100644
--- a/Objects/mappingobject.c
+++ b/Objects/mappingobject.c
@@ -769,6 +769,9 @@ getattro(v, name)
object *v;
object *name;
{
+ if (v->ob_type->tp_getattro != NULL)
+ return (*v->ob_type->tp_getattro)(v, name);
+
if (name != last_name_object) {
XDECREF(last_name_object);
INCREF(name);
@@ -784,6 +787,9 @@ setattro(v, name, value)
object *name;
object *value;
{
+ if (v->ob_type->tp_setattro != NULL)
+ return (*v->ob_type->tp_setattro)(v, name, value);
+
if (name != last_name_object) {
XDECREF(last_name_object);
INCREF(name);
diff --git a/Objects/object.c b/Objects/object.c
index be40c40..9d8a16b 100644
--- a/Objects/object.c
+++ b/Objects/object.c
@@ -326,6 +326,16 @@ getattr(v, name)
object *v;
char *name;
{
+ if (v->ob_type->tp_getattro != NULL) {
+ object *w, *res;
+ w = newstringobject(name);
+ if (w == NULL)
+ return NULL;
+ res = (*v->ob_type->tp_getattro)(v, w);
+ XDECREF(w);
+ return res;
+ }
+
if (v->ob_type->tp_getattr == NULL) {
err_setstr(AttributeError, "attribute-less object");
return NULL;
@@ -355,6 +365,17 @@ setattr(v, name, w)
char *name;
object *w;
{
+ if (v->ob_type->tp_setattro != NULL) {
+ object *s;
+ int res;
+ s = newstringobject(name);
+ if (s == NULL)
+ return NULL;
+ res = (*v->ob_type->tp_setattro)(v, s, w);
+ XDECREF(s);
+ return res;
+ }
+
if (v->ob_type->tp_setattr == NULL) {
if (v->ob_type->tp_getattr == NULL)
err_setstr(TypeError,