durusmail: durus-users: __setattr__ RuntimeError: max recursion depth exceeded
__setattr__ RuntimeError: max recursion depth exceeded
2004-10-15
Mario Ruggier (2 parts)
__setattr__ RuntimeError: max recursion depth exceeded
2004-10-15
2004-10-15
2004-10-15
2004-10-15
2004-10-15
2004-10-15
__setattr__ RuntimeError: max recursion depth exceeded
Mario Ruggier
2004-10-15
On Oct 15, 2004, at 6:33 PM, David Binger wrote:
> On Oct 15, 2004, at 12:08 PM, Mario Ruggier wrote:
>
>> 
>
> Getting the __special_atts__ from self before calling the
> super __setattr__ seems to cause this.
>
> Alternatives that seem to work:
>
> Call the super() before the if attr in __special_atts__.
>
> Don't get __special_atts__ from self.  Maybe from self.__class__.
>
> Get the attribute from self using object.__getattribute__() (yuck).
>
> My favorite: avoid modifying __setattr__().

OK, thanks! Yes, getting it from __class__ works... I guess this will
bypass some of the internals of persistent? _p_load_state ?

I was using __setattr__() for the convenience of throwing something
together quickly, avoiding a lot of annoying boilerplate code. The
slowed-down performance when writing objects is really of no importance
in my case, as data will be written very rarely.

But, irrespective of whether using __setattr__() is advisable or not,
do you consider this a bug in durus ?

Cheers, mario


reply