Changing Python Opcodes

Diez B. Roggisch deets at
Tue Aug 18 09:19:31 CEST 2009

Sreejith K schrieb:
> Hi,
> I know this is not the best way to do it. But I have to do it at least
> to make it *hard* to decompile the python bytecode.
> I want to distribute a software written in Python without the source.
> So I compiled Python from source changing some opcode values (Taking
> care of HAVE_ARGUMENT value) and distributed with the .pyc files. It
> did compile but when I'm installing additional python modules using
> easy_install, the import fails with a segmentation fault. It worked in
> a 32 bit Centos 5.2 but not on 64bit Centos 5.2. I am using python
> 2.5.4 source.
> I changed only the Include/ source with my jumbled opcode
> values. Was I correct here ? I would like to know what all changes to
> be made as to successfully compile a custom python with different
> opcode values ?

As you are the one who modified your Python, you are the one responsible 
for debugging that - noone else can.

Did you try installing the egg *without* pyc-files in there? Because 
naturally those shouldn't work. They shouldn't crash the interpreter 
either, but then again - you *did* modify it.


More information about the Python-list mailing list