[chimera-dev] large data structures in conditional blocks makes baby Python cry

Eric Pettersen pett at cgl.ucsf.edu
Wed Jan 17 17:48:39 PST 2007


This is actually applicable to any Python code, but is especially  
relevant to extensions that save data in Chimera sessions:  the  
Python bytecode compiler has a limitation of a maximum of a 16 bit  
offset in a jump instruction.  This means that you don't want to have  
64K worth of characters in a single conditional block of code (i.e.  
if/else, loops, try/except).  Otherwise you will get the somewhat  
opaque:

	SystemError: com_backpatch: offset too large

So if you have data structures that may be potentially large when  
written to a session file, try to place their definitions in the  
session file outside of conditional blocks.

--Eric

                         Eric Pettersen
                         UCSF Computer Graphics Lab
                         pett at cgl.ucsf.edu
                         http://www.cgl.ucsf.edu


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://plato.cgl.ucsf.edu/pipermail/chimera-dev/attachments/20070117/0e95bf3d/attachment.html>


More information about the Chimera-dev mailing list