GeezerVison is showing github.com — gh-157649: Merge test_cppext into test_cext by vstinner · Pull Request #158176 · python/cpython
Conversation
vstinner
commented
Sep 25, 2026
•
edited by bedevere-app
Bot
Loading
Uh oh!
There was an error while loading. Please reload this page.
- test_cext now uses a single virtual environment for all tests. It makes the test way faster since creating a virtual environment is quite slow.
- Add Py_TARGET_ABI3T test on C++.
- Move macro tests from module exec function to test_macros().
- Call Py_BEGIN_CRITICAL_SECTION() on a fresh dictionary object, rather than on the module.
- Rename some environment variables to always use "CPYTHON_TEST_" prefix.
- Replace support.MS_WINDOWS with MSVC to be more explicit.
- Move macro tests to test_macros().
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
chris-eibl reacted with rocket emoji
* test_cext now uses a single virtual environment for all tests.
It makes the test way faster since creating a virtual environment
is quite slow.
* Add Py_TARGET_ABI3T test on C++.
* Move macro tests from module exec function to test_macros().
* Call Py_BEGIN_CRITICAL_SECTION() on a fresh dictionary object,
rather than on the module.
* Rename some environment variables to always use "CPYTHON_TEST_"
prefix.
* Replace support.MS_WINDOWS with MSVC to be more explicit.
* Move macro tests to test_macros().
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
test_cext and test_cppext had a lot of duplicated code with only minor differences. Merging the two tests makes sure that most code is shared between C and C++ tests to keep code consistent.
For example, this PR adds PyUnicode tests in C and adds Py_TARGET_ABI3T tests in C++.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
test_cext fails on macOS:
ERROR: test_build (test.test_cext.TestPublicCpp.test_build)
ERROR: test_build_intel_asm (test.test_cext.TestPublicCpp.test_build_intel_asm)
Example:
Building wheels for collected packages: internal__test_cppext
Building wheel for internal__test_cppext (pyproject.toml): started
Running command Building wheel for internal__test_cppext (pyproject.toml)
Language: C++
Source: extension.cpp
CC env var: 'gcc'
CXX env var: <missing>
CFLAGS env var: <missing>
CPPFLAGS env var: <missing>
CXXFLAGS env var: <missing>
extra_compile_args: ['-Werror', '-DMODULE_NAME=_test_cppext', '-pedantic-errors', '-Wno-long-long']
running bdist_wheel
running build
running build_ext
building '_test_cppext' extension
creating build/temp.macosx-13.7-x86_64-cpython-316t-pydebug
/usr/bin/clang++ -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -fno-strict-overflow -Wsign-compare -g -Og -Wall -I/Users/buildbot/buildarea/pull_request.itamaro-macos-intel-aws.nogil/build/build/test_python_98426æ/tempcwd/env/include -I/Users/buildbot/buildarea/pull_request.itamaro-macos-intel-aws.nogil/build/Include -I/Users/buildbot/buildarea/pull_request.itamaro-macos-intel-aws.nogil/build -c extension.cpp -o build/temp.macosx-13.7-x86_64-cpython-316t-pydebug/extension.o -Werror -DMODULE_NAME=_test_cppext -pedantic-errors -Wno-long-long
In file included from extension.cpp:3:
In file included from ./extension.c:16:
In file included from /Users/buildbot/buildarea/pull_request.itamaro-macos-intel-aws.nogil/build/Include/Python.h:72:
In file included from /Users/buildbot/buildarea/pull_request.itamaro-macos-intel-aws.nogil/build/Include/pymem.h:103:
/Users/buildbot/buildarea/pull_request.itamaro-macos-intel-aws.nogil/build/Include/cpython/pymem.h:28:39: error: commas at the end of enumerator lists are a C++11 extension [-Werror,-Wc++11-extensions]
PYMEM_ALLOCATOR_MIMALLOC_DEBUG = 8,
^
In file included from extension.cpp:3:
In file included from ./extension.c:16:
In file included from /Users/buildbot/buildarea/pull_request.itamaro-macos-intel-aws.nogil/build/Include/Python.h:79:
In file included from /Users/buildbot/buildarea/pull_request.itamaro-macos-intel-aws.nogil/build/Include/object.h:742:
/Users/buildbot/buildarea/pull_request.itamaro-macos-intel-aws.nogil/build/Include/cpython/object.h:476:36: error: commas at the end of enumerator lists are a C++11 extension [-Werror,-Wc++11-extensions]
PyRefTracer_TRACKER_REMOVED = 2,
^
In file included from extension.cpp:3:
In file included from ./extension.c:16:
In file included from /Users/buildbot/buildarea/pull_request.itamaro-macos-intel-aws.nogil/build/Include/Python.h:99:
In file included from /Users/buildbot/buildarea/pull_request.itamaro-macos-intel-aws.nogil/build/Include/dictobject.h:113:
/Users/buildbot/buildarea/pull_request.itamaro-macos-intel-aws.nogil/build/Include/cpython/dictobject.h:90:27: error: commas at the end of enumerator lists are a C++11 extension [-Werror,-Wc++11-extensions]
PY_FOREACH_DICT_EVENT(PY_DEF_EVENT)
^
In file included from extension.cpp:3:
In file included from ./extension.c:16:
In file included from /Users/buildbot/buildarea/pull_request.itamaro-macos-intel-aws.nogil/build/Include/Python.h:106:
/Users/buildbot/buildarea/pull_request.itamaro-macos-intel-aws.nogil/build/Include/cpython/funcobject.h:142:27: error: commas at the end of enumerator lists are a C++11 extension [-Werror,-Wc++11-extensions]
PY_FOREACH_FUNC_EVENT(PY_DEF_EVENT)
^
In file included from extension.cpp:3:
In file included from ./extension.c:16:
In file included from /Users/buildbot/buildarea/pull_request.itamaro-macos-intel-aws.nogil/build/Include/Python.h:110:
/Users/buildbot/buildarea/pull_request.itamaro-macos-intel-aws.nogil/build/Include/cpython/code.h:236:27: error: commas at the end of enumerator lists are a C++11 extension [-Werror,-Wc++11-extensions]
PY_FOREACH_CODE_EVENT(PY_DEF_EVENT)
^
In file included from extension.cpp:3:
In file included from ./extension.c:16:
In file included from /Users/buildbot/buildarea/pull_request.itamaro-macos-intel-aws.nogil/build/Include/Python.h:129:
/Users/buildbot/buildarea/pull_request.itamaro-macos-intel-aws.nogil/build/Include/cpython/context.h:36:28: error: commas at the end of enumerator lists are a C++11 extension [-Werror,-Wc++11-extensions]
Py_CONTEXT_SWITCHED = 1,
^
6 errors generated.
error: command '/usr/bin/clang++' failed with exit code 1
It seems like clang++ uses a C++ version older than C++11 by default. It's likely the old Apple clang++ which uses gnu++98 by default. I changed the two affected TestPublicCpp tests to use C++11 by default on macOS.
It's unclear to me why the same passed on macOS before this change. But I don't have access to macOS, so I cannot investigate. Well, my change should fix macOS support.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
!buildbot AMD64 Fedora Stable
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
🤖 New build scheduled with the buildbot fleet by @vstinner for commit ee31df3 🤖
Results will be shown at:
https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F158176%2Fmerge
The command will test the builders whose names match following regular expression: AMD64 Fedora Stable
The builders matched are:
AMD64 Fedora Stable LTO + PGO PR
AMD64 Fedora Stable LTO PR
AMD64 Fedora Stable PR
AMD64 Fedora Stable Clang PR
AMD64 Fedora Stable Clang Installed PR
AMD64 Fedora Stable Refleaks PR
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
vstinner
added a commit
that referenced
this pull request
Oct 12, 2026
* test_cext now uses a single virtual environment for all tests.
It makes the test way faster since creating a virtual environment
is quite slow.
* Add Py_TARGET_ABI3T test on C++.
* Move macro tests from module exec function to test_macros().
* Call Py_BEGIN_CRITICAL_SECTION() on a fresh dictionary object,
rather than on the module.
* Rename some environment variables to always use "CPYTHON_TEST_"
prefix.
* Replace support.MS_WINDOWS with MSVC to be more explicit.
* Move macro tests to test_macros().
* On macOS, use C++11 by default.
(cherry picked from commit b71989d)
vstinner
added a commit
that referenced
this pull request
Oct 13, 2026
#159276)
* [3.15] gh-157649: Merge test_cppext into test_cext (#158176) (#159264)
* test_cext now uses a single virtual environment for all tests.
It makes the test way faster since creating a virtual environment
is quite slow.
* Add Py_TARGET_ABI3T test on C++.
* Move macro tests from module exec function to test_macros().
* Call Py_BEGIN_CRITICAL_SECTION() on a fresh dictionary object,
rather than on the module.
* Rename some environment variables to always use "CPYTHON_TEST_"
prefix.
* Replace support.MS_WINDOWS with MSVC to be more explicit.
* Move macro tests to test_macros().
* On macOS, use C++11 by default.
(cherry picked from commit b71989d)
(cherry picked from commit 364db5d)
* Fix warning about unused dict
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
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.
|