Commit 1f3346fd authored by Kevin Modzelewski's avatar Kevin Modzelewski

Fix cpython_oldstyle_getattr_crash.py

It was just an error-message difference.
parent 7e3c7350
...@@ -472,10 +472,18 @@ static Box* _instanceGetattribute(Box* _inst, BoxedString* attr_str, bool raise_ ...@@ -472,10 +472,18 @@ static Box* _instanceGetattribute(Box* _inst, BoxedString* attr_str, bool raise_
return incref(inst->inst_cls); return incref(inst->inst_cls);
} }
Box* attr = instanceGetattributeWithFallback<rewritable>(inst, attr_str, rewrite_args); try {
if (attr) { Box* attr = instanceGetattributeWithFallback<rewritable>(inst, attr_str, rewrite_args);
return attr; if (attr)
} else if (!raise_on_missing) { return attr;
} catch (ExcInfo e) {
if (!raise_on_missing && e.matches(AttributeError)) {
e.clear();
return NULL;
}
throw e;
}
if (!raise_on_missing) {
return NULL; return NULL;
} else { } else {
raiseExcHelper(AttributeError, "%s instance has no attribute '%s'", inst->inst_cls->name->data(), raiseExcHelper(AttributeError, "%s instance has no attribute '%s'", inst->inst_cls->name->data(),
......
# expected: reffail
# This segfaults under python-dbg # This segfaults under python-dbg
# (In a release build it "works" since the use-after-free happens without penalty.) # (In a release build it "works" since the use-after-free happens without penalty.)
...@@ -7,7 +6,7 @@ class C: ...@@ -7,7 +6,7 @@ class C:
del self del self
print "C.__getattr__", attr print "C.__getattr__", attr
del D.__get__ del D.__get__
raise AttributeError() raise AttributeError("our attribute error")
class D(object): class D(object):
__get__ = C() __get__ = C()
......
# expected: reffail
# Generators participate in the notional Python stack just like normal function calls do, # Generators participate in the notional Python stack just like normal function calls do,
# even if we implement them using separate C stacks. # even if we implement them using separate C stacks.
# #
......
# expected: reffail
def f1(): def f1():
class C(object): class C(object):
......
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