Python segfault

Hans-Joachim Widmaier hjwidmai at foxboro.com
Fri Jun 16 09:07:29 EDT 2000


Thomas Wouters:
> 
> > Why not simply make 'n_nchildren' an (32 bit) int? And, while at it,
> > 'n_lineno' also? It would cost some memory, though.
> 
> Why bother ? It would do nothing to solve the real problem, which is that
> there is a finite number of direct children to a node. The current number is
> practically unreachable -- the example case of ('+'.join(['2+2'] * 8193)) is
> hardly reminiscent of real code.

"Practically unreachable." But this number is, as far as I could draw from
your expanation, determined by that short. My point is: just raise this limit
so you run out of memory before ever reaching it ...

> Fixing the parser so it doesn't crash, and instead says 'add a few
> parentheses' would be the better solution, IMHO ;)

... which would make this overflow test obsolete, thus making a
better solution, IMHO. ;-)

Well, I'm not really voting, as I don't really know the innards, and I
have nothing to say. I'm just a fan of the "do not set a limit on
anything if there's no real need for it."

Anyway, having an error message is way better than just crashing.

-- 
Hans-Joachim Widmaier             E-Mail:  hjwidmaier at web.de




More information about the Python-list mailing list