[Python-Dev] another dict crasher

Michael Hudson mwh@python.net
Tue, 5 Jun 2001 09:39:24 +0100 (BST)

Haven't run your example yet as my machine's not on at the moment.

On Tue, 5 Jun 2001, Tim Peters wrote:

> However, if I stick "print self.i" at the start of __eq__, it dies
> with a KeyError instead!  That's why I'm mentioning it -- could be the
> same misdirection you're seeing.  I can't account for the KeyError in
> any rational way:  under Windows, it's actually hitting a stack
> overflow in the bowels of the system malloc() then.

Hmm.  It's quite likely that PyMem_Malloc (or whatever) crapping out and
returning NULL will get turned into a MemoryError, which will then get
turned into a KeyError, isn't it?  I could believe that malloc would set
up some fancy sigsegv-type handlers for memory management purposes which
then get called when it tramples all over the end of the stack.  But I'm
making this up as I go along...

> Windows "recovers" from that and presses on.  Everything that happens
> after appears to be an accident.
> win98-as-usual-ly y'rs  - tim

Well, linux seems to be similarly inscrutable here.  One problem is that
this is a pig to run under the debugger - setting a breakpoint on lookdict
isn't terribly interesting way to spend your time.  I suppose you could
just set the breakpoint on the recursive call... later.

> PS:  You'll be tested on this, too <wink>.

Oh, piss off <wink>.