[PATCH 1 of 7 V2] util: add a macro initializing CPython modules
yuya at tcha.org
Sun May 14 00:44:25 EDT 2017
On Sat, 13 May 2017 21:08:59 -0700, Jun Wu wrote:
> 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; \
> > 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.
That could be a counter argument. Since it's a boilerplate code we won't
change too often, code duplication is just okay. That's my opinion.
More information about the Mercurial-devel