[Python-Dev] Is core dump always a bug? Advice requested

Jeremy Hylton jeremy at alum.mit.edu
Wed May 12 11:56:49 EDT 2004


> If arbitrary branching patterns are allowed, then in order to ensure
> absence of stack overflow/underflow, etc., it will be necessary to do
> things like proving that certain loops can't execute more than a
> certain number of times. This smells halting-problem-complete to me.

I think it would only need to check that any path through the loop has a no
net effect on stack depth -- before branching back to the beginning of the
loop, it must pop everything it pushed.

> It would be possible to prove that certain classes of bytecode
> sequence are valid, and reject all others. But I suspect that would
> reject a large number of valid-but-hard-to-prove sequences that
> bytecode hackers would find "interesting".

I find it hard to make a strong conjecture either way.  I think the only way
to find out would be to examine whatever it is that bytecode hackers do.
There could be an unsafe switch that turned off checking.

Jeremy




More information about the Python-Dev mailing list