mercurial/diffhelpers.c
changeset 32357 2f51f4c535d2
parent 23964 f1c127df7c4f
equal deleted inserted replaced
32356:7948adb53e28 32357:2f51f4c535d2
   162 	{"fix_newline", fix_newline, METH_VARARGS, "fixup newline counters\n"},
   162 	{"fix_newline", fix_newline, METH_VARARGS, "fixup newline counters\n"},
   163 	{"testhunk", testhunk, METH_VARARGS, "test lines in a hunk\n"},
   163 	{"testhunk", testhunk, METH_VARARGS, "test lines in a hunk\n"},
   164 	{NULL, NULL}
   164 	{NULL, NULL}
   165 };
   165 };
   166 
   166 
       
   167 static const int version = 1;
       
   168 
   167 #ifdef IS_PY3K
   169 #ifdef IS_PY3K
   168 static struct PyModuleDef diffhelpers_module = {
   170 static struct PyModuleDef diffhelpers_module = {
   169 	PyModuleDef_HEAD_INIT,
   171 	PyModuleDef_HEAD_INIT,
   170 	"diffhelpers",
   172 	"diffhelpers",
   171 	diffhelpers_doc,
   173 	diffhelpers_doc,
   183 
   185 
   184 	diffhelpers_Error = PyErr_NewException("diffhelpers.diffhelpersError",
   186 	diffhelpers_Error = PyErr_NewException("diffhelpers.diffhelpersError",
   185 											NULL, NULL);
   187 											NULL, NULL);
   186 	Py_INCREF(diffhelpers_Error);
   188 	Py_INCREF(diffhelpers_Error);
   187 	PyModule_AddObject(m, "diffhelpersError", diffhelpers_Error);
   189 	PyModule_AddObject(m, "diffhelpersError", diffhelpers_Error);
       
   190 	PyModule_AddIntConstant(m, "version", version);
   188 
   191 
   189 	return m;
   192 	return m;
   190 }
   193 }
   191 #else
   194 #else
   192 PyMODINIT_FUNC
   195 PyMODINIT_FUNC
   193 initdiffhelpers(void)
   196 initdiffhelpers(void)
   194 {
   197 {
   195 	Py_InitModule3("diffhelpers", methods, diffhelpers_doc);
   198 	PyObject *m;
       
   199 	m = Py_InitModule3("diffhelpers", methods, diffhelpers_doc);
   196 	diffhelpers_Error = PyErr_NewException("diffhelpers.diffhelpersError",
   200 	diffhelpers_Error = PyErr_NewException("diffhelpers.diffhelpersError",
   197 	                                        NULL, NULL);
   201 	                                        NULL, NULL);
       
   202 	PyModule_AddIntConstant(m, "version", version);
   198 }
   203 }
   199 #endif
   204 #endif