summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_cppext/extension.cpp
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2024-03-19 14:03:27 (GMT)
committerGitHub <noreply@github.com>2024-03-19 14:03:27 (GMT)
commita114d08a8912a50530ab3f19842c6ba73b0d1017 (patch)
treee161344235cf2feb8d32a7a593134ec384c68e68 /Lib/test/test_cppext/extension.cpp
parent27cf3ed00cfe942f4277c273a3dda8ee2ba61fc8 (diff)
downloadcpython-a114d08a8912a50530ab3f19842c6ba73b0d1017.zip
cpython-a114d08a8912a50530ab3f19842c6ba73b0d1017.tar.gz
cpython-a114d08a8912a50530ab3f19842c6ba73b0d1017.tar.bz2
gh-92906: Enable test_cext and test_cppext on Windows (#117000)
On Windows in release mode, the test_cext and test_cppext can now build C and C++ extensions. * test_cext now also builds the C extension without options. * test_cppext now also builds the C++ extension without options. * Add C++14 test to test_cppext; C++11 is not supported by MSVC. * Make setup_venv_with_pip_setuptools_wheel() quiet when support.verbose is false. Only show stdout and stderr on failure.
Diffstat (limited to 'Lib/test/test_cppext/extension.cpp')
-rw-r--r--Lib/test/test_cppext/extension.cpp12
1 files changed, 5 insertions, 7 deletions
diff --git a/Lib/test/test_cppext/extension.cpp b/Lib/test/test_cppext/extension.cpp
index 90669b1..a569c22 100644
--- a/Lib/test/test_cppext/extension.cpp
+++ b/Lib/test/test_cppext/extension.cpp
@@ -8,10 +8,8 @@
#include "Python.h"
-#if __cplusplus >= 201103
-# define NAME _testcpp11ext
-#else
-# define NAME _testcpp03ext
+#ifndef MODULE_NAME
+# error "MODULE_NAME macro must be defined"
#endif
#define _STR(NAME) #NAME
@@ -160,7 +158,7 @@ PyType_Slot VirtualPyObject_Slots[] = {
};
PyType_Spec VirtualPyObject_Spec = {
- /* .name */ STR(NAME) ".VirtualPyObject",
+ /* .name */ STR(MODULE_NAME) ".VirtualPyObject",
/* .basicsize */ sizeof(VirtualPyObject),
/* .itemsize */ 0,
/* .flags */ Py_TPFLAGS_DEFAULT,
@@ -240,7 +238,7 @@ PyDoc_STRVAR(_testcppext_doc, "C++ test extension.");
static struct PyModuleDef _testcppext_module = {
PyModuleDef_HEAD_INIT, // m_base
- STR(NAME), // m_name
+ STR(MODULE_NAME), // m_name
_testcppext_doc, // m_doc
0, // m_size
_testcppext_methods, // m_methods
@@ -254,7 +252,7 @@ static struct PyModuleDef _testcppext_module = {
#define FUNC_NAME(NAME) _FUNC_NAME(NAME)
PyMODINIT_FUNC
-FUNC_NAME(NAME)(void)
+FUNC_NAME(MODULE_NAME)(void)
{
return PyModuleDef_Init(&_testcppext_module);
}