diff options
author | Victor Stinner <vstinner@python.org> | 2024-04-30 20:29:48 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-30 20:29:48 (GMT) |
commit | 587388ff22dc7cfa4b66722daf0d33cd804af9f2 (patch) | |
tree | 1d52a2c1368208c8c8d548ccf183c056135860b5 /Lib/test/test_cppext/extension.cpp | |
parent | 6999d68d2878871493d85dc63599f3d44eada104 (diff) | |
download | cpython-587388ff22dc7cfa4b66722daf0d33cd804af9f2.zip cpython-587388ff22dc7cfa4b66722daf0d33cd804af9f2.tar.gz cpython-587388ff22dc7cfa4b66722daf0d33cd804af9f2.tar.bz2 |
gh-118124: Use static_assert() in Py_BUILD_ASSERT() on C11 (#118398)
Use static_assert() in Py_BUILD_ASSERT() and Py_BUILD_ASSERT_EXPR()
on C11 and newer and C++11 and newer.
Add tests to test_cext and test_cppext.
Diffstat (limited to 'Lib/test/test_cppext/extension.cpp')
-rw-r--r-- | Lib/test/test_cppext/extension.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/Lib/test/test_cppext/extension.cpp b/Lib/test/test_cppext/extension.cpp index a569c22..ab485b6 100644 --- a/Lib/test/test_cppext/extension.cpp +++ b/Lib/test/test_cppext/extension.cpp @@ -225,6 +225,10 @@ _testcppext_exec(PyObject *module) if (!result) return -1; Py_DECREF(result); + // test Py_BUILD_ASSERT() and Py_BUILD_ASSERT_EXPR() + Py_BUILD_ASSERT(sizeof(int) == sizeof(unsigned int)); + assert(Py_BUILD_ASSERT_EXPR(sizeof(int) == sizeof(unsigned int)) == 0); + return 0; } |