[PATCH 1 of 2 V2] phases: add set per phase in C phase computation

Matt Mackall mpm at selenic.com
Wed May 13 11:33:52 CDT 2015


On Tue, 2015-05-12 at 14:13 -0700, Laurent Charignon wrote:
> # HG changeset patch
> # User Laurent Charignon <lcharignon at fb.com>
> # Date 1427912237 25200
> #      Wed Apr 01 11:17:17 2015 -0700
> # Node ID 3ac4006b09e1bf149714eb444caa2452720ae4aa
> # Parent  e9edd53770fb77a9787a3e6592a3bf0a29c1bd80
> phases: add set per phase in C phase computation

So you changed the name:

> -static PyObject *compute_phases(indexObject *self, PyObject *args)
> +static PyObject *compute_revs_phases(indexObject *self, PyObject *args)

..but then un-changed it:

> -	{"computephases", (PyCFunction)compute_phases, METH_VARARGS,
> +	{"computephases", (PyCFunction)compute_revs_phases, METH_VARARGS,
>  		"compute phases"},

If you compile this, then update back one revision without recompiling,
it will break. The "old" Python code will still be able to find the
function it's looking for called computephases and die trying to treat
the returned tuple as a dict or list or whatever. Similarly, if someone
compiles the old C code and updates forward, they'll also explode but
for the opposite reason. This is a big headache for developers,
especially people like me who need to bisect a lot.

In other words, the contract with the C code is: Python can't rely on C
functions being present, but if they are, they'd better have constant
behavior.

-- 
Mathematics is the supreme nostalgia of our time.



More information about the Mercurial-devel mailing list