bloodhound-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ethan Jucovy <>
Subject Re: [Apache Bloodhound] #22: Infinite recursion error when initialising a plugin that extends itself
Date Wed, 04 Apr 2012 16:43:48 GMT
>  [
>  r1309470] fixes by dynamically replacing the __init__ of components with
>  one that runs the original __init__ on the condition that it has not
>  already been run.
>  I suspect what would be better in the long run would be to catch the
>  recursion error and turn it into something that can be reported but allows
>  Bloodhound to continue working. Plugins should probably keep track of
>  whether an instance has already been initialised.

This issue was raised on trac-dev[1].  It was pointed out that the
ThemeEngine plugin is incorrectly accessing its extension points in
__init__, which it should not do:

"A component constructor is called in a
special way, as you've found out, and it should really do pretty
much nothing.  Example of valid use is to set a list to [], a
hash to {}, or such.  In trunk you could even use @lazy
( to help with such
things. So doing anything lengthy is prohibited and the same
for "re-entering" the component machinery."

Perhaps Trac core should be throwing a more helpful error than infinite
recursion, but the correct fix here is to make ThemeEngineSystem.__init__
do less (e.g. ``self._info = None``) and populate its ```` dict
lazily.  There's no need for this __init__-replacing magic in core.


  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message