[Python-bugs-list] compiling long strings crashes (PR#32)

Skip Montanaro skip@mojam.com (Skip Montanaro)
Tue, 20 Jul 1999 11:29:24 -0500 (CDT)

    Ricardo> Running python with this file crashes with the message:
    Ricardo> SystemError: com_addbyte: byte out of range

    Ricardo> We are having this kind of error when compiling big files.
    Ricardo> With other kind of strings the file can be of 1Mb more or less
    Ricardo> to make it crash.


This is a known limitation of the Python byte code format, which is unlikely
to get lifted before the Python 2.x release (which is far enough off you
shouldn't wait for it to cure this problem).  Offsets are only 16 bits long,
so the largest a .pyc file can be is 64kbytes.  You'll have to modify your
program to either split the files into multiple pieces or initialize the
strings by reading them from a non-bytecode file.that contains the raw
string data, e.g., in bigstring.py you could have:
    bigstring = open("bigstring.txt", "rb").read()

Skip Montanaro	| http://www.mojam.com/
skip@mojam.com  | http://www.musi-cal.com/~skip/