[Python-Dev] SystemError: com_backpatch: offset too large

Jeff Epler jepler at unpythonic.net
Fri May 21 21:24:46 EDT 2004


On Fri, May 21, 2004 at 04:36:41PM +0200, Sebastian wrote:
> I've got a problem with python script.
> My script return exceptinon:
> 
> SystemError: com_backpatch: offset too large
> 
> I'm beginer in python programming, and don't known what do with this message.
> 
For the reasons that Terry Reedy discussed, this message has been sent
to python-list instead of python-dev.

Here's a small script that produces the error Sebastian mentioned:
    exec "0" + " and 0" * 9363
Here's another:
    exec "if len:\n" + "\tNone\n" * 16383 + "else: pass"

These programs hit a limit of the Python bytecode compiler, which (I
think) currently assumes all branches fit in 16-bit offsets.  This
program produces a larger offset.

Python supports a prefix opcode to give 32-bit operand values instead of
16-bit values, but the code generator isn't smart enough to use them.

This is a limit of the implementation, I don't think the language is
intended to have these rather arbitrary limits on program complexity.
However, the implementation probably tried to trade-offs that were
likely to accomodate most human-written code while allowing
*cough* uncomplicated C code.

Jeff




More information about the Python-list mailing list