[PATCH 1 of 7 V2] util: add a macro initializing CPython modules
Jun Wu
quark at fb.com
Sun May 14 00:08:59 EDT 2017
Excerpts from Yuya Nishihara's message of 2017-05-14 12:57:57 +0900:
> > + (void)postinit; \
This line could be changed to:
if ((postinit) == -1) \
return; \
> > + }
> > +#endif
>
> Maybe I'm a bit conservative about a macro use, but my concern here is,
> it's so easy to make postinint never be called.
>
> PYMODULEINIT(parsers, methods, parsers_doc, 1, check_python_version(),
> module_init)
Then it will get a warning: comparison between pointer and integer.
I think the benefit of code de-duplication is worth a complex marco. The
code using the macro won't get changed frequently so I won't worry too much
about it being used wrongly.
More information about the Mercurial-devel
mailing list