changeset 32359:dc51700be00c

osutil: add version to help detect breaking binary changes See the previous patch for why.
author Jun Wu <quark@fb.com>
date Tue, 25 Apr 2017 17:36:59 -0700
parents 5fc3459d0493
children af3ef002395d
files mercurial/osutil.c
diffstat 1 files changed, 9 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/osutil.c	Tue Apr 25 17:38:36 2017 -0700
+++ b/mercurial/osutil.c	Tue Apr 25 17:36:59 2017 -0700
@@ -1301,6 +1301,8 @@
 	{NULL, NULL}
 };
 
+static const int version = 1;
+
 #ifdef IS_PY3K
 static struct PyModuleDef osutil_module = {
 	PyModuleDef_HEAD_INIT,
@@ -1312,17 +1314,22 @@
 
 PyMODINIT_FUNC PyInit_osutil(void)
 {
+	PyObject *m;
 	if (PyType_Ready(&listdir_stat_type) < 0)
 		return NULL;
 
-	return PyModule_Create(&osutil_module);
+	m = PyModule_Create(&osutil_module);
+	PyModule_AddIntConstant(m, "version", version);
+	return m;
 }
 #else
 PyMODINIT_FUNC initosutil(void)
 {
+	PyObject *m;
 	if (PyType_Ready(&listdir_stat_type) == -1)
 		return;
 
-	Py_InitModule3("osutil", methods, osutil_doc);
+	m = Py_InitModule3("osutil", methods, osutil_doc);
+	PyModule_AddIntConstant(m, "version", version);
 }
 #endif