[Python-Dev] Re: [Python-checkins] python/dist/src/Pythonmarshal.c, 1.79, 1.80

Armin Rigo arigo at tunes.org
Tue Dec 21 15:01:35 CET 2004


Hi Tim,

On Mon, Dec 20, 2004 at 07:26:25PM -0500, Tim Peters wrote:
> Still, it's a new-in-2.4 gimmick, and no pre-2.4 code could be using
> it.  I suppose Armin found a use for it in 2.4, but I'm still
> scratching my head.  If ZODB doesn't already depend on it, how useful
> can it be?  QED

Some code in the 'py' lib used to use marshal to send simple objects between
the main process and a subprocess.  We ran into trouble when we extended the
idea to a subprocess that would actually run via ssh on a remote machine, and
the remote machine's Python version didn't match the local one.  The obvious
quick fix was to set the 'version' argument to 0 and pretend that it would be
fine forever.

Now that we essentially can't use this trick any more because of the 2.4.0
bug, we reverted to repr/eval, which is quite slower (and actually not
guaranteed to work across Python versions either: string escapes sometimes
change).  We avoid to use cPickle because we want to be sure that only "simple
enough" objects are sent over this way -- essentially nothing that depends on
a precise Python module to be installed and identical on both machines.


Armin


More information about the Python-Dev mailing list