(pardon any awkward formatting, writing from webinterface instead of a
"proper" client. Please yell at me off-list or on irc if this post is
excessively broken.)

> https://bugs.gentoo.org/show_bug.cgi?id=300922

>From that bug:

> - chpathtool does some "simple" heuristic to switch the build EPREFIX
>   to the new target EPREFIX
>
> - python (seemingly) doesn't like when the pyc files are changed and *not* 
> regenerated.
>   You will see the message: "Bad marshalling data"

I'm not sure if I'm interpreting this correctly, but it sounds as if
your chpathtool edits the .pyc file to replace the path? If yes: that
will indeed not work, as strings are stored length-prefixed. You
cannot sensibly edit .pyc files, you should normally just rewrite
them.

The .pyc/.pyo file store a version-dependent magic, the mtime of their
corresponding .py file, and (since recently) the size of the
correspondig .py file. If either changes the .pyc/.pyo is regenerated.
The magic does not normally change in released pythons, so that's not
much of a problem. The mtime is probably no longer a problem these
days either.

There used to be a more subtle problem: the python objects you import
have the path to their source embedded into them, and if you move the
.pyc/.pyo file around that path would be wrong, confusing some (mostly
debugging) tools (see http://bugs.python.org/issue1180193 ). This was
fixed fairly recently (in python 3, python 2.7 and python 2.6.2), so
it is probably no longer worth worrying about, but it's probably one
reason these files were handled this way in the past.

-- 
Marien Zwart (marienz)

Reply via email to