base85: add version to help detect breaking binary changes
authorJun Wu <quark@fb.com>
Tue, 25 Apr 2017 17:45:48 -0700
changeset 32356 7948adb53e28
parent 32355 4195b84940e9
child 32357 2f51f4c535d2
base85: add version to help detect breaking binary changes
mercurial/base85.c
--- 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