Stefan Behnel wrote:
> Stefan Behnel wrote:
>> I ran lxml's test suite with the refnanny and it looks mostly good, except
>> for a number of dropped AssertErrors and dropped unnamed(?) exceptions. It
>> doesn't say where they come from and I was unable to add any traceable
>> information to the output. There are two plain assert statements in the
>> refnanny code, but adding text to them doesn't change anything.
>>
>> I'll post the output here as soon as I get to it.
> 
> Quicker than I though. Looks like only two separate problems. There are two
> 'void' methods in _ParserContext that do not propagate exceptions, but
> enabling that doesn't change anything. Any idea what this might mean?

Robert, Michael, this applies to you as well.

I think I have an idea. The refnanny raises normal exceptions when 
something is violated; this is great for the smaller tests in the Cython 
test suite but might become a problem in programs.

There might be more situations where what you see happens, but this is 
one I can think of:

def f():
     # this function raises AssertError, and then
     # during exit of the function, a this exception is replaced
     # (overwritten) with a refnanny exception

try:
     f()
except:
     pass

The solution may be to change the way Cython/Runtime/refnanny.pyx 
reports errors, for instance change Context.delref to do a 
print/sys.exit(1) thing instead of raising an exception, and then 
reinstall Cython.

(Note that in f() above, the refcount error could happen before the 
AssertError is raised -- refnanny.pyx keeps track of all errors that 
happen in a function, and then raises/replaces an exception on function 
return.)

-- 
Dag Sverre
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to