Commit e66e20a3 authored by Kevin Modzelewski's avatar Kevin Modzelewski

Old style .__dict__ and .__class__

parent e80012b0
......@@ -142,6 +142,13 @@ static Box* _instanceGetattribute(Box* _inst, Box* _attr, bool raise_on_missing)
BoxedString* attr = static_cast<BoxedString*>(_attr);
// TODO: special handling for accessing __dict__ and __class__
if (attr->s[0] == '_' && attr->s[1] == '_') {
if (attr->s == "__dict__")
return makeAttrWrapper(inst);
if (attr->s == "__class__")
return inst->inst_cls;
}
Box* r = inst->getattr(attr->s);
if (r)
......
......@@ -121,3 +121,5 @@ g = GetattrTest()
g.b = 2
print g.a
print g.b
print g.__class__
print g.__dict__.items()
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment