strange error whilst porting to 2.6

Robin Becker robin at reportlab.com
Mon Jan 26 08:28:09 EST 2009


I found that this error

> Exception RuntimeError: 'maximum recursion depth exceeded in __subclasscheck__' in <type 'exceptions.AttributeError'> ignored 

occurs when attempting to copy (copy.copy(inst)) an instance of a class that 
looks like this

class LazyParagraph(_LazyMixin,TTParagraph):
	SUPER=TTParagraph
	_CLEAN_SPACE=1


however, whilst debugging I found the error disappeared when I tried to 
determine what accesses were being made on this instance during the copy. If I 
use this code

class _LazyParagraph(_LazyMixin,TTParagraph):
     SUPER=TTParagraph
     _CLEAN_SPACE=1

class LazyParagraph(_LazyParagraph):
     def __getattr__(self,a):
         return getattr(_LazyParagraph,a)


then instances of the new lazy paragraph don't cause a problem. This looks 
awfully fragile to me, and I haven't really got any closer to understanding 
what's going on. Anyone got any ideas?

I have attempted to abstract the problem, but so far I haven't found the vital bits.
-- 
Robin Becker




More information about the Python-list mailing list