[Python-Dev] Marshal bug in 2.1?

M.-A. Lemburg mal@lemburg.com
Sat, 02 Jun 2001 13:09:13 +0200


Christian Tismer wrote:
> 
> Thomas Wouters wrote:
> >
> > On Fri, Jun 01, 2001 at 09:01:38PM +0200, M.-A. Lemburg wrote:
> >
> > > Yes, not suprisingly though... AFAIK the pyc format changed
> > > in every single version between 1.5.2 and 2.1.
> >
> > Worse, it's changed several times between each release :)
> 
> But I didn't use .pyc at all, just a marshalled code object.

That's the point: the header in pyc files is meant to signal
the incompatibility of the following code object. Perhaps
we should moev this version information into the marshal
format of code objects themselves...

> There are no version headers or such.
> The same object worked in fact for Py 1.5.2 and 2.0, but no
> longer with 2.1 .
> I debugged the unmarshalling and saw what happened:
> The new code objects with their new scoping features were
> the problem. The new structures were simply added, and there
> is no way to skip these for older code objects, since there
> isn't any info.
> Some option for marshal to umarshal old-style code objects
> would ave helped.
> But then, I'm not sure if the opcodes are still assigned
> the same way in 2.1, or if there was some movement? This would
> kill it anyway.

AFAIK, the assignments did not change, but several opcodes
were added in 2.1, so code compiled in 2.1 will no run in
2.0.
 
> ciao - chris
> 
> (now looking for another cheap way to do something invisible in
>  Python without installing *anything* )

Why don't you use freeze or py2exe or Gordon's installer for
these one file executables ? Alternatively, you should check the
Python version and make sure that it matches the one used for
compiling the byte code.

-- 
Marc-Andre Lemburg
CEO eGenix.com Software GmbH
______________________________________________________________________
Company & Consulting:                           http://www.egenix.com/
Python Software:                        http://www.lemburg.com/python/