[issue17917] use PyModule_AddIntMacro() instead of PyModule_AddIntConstant() when applicable

Charles-François Natali report at bugs.python.org
Tue May 7 09:14:18 CEST 2013


Charles-François Natali added the comment:

> PC/_msi.c: Oh, here you should remove cast to int. Example:
>
> PyModule_AddIntMacro(m, (int)MSIDBOPEN_CREATEDIRECT);
>
> I'm surprised that the does compile. You may have a "(int)MSIDBOPEN_CREATEDIRECT" variable :-)

Probably, good catch ;-)
I'll fix that.

> Modules/fcntlmodule.c and Modules/posixmodule.c are using explicit cast to long. I don't know if there is a good reason for such cast.

There's a prototype, so arguments are implicitly converted to long:

PyAPI_FUNC(int) PyModule_AddIntConstant(PyObject *, const char *, long);
#define PyModule_AddIntMacro(m, c) PyModule_AddIntConstant(m, #c, c)

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue17917>
_______________________________________


More information about the Python-bugs-list mailing list