Commit 03e6d17c authored by Kevin Modzelewski's avatar Kevin Modzelewski

Got worried for a sec that our delattr guarding was wrong

And then I saw that we don't rewrite delattr anyway.
parent fa5ce439
......@@ -6154,7 +6154,13 @@ extern "C" void delattrGeneric(Box* obj, BoxedString* attr, DelattrRewriteArgs*
extern "C" void delattrInternal(Box* obj, BoxedString* attr, DelattrRewriteArgs* rewrite_args) {
static BoxedString* delattr_str = getStaticString("__delattr__");
// TODO: need to pass rewrite args to typeLookup to have it check guards.
// But we currently don't rewrite delattr anyway.
rewrite_args = NULL;
Box* delAttr = typeLookup(obj->cls, delattr_str);
if (delAttr != NULL) {
KEEP_ALIVE(delAttr);
......
class C(object):
pass
def f():
c = C()
c.a = 1
del c.a
f()
def __delattr__(self, attr):
print "custom __delattr__!"
C.__delattr__ = __delattr__
f()
del C.__delattr__
f()
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