Changing Python Opcodes

Diez B. Roggisch deets at nospam.web.de
Tue Aug 18 04:57:58 EDT 2009


Sreejith K wrote:

> On Aug 18, 12:19 pm, "Diez B. Roggisch" <de... at nospam.web.de> wrote:
> 
>> 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.
> 
> Hi Diez, thanks for the immediate reply :)
> 
> I installed the setuptools using ez_setup.py script. Then I used the
> easy_install to install additional modules. When importing the
> installed modules segfault occurs. The module I installed was
> TurboGears.
> 
> Then I thought that it happened maybe because the easy_install script
> is downloading eggs for original python (I'm not sure if it is what
> easy_install is doing).

Yep, that's actually it's main purpose.

> So I also tried to install the module by 
> downloading all the dependencies (tar.gz files) and building it. Even
> then segfault occured. Is there any problem in changing only the
> opcodes.py file ? I did something horribly wrong here. Hope someone
> will help...

I don't know. You modified this yourself. If I were in your situation, what
I would have done is to 

 - modify the version-information stored in my PYC-files so that I'm sure I
don't accidentally load any "normal" PYC-files. Python does check that
through some magic number, make sure you use your own.

 - fire up the debugger and see where the segfault actually happens. Nobody
can be helping you there, because it's *your* code, not Python anymore. And
giving others access to it defies somewhat the purpose of the whole
exercise....

Diez



More information about the Python-list mailing list