[Python-talk] using old .pyc files

David Betz dbetz at xlisper.com
Fri Aug 25 12:20:27 EDT 2006


Thanks for checking into this. I guess there are advantages to being  
able to change the bytecode definitions from one version to the next.  
It means you aren't locked into a bad design decision made early on.  
On the other hand, one of the things I like most about Java is the  
JVM definition. There is an official documented binary representation  
of Java programs that is guaranteed to work from version to version.  
I suppose this started with UCSD Pascal but I really became aware of  
it with the release of Smalltalk 80. Does anyone know if there has  
been any effort to standardize a Python virtual machine like the Java  
virtual machine? Of course, there is a Python->JVM compiler I think  
but that's not quite the same thing.

On Aug 25, 2006, at 11:41 AM, Bill Sconce wrote:

> 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...
> _______________________________________________
> Python-talk mailing list
> Python-talk at dlslug.org
> http://dlslug.org/mailman/listinfo/python-talk



More information about the Python-talk mailing list