Find bugs by sabotaging code

Michael Haggerty mhagger at alum.mit.edu
Wed Jul 1 02:43:59 CDT 2009


Greg Ward wrote:
>   ** unknown exception encountered, details follow
>   ** report bug details to http://mercurial.selenic.com/bts/
>   ** or mercurial at selenic.com
>   ** Mercurial Distributed SCM (version 7b3d837ca60e)
>   ** Extensions loaded: qct, hgk, children, graphlog, purge, convert,
> record, mq, rebase, patchbomb, extdiff, attic
>   Traceback (most recent call last):
>     File "/home/greg/bin/hg", line 27, in <module>
>       mercurial.dispatch.run()
>     [...]
>     File "/home/greg/src/hg-crew/mercurial/dirstate.py", line 219, in invalidate
>       raise RuntimeError()
>   RuntimeError
>   Exception exceptions.TypeError: "'NoneType' object is not iterable"
> in <bound method lock.__del__ of <mercurial.lock.lock object at
> 0x834fa2c>> ignored
> 
> Problem #2: exception in lock.__del__().  I added some "print"
> statements and determined that two separate lock objects are at play
> here.

As you are probably aware, these "NoneType" errors typically come when
Python tries to clean up static objects that remain at the end of the
program run.  It apparently doesn't try to destroy the objects in any
particular (e.g., dependency) order (which is anyway impossible in the
general case), so it can happen that the "a.b" member of a class
instance gets destroyed and set to None before the "a" instance itself.
 If "a"'s destructor depends on "a.b" then it fails.

The cure is to delete references explicitly if they have non-trivial
destructors.

Michael


More information about the Mercurial-devel mailing list