[Python-talk] using old .pyc files

Bill Sconce sconce at in-spec-inc.com
Fri Aug 25 11:41:24 EDT 2006


On Fri, 25 Aug 2006 09:05:39 -0400
Python <python at venix.com> wrote:

> At the close of the meeting, the question was raised about using old
> compiled python modules with a newer version of Python.
> 
> Using an old compiled python module with a newer version of Python does
> not work.  The Python interpreter checks a "magic number" looking for a
> version match.  I suspect the main issue would be the compiled libraries
> that get used in the background.  I tested using a 2.3.3 pyc against the
> 2.4.3 interpreter.  You should be OK with minor upgrades (e.g.2.3.3 to
> 2.3.4).



Very interesting.  If I knew that I'd forgotten, and it IS a good thing
to know.  (It's not worse than the situation with versions shared libaries
or versions of DLLs or versions of gcc, I guess.)

The fact that it's such an obscure question is a testament to Python's
design, come to think of it.  You tell Python to run "spam.py" and The
Right Thing just happens:  out-of-date .py programs are pulled in and
compiled as necessary, up-to-date .pyc files are just read in and used
-- we know that compilation is involved, but we almost never have to
see it.  ("make"?  What's that?)

Thanks for looking that up, Lloyd.

-Bill


P.S. And thanks to you all for coming.  We had a dynamite evening.  Too
MUCH show and tell, with a number of us now reporting "I did this with
Python", "I did that with Python".  Ray's Web-test driver is a great
story -- how else could you get so far with end-to-end testing with
code fitting on two sheets of paper.  (Ok, ok, printed double sided.  :)
So much stuff that we ran over on time, and I weaseled out of my
presentation on byte-code disassembly -- which I'll do next time, I
promise.  Maybe Ted will chair the meeting and keep me honest...


More information about the Python-talk mailing list