Commit a8b225a5 authored by Kevin Modzelewski's avatar Kevin Modzelewski

Fix bad guard

and add the test that exposed it.

addGuard(obj) is dangerous because obj could be deallocated+reallocated
in the same spot, which is what ended up happening here.
parent 41ce5b10
......@@ -1572,6 +1572,7 @@ Box* BoxedCApiFunction::tppCall(Box* _self, CallRewriteArgs* rewrite_args, ArgPa
if (rewrite_args) {
rewrite_args->obj->addGuard((intptr_t)self);
rewrite_args->rewriter->addGCReference(self);
}
int flags = self->method_def->ml_flags;
......
......@@ -39,8 +39,18 @@ def test(ET):
name = country.get('name')
print name, rank
it = root.iter
i = it()
for e in it():
assert not isinstance(e, str)
import xml.etree.ElementTree as Python_ET
import xml.etree.cElementTree as CAPI_ET
test(Python_ET)
test(CAPI_ET)
for i in xrange(20):
print
print i
test(Python_ET)
test(CAPI_ET)
test(CAPI_ET)
test(CAPI_ET)
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