Windows Stack Size
Mark Hammond
MHammond at skippinet.com.au
Tue Jun 1 19:26:05 EDT 1999
>AFAIK, the code is not recursive (sometimes with GUI callbacks, you can
>get a lot deeper into the stack than you might expect :-). It's been
>running fine under Linux for months, but under Win 95 it traps
>consistantly in some windows, _but not in all of them_, which is why I
>thought there might be a tiny-stack issue. 1 meg should be plenty of
>room.
In this case, you definately would appear to have an infinite recursion bug.
Fixing the stack size will mean it just takes longer to crash :-)
> def __getattr__(self, attr):
> if self.text:
> return getattr(self.text, attr)
> else:
> raise AttributeError(attr)
>
>Upon further consideration, I wonder if the getattr could have something
>to do with this.
Certainly a good cause of accidental death by recursion. For example, had
your code used "self.test" (ie, made a typo on "self.text") you would
recurse infinitely, as you would trigger a __getattr_ for the attribute
name. However, as you dont have a __setattr__ and you define self.text in
__init__, this *looks* fine to me. However, a few well-chosen print
statements in __getattr__ would make this immediately obvious. Also, the
death should take a few seconds to occur - try hitting Ctrl+C in this
period - you may get a traceback telling you exactly where the problem is.
>I'd debug it myself except that I'm happily Windows-free (only creates
>problems when I have to write code for Windows users). If there is no
>obvious answer, I have a work-around.
And what would the work-around be?
Mark.
More information about the Python-list
mailing list