From 7cdaf87ec50f76c934ba651256484c4624b84ef2 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Wed, 20 Apr 2022 19:26:40 +0200 Subject: gh-91731: Replace Py_BUILD_ASSERT() with static_assert() (#91730) Python 3.11 now uses C11 standard which adds static_assert() to . * In pytime.c, replace Py_BUILD_ASSERT() with preprocessor checks on SIZEOF_TIME_T with #error. * On macOS, py_mach_timebase_info() now accepts timebase members with the same size than _PyTime_t. * py_get_monotonic_clock() now saturates GetTickCount64() to _PyTime_MAX: GetTickCount64() is unsigned, whereas _PyTime_t is signed. --- Python/fileutils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Python/fileutils.c') diff --git a/Python/fileutils.c b/Python/fileutils.c index 582c6bafd8..4f7f8944a7 100644 --- a/Python/fileutils.c +++ b/Python/fileutils.c @@ -956,7 +956,7 @@ static wchar_t * _Py_ConvertWCharForm(const wchar_t *source, Py_ssize_t size, const char *tocode, const char *fromcode) { - Py_BUILD_ASSERT(sizeof(wchar_t) == 4); + static_assert(sizeof(wchar_t) == 4, "wchar_t must be 32-bit"); /* Ensure we won't overflow the size. */ if (size > (PY_SSIZE_T_MAX / (Py_ssize_t)sizeof(wchar_t))) { -- cgit v1.2.1