[PATCH 2 of 8] base85: add _version to help detect breaking binary changes
Jun Wu
quark at fb.com
Tue May 2 20:19:59 EDT 2017
# HG changeset patch
# User Jun Wu <quark at fb.com>
# Date 1493167548 25200
# Tue Apr 25 17:45:48 2017 -0700
# Node ID 28d82d6b0db973570d25d1082a9977ed1bb695de
# Parent 9073b1dfb58eb71c1005dad5267b6ee4f09790da
# Available At https://bitbucket.org/quark-zju/hg-draft
# hg pull https://bitbucket.org/quark-zju/hg-draft -r 28d82d6b0db9
base85: add _version to help detect breaking binary changes
diff --git a/mercurial/base85.c b/mercurial/base85.c
--- a/mercurial/base85.c
+++ b/mercurial/base85.c
@@ -158,4 +158,8 @@ static PyMethodDef methods[] = {
};
+/* Binary version. When breaking changes are made, bump this number and change
+ * __init__.py, so the module loader can notice and fallback to pure. */
+static const int _version = 1;
+
#ifdef IS_PY3K
static struct PyModuleDef base85_module = {
@@ -169,14 +173,18 @@ static struct PyModuleDef base85_module
PyMODINIT_FUNC PyInit_base85(void)
{
+ PyObject *m;
b85prep();
- return PyModule_Create(&base85_module);
+ m = PyModule_Create(&base85_module);
+ PyModule_AddIntConstant(m, "_version", _version);
}
#else
PyMODINIT_FUNC initbase85(void)
{
- Py_InitModule3("base85", methods, base85_doc);
+ PyObject *m;
+ m = Py_InitModule3("base85", methods, base85_doc);
b85prep();
+ PyModule_AddIntConstant(m, "_version", _version);
}
#endif
More information about the Mercurial-devel
mailing list