[Python-Dev] Set-next-statement in Python debuggers

Armin Rigo arigo@tunes.org
Wed, 9 Oct 2002 14:57:26 +0200 (CEST)

Hello Richie,

On Tue, 8 Oct 2002 richie@entrian.com wrote:
> (...)  A nasty consequence is that you can write Python code that causes
> Python to seg-fault, but you have to be doing some fairly advanced stuff
> for that to happen.

You can already crash the interpreter with pure Python code, for example
via the new.code() constructor or by writing crappy .pyc files.  On Linux
you can also open("/proc/self/mem", "w").

I don't think that people get their hands on frame objects by pure chance,
but the possibility exists.  Moreover, conditionally allowing changes to
f_lasti is limiting and complex because of the stack and block stack.  For
safety I'd consider writing the frame-object-modifying code in a C
extension module, carefully documented as "don't use this".