changeset 32395:7948adb53e28

base85: add version to help detect breaking binary changes
author Jun Wu <quark@fb.com>
date Tue, 25 Apr 2017 17:45:48 -0700
parents 4195b84940e9
children 2f51f4c535d2
files mercurial/base85.c
diffstat 1 files changed, 9 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/base85.c	Tue Apr 25 17:34:41 2017 -0700
+++ b/mercurial/base85.c	Tue Apr 25 17:45:48 2017 -0700
@@ -157,6 +157,8 @@
 	{NULL, NULL}
 };
 
+static const int version = 1;
+
 #ifdef IS_PY3K
 static struct PyModuleDef base85_module = {
 	PyModuleDef_HEAD_INIT,
@@ -168,15 +170,20 @@
 
 PyMODINIT_FUNC PyInit_base85(void)
 {
+	PyObject *m;
 	b85prep();
 
-	return PyModule_Create(&base85_module);
+	m = PyModule_Create(&base85_module);
+	PyModule_AddIntConstant(m, "version", version);
+	return m;
 }
 #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