diff options
author | Victor Stinner <vstinner@python.org> | 2022-04-20 19:26:40 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-20 19:26:40 +0200 |
commit | 7cdaf87ec50f76c934ba651256484c4624b84ef2 (patch) | |
tree | 64ce3dcd176b6c0397f901f28e5406e3eca12588 /Python/initconfig.c | |
parent | ad3ca17ff5cd63f907430073b52be27695674148 (diff) | |
download | cpython-git-7cdaf87ec50f76c934ba651256484c4624b84ef2.tar.gz |
gh-91731: Replace Py_BUILD_ASSERT() with static_assert() (#91730)
Python 3.11 now uses C11 standard which adds static_assert()
to <assert.h>.
* 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.
Diffstat (limited to 'Python/initconfig.c')
-rw-r--r-- | Python/initconfig.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Python/initconfig.c b/Python/initconfig.c index d2e74f5878..729f7f393a 100644 --- a/Python/initconfig.c +++ b/Python/initconfig.c @@ -1507,9 +1507,11 @@ config_get_xoption_value(const PyConfig *config, wchar_t *name) static PyStatus config_init_hash_seed(PyConfig *config) { + static_assert(sizeof(_Py_HashSecret_t) == sizeof(_Py_HashSecret.uc), + "_Py_HashSecret_t has wrong size"); + const char *seed_text = config_get_env(config, "PYTHONHASHSEED"); - Py_BUILD_ASSERT(sizeof(_Py_HashSecret_t) == sizeof(_Py_HashSecret.uc)); /* Convert a text seed to a numeric one */ if (seed_text && strcmp(seed_text, "random") != 0) { const char *endptr = seed_text; |