diff --git a/pythoncapi_compat.h b/pythoncapi_compat.h index ecc445e..791d511 100644 --- a/pythoncapi_compat.h +++ b/pythoncapi_compat.h @@ -2529,6 +2529,10 @@ PyBytesWriter_WriteBytes(PyBytesWriter *writer, return 0; } +static inline int +PyBytesWriter_Format(PyBytesWriter *writer, const char *format, ...) + Py_GCC_ATTRIBUTE((format(printf, 2, 0))); + static inline int PyBytesWriter_Format(PyBytesWriter *writer, const char *format, ...) { diff --git a/tests/setup.py b/tests/setup.py index 825241e..33a0e66 100755 --- a/tests/setup.py +++ b/tests/setup.py @@ -34,7 +34,11 @@ '-Wconversion', # /usr/lib64/pypy3.7/include/pyport.h:68:20: error: redefinition of typedef # 'Py_hash_t' is a C11 feature - "-Wno-typedef-redefinition", + '-Wno-typedef-redefinition', + # Formatting checks + '-Wformat', + '-Wformat-nonliteral', + '-Wformat-security', )) CFLAGS = COMMON_FLAGS + [ # Use C99 for pythoncapi_compat.c which initializes PyModuleDef with a