[PATCH 1 of 7] util: add a macro initializing CPython modules
Jun Wu
quark at fb.com
Sat May 13 14:14:21 EDT 2017
Excerpts from Yuya Nishihara's message of 2017-05-13 22:45:14 +0900:
> I got lots of warnings because of the precheck/postinit expansion:
>
> mercurial/util.h:80:16: warning: the comparison will always evaluate as
> 'true' for the address of 'module_init' will never be NULL [-Waddress]
>
> > + ((int (*)(PyObject *))postinit)(m); \
>
> It's dangerous to disable compiler type checking.
>
> Overall, I prefer not using a big macro like this even though it could get
> rid of some redundant codes.
This is mainly responding to Greg's comment about code duplication.
Let me try if I can keep compiler type checking and remove those warnings.
If I can do that, I think the approach is still better - it avoids
unintentional Py2 and Py3 inconsistence. For example, mpatchError is exposed
in Py3, but not Py2 in current code.
> Adding "version" constants seems good to me.
More information about the Mercurial-devel
mailing list