On 2020-04-09 12:23, Sylvain Corlay wrote:
I hope I am not breaking any rules by posting here. I maintain a number of libraries and C++ Python extensions and one slightly annoying thing about the Python.h headers is that it includes headers defining macros such as *snprintf*.
In C++, this collides with std::snprintf defined in the <cstdio>. One backward-compatible way to make these collision less likely would be to make this macro a function-style macro - so that we could prevent the macro expansion in client code by simply adding parentheses to the calls to the actual functions.
In my opinion, it would make the world a better place for C++ Python extension authors :)
This is already reported: https://bugs.python.org/issue36020
Python should use PyOS_snprintf instead where possible.
(Unfortunately I don't currently have time to work on this.)