SystemError while execing bad code

Michael Hudson mwh at
Wed Jan 21 21:12:18 CET 2004

Gerrit Holl <gerrit at> writes:

> Hi,
> I found a cool way to trigger a SystemError:

How about marshal.loads('0') ?

> >>> exec CodeType(0,0,0,0,"",(),(),(),"","",0,"")
> XXX lineno: 0, opcode: 0
> Traceback (most recent call last):
>   File "<stdin>", line 1, in ?
>   File "/usr/lib/python2.2/site-packages/", line 0, in
>     File "/usr/lib/python2.2/site-packages/", line 0, in
> SystemError: unknown opcode
> But I guess this is a case of "so don't do it" :-)?

Definitely.  It's easy enought to crash the interpreter this way
(think LOAD_CONST 30000, for just one easy way).


 Very clever implementation techniques are required to implement this
 insanity correctly and usefully, not to mention that code written
 with this feature used and abused east and west is exceptionally
 exciting to debug.       -- Erik Naggum on Algol-style "call-by-name"

More information about the Python-list mailing list