diff -Naur Python-3.8.0-orig/Include/bytesobject.h Python-3.8.0/Include/bytesobject.h --- Python-3.8.0-orig/Include/bytesobject.h 2019-10-14 16:34:47.000000000 +0300 +++ Python-3.8.0/Include/bytesobject.h 2019-10-22 10:03:56.031451300 +0300 @@ -52,9 +52,9 @@ PyAPI_FUNC(PyObject *) PyBytes_FromString(const char *); PyAPI_FUNC(PyObject *) PyBytes_FromObject(PyObject *); PyAPI_FUNC(PyObject *) PyBytes_FromFormatV(const char*, va_list) - Py_GCC_ATTRIBUTE((format(printf, 1, 0))); + Py_PRINTF(1, 0); PyAPI_FUNC(PyObject *) PyBytes_FromFormat(const char*, ...) - Py_GCC_ATTRIBUTE((format(printf, 1, 2))); + Py_PRINTF(1, 2); PyAPI_FUNC(Py_ssize_t) PyBytes_Size(PyObject *); PyAPI_FUNC(char *) PyBytes_AsString(PyObject *); PyAPI_FUNC(PyObject *) PyBytes_Repr(PyObject *, int); diff -Naur Python-3.8.0-orig/Include/pyerrors.h Python-3.8.0/Include/pyerrors.h --- Python-3.8.0-orig/Include/pyerrors.h 2019-10-14 16:34:47.000000000 +0300 +++ Python-3.8.0/Include/pyerrors.h 2019-10-22 10:03:56.437052000 +0300 @@ -319,9 +319,9 @@ #include PyAPI_FUNC(int) PyOS_snprintf(char *str, size_t size, const char *format, ...) - Py_GCC_ATTRIBUTE((format(printf, 3, 4))); + Py_PRINTF(3, 4); PyAPI_FUNC(int) PyOS_vsnprintf(char *str, size_t size, const char *format, va_list va) - Py_GCC_ATTRIBUTE((format(printf, 3, 0))); + Py_PRINTF(3, 0); #ifndef Py_LIMITED_API # define Py_CPYTHON_ERRORS_H diff -Naur Python-3.8.0-orig/Include/sysmodule.h Python-3.8.0/Include/sysmodule.h --- Python-3.8.0-orig/Include/sysmodule.h 2019-10-14 16:34:47.000000000 +0300 +++ Python-3.8.0/Include/sysmodule.h 2019-10-22 10:03:56.858252800 +0300 @@ -15,9 +15,9 @@ PyAPI_FUNC(void) PySys_SetPath(const wchar_t *); PyAPI_FUNC(void) PySys_WriteStdout(const char *format, ...) - Py_GCC_ATTRIBUTE((format(printf, 1, 2))); + Py_PRINTF(1, 2); PyAPI_FUNC(void) PySys_WriteStderr(const char *format, ...) - Py_GCC_ATTRIBUTE((format(printf, 1, 2))); + Py_PRINTF(1, 2); PyAPI_FUNC(void) PySys_FormatStdout(const char *format, ...); PyAPI_FUNC(void) PySys_FormatStderr(const char *format, ...); --- Python-3.9.5/Include/pyport.h.orig 2021-05-14 15:30:48.522516700 +0300 +++ Python-3.9.5/Include/pyport.h 2021-05-14 15:44:47.249415100 +0300 @@ -796,6 +798,12 @@ #define Py_VA_COPY va_copy +#if defined(__GNUC__) && ((__GNUC__ == 4 && __GNUC_MINOR__>= 4) || __GNUC__ > 4) +# define Py_PRINTF(X,Y) Py_GCC_ATTRIBUTE((format(gnu_printf,X,Y))) +#else +# define Py_PRINTF(X,Y) Py_GCC_ATTRIBUTE((format(printf,X,Y))) +#endif + /* * Convenient macros to deal with endianness of the platform. WORDS_BIGENDIAN is * detected by configure and defined in pyconfig.h. The code in pyconfig.h