1 |
(pardon any awkward formatting, writing from webinterface instead of a |
2 |
"proper" client. Please yell at me off-list or on irc if this post is |
3 |
excessively broken.) |
4 |
|
5 |
> https://bugs.gentoo.org/show_bug.cgi?id=300922 |
6 |
|
7 |
From that bug: |
8 |
|
9 |
> - chpathtool does some "simple" heuristic to switch the build EPREFIX |
10 |
> to the new target EPREFIX |
11 |
> |
12 |
> - python (seemingly) doesn't like when the pyc files are changed and *not* regenerated. |
13 |
> You will see the message: "Bad marshalling data" |
14 |
|
15 |
I'm not sure if I'm interpreting this correctly, but it sounds as if |
16 |
your chpathtool edits the .pyc file to replace the path? If yes: that |
17 |
will indeed not work, as strings are stored length-prefixed. You |
18 |
cannot sensibly edit .pyc files, you should normally just rewrite |
19 |
them. |
20 |
|
21 |
The .pyc/.pyo file store a version-dependent magic, the mtime of their |
22 |
corresponding .py file, and (since recently) the size of the |
23 |
correspondig .py file. If either changes the .pyc/.pyo is regenerated. |
24 |
The magic does not normally change in released pythons, so that's not |
25 |
much of a problem. The mtime is probably no longer a problem these |
26 |
days either. |
27 |
|
28 |
There used to be a more subtle problem: the python objects you import |
29 |
have the path to their source embedded into them, and if you move the |
30 |
.pyc/.pyo file around that path would be wrong, confusing some (mostly |
31 |
debugging) tools (see http://bugs.python.org/issue1180193 ). This was |
32 |
fixed fairly recently (in python 3, python 2.7 and python 2.6.2), so |
33 |
it is probably no longer worth worrying about, but it's probably one |
34 |
reason these files were handled this way in the past. |
35 |
|
36 |
-- |
37 |
Marien Zwart (marienz) |