Steve Holden wrote:
Having said which, if the module was loaded from a .pyc file then the
bytecode is available from that - take everything but the first eight
bytes and use marshal.loads() to turn it back into a code object:
Yup. As I explained in the other message, this is basically
what I'm doing at the moment (with a few twists; it reads the .py
file if no .pyc is available).
But I also want the bytecode of modules that don't have a .pyc file,
possibly because they have already been 'dynamically' loaded from
another bytecode string ;-)
Now, I could ofcourse store the bytecode string that I started
with *inside* the module itself, in a special attribute or so.
This just occurred to me and I think it's a possible solution.
But the bytecodes must be stored by Python itself somewhere
already... because Python is able to execute my module... right?
I want them! :-)
Note that the ugly details *might* change, and that byte codes are
version-dependent.
I know, but this fact was not yet mentioned in the Pyro manual.
Thanks for reminding me, I'll add it.
--Irmen
--
http://mail.python.org/mailman/listinfo/python-list