Patchwork [2,of,6,V2] base85: add version to help detect breaking binary changes

login
register
mail settings
Submitter Jun Wu
Date May 19, 2017, 3:46 p.m.
Message ID <bd01a5b895000ea87915.1495208769@x1c>
Download mbox | patch
Permalink /patch/20731/
State Accepted
Headers show

Comments

Jun Wu - May 19, 2017, 3:46 p.m.
# HG changeset patch
# User Jun Wu <quark@fb.com>
# Date 1493167548 25200
#      Tue Apr 25 17:45:48 2017 -0700
# Node ID bd01a5b895000ea8791540098b38ae78bed15a2f
# Parent  90ad5352d3c20b5f463d814b46cef15512edbacb
# Available At https://bitbucket.org/quark-zju/hg-draft
#              hg pull https://bitbucket.org/quark-zju/hg-draft -r bd01a5b89500
base85: add version to help detect breaking binary changes
Yuya Nishihara - May 20, 2017, 4:14 a.m.
On Fri, 19 May 2017 08:46:09 -0700, Jun Wu wrote:
> # HG changeset patch
> # User Jun Wu <quark@fb.com>
> # Date 1493167548 25200
> #      Tue Apr 25 17:45:48 2017 -0700
> # Node ID bd01a5b895000ea8791540098b38ae78bed15a2f
> # Parent  90ad5352d3c20b5f463d814b46cef15512edbacb
> # Available At https://bitbucket.org/quark-zju/hg-draft
> #              hg pull https://bitbucket.org/quark-zju/hg-draft -r bd01a5b89500
> base85: add version to help detect breaking binary changes

Queued the series, thanks!

>  PyMODINIT_FUNC PyInit_base85(void)
>  {
> +	PyObject *m;
>  	b85prep();
>  
> -	return PyModule_Create(&base85_module);
> +	m = PyModule_Create(&base85_module);
> +	PyModule_AddIntConstant(m, "version", version);
>  }

Added missed 'return m' in flight.

Patch

diff --git a/mercurial/base85.c b/mercurial/base85.c
--- a/mercurial/base85.c
+++ b/mercurial/base85.c
@@ -158,4 +158,6 @@  static PyMethodDef methods[] = {
 };
 
+static const int version = 1;
+
 #ifdef IS_PY3K
 static struct PyModuleDef base85_module = {
@@ -169,14 +171,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