STINNER Victor added the comment: It is possible to implement type checking in C macros.
Example found on the Internet: /* inline type checking - can mix in with other macros more easily using the comma operator, * C11 gives best results here */ #if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L) # define CHECK_TYPE_INLINE(val, type) \ (void)((void)(((type)0) != (0 ? (val) : ((type)0))), \ _Generic((val), type: 0, const type: 0)) #else # define CHECK_TYPE_INLINE(val, type) \ ((void)(((type)0) != (0 ? (val) : ((type)0)))) #endif http://stackoverflow.com/questions/11449632/checking-types-of-macro-parameters-at-compile-time See also Include/pymacro.h which contains some macros implementing checks tested at the compilation. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue26824> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com