gh-91731: Replace Py_BUILD_ASSERT() with static_assert()#91730
Merged
vstinner merged 1 commit intopython:mainfrom Apr 20, 2022
vstinner:static_assert
Merged
gh-91731: Replace Py_BUILD_ASSERT() with static_assert()#91730vstinner merged 1 commit intopython:mainfrom vstinner:static_assert
vstinner merged 1 commit intopython:mainfrom
vstinner:static_assert
Conversation
Member
Author
|
Failure on macOS: Oh, Python is still built with |
Member
Author
|
I will first merge #91733 which replaces |
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.
Member
Author
|
I scheduled buildbot jobs to check how it goes on other platforms/C compilers. |
Member
Author
This is unrelated to my PR. The leak is known in the main branch. |
Member
Author
|
Python was built successfully on various versions of Windows, macOS, Ubuntu and FreeBSD on various architectures. I confirm that it confirms that C11 is now well supported. If a platform doesn't support C11, it can reimplement static_assert() with Py_BUILD_ASSERT() or get a C11 compiler :-) I merge my PR. |
Member
Author
See #91757 |
This was referenced Apr 20, 2022
Closed
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Python 3.11 now uses C11 standard which adds static_assert()
to <assert.h>.
SIZEOF_TIME_T with #error.
the same size than _PyTime_t.
_PyTime_MAX: GetTickCount64() is unsigned, whereas _PyTime_t is
signed.