Embedded python can't import .pyo

Michael Hudson mwh at python.net
Tue Aug 27 18:16:52 CEST 2002


fgagnon at iphrase.com (Francois Gagnon) writes:

> I had a look into the python source code and found this global variable:
> Py_OptimizeFlag.  So I hacked my code a bit to the following which works:
> 
> extern int Py_OptimizeFlag;
> ...
> Py_OptimizeFlag++;
> Py_Initialize();
> ...
> 
> However, this is not very elegant and risky as future release of Python
> could change or use that flag differently.  Are there any API call I can
> make to turn the optimize flag on so I can load my .pyo files?  Something
> like:

Py_OptimizeFlag is part of the public Python C API, I believe.  So
there should be no need to declare it extern int and no need to worry
about versioning problems.  It do much in 2.3, but that's another
story...

Cheers,
M.

-- 
  ... when all the programmes on all the channels actually were made
  by actors with cleft pallettes speaking lines by dyslexic writers
  filmed by blind cameramen instead of merely seeming like that, it
  somehow made the whole thing more worthwhile.   -- HHGTG, Episode 11



More information about the Python-list mailing list