Running Mercurial with a custom Python version: version mismatch

Matt Mackall mpm at selenic.com
Fri Aug 29 16:23:55 UTC 2014


On Fri, 2014-08-29 at 14:42 +0200, Thomas De Schampheleire wrote:
> Hi,
> 
> Commits 3681de20b0a7 / 21dafd8546d1 ("parsers: fail fast if Python has
> wrong minor version (issue4110)") introduced a check on the running
> Python version. If the version doesn't match the version Mercurial was
> compiled with, the operation is aborted.
> 
> This implies that a user can no longer use Mercurial with a custom
> Python version, or use a custom Mercurial version without updating
> Python.

It's always been the case that Mercurial is tied to the version of
Python it was built against. This is because Python regularly changes
its internal API in ways that break extensions.

Python thus has an internal system that _is supposed to_ aggressively
refuse to load extensions when they introduce API breakage.
Unfortunately, it's not aggressive enough: they occasionally
accidentally add API breakage without bumping their API number.

So this patch was put in because people were using Mercurial with
different versions of Python _and_ Python was failing to catch the
problem on its own like it's supposed to _and_ that was causing painful,
hard-to-diagnose breakage.


On the other hand, it's trivial to install multiple versions of
Mercurial linked against multiple versions of Python:

$ hg clone hg hg3.1-python2.5
$ cd hg3.1-python2.5
$ hg co 3.1
$ make PYTHON=python2.5 local
$ ln -s $PWD/hg ~/bin/hg3.1-python2.5

(I actually have over 100 releases of Mercurial in my path..)

-- 
Mathematics is the supreme nostalgia of our time.





More information about the Mercurial mailing list