summaryrefslogtreecommitdiffstats
path: root/Lib/test/_testcppext.cpp
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2022-05-03 19:38:37 (GMT)
committerGitHub <noreply@github.com>2022-05-03 19:38:37 (GMT)
commit551d02b3e697098236bb3a6e0a855b2ad8dc0424 (patch)
treeffa7db7f5129f7167df4c40bf4bbed2f5481c28b /Lib/test/_testcppext.cpp
parent456cd513e360ccd17e51ae3711ec48976b1be0c0 (diff)
downloadcpython-551d02b3e697098236bb3a6e0a855b2ad8dc0424.zip
cpython-551d02b3e697098236bb3a6e0a855b2ad8dc0424.tar.gz
cpython-551d02b3e697098236bb3a6e0a855b2ad8dc0424.tar.bz2
gh-91321: Add _Py_NULL macro (#92253)
Fix C++ compiler warnings: "zero as null pointer constant" (clang -Wzero-as-null-pointer-constant). * Add the _Py_NULL macro used by static inline functions to use nullptr in C++. * Replace NULL with nullptr in _testcppext.cpp.
Diffstat (limited to 'Lib/test/_testcppext.cpp')
-rw-r--r--Lib/test/_testcppext.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/Lib/test/_testcppext.cpp b/Lib/test/_testcppext.cpp
index 257843b..dc40f0e 100644
--- a/Lib/test/_testcppext.cpp
+++ b/Lib/test/_testcppext.cpp
@@ -52,7 +52,7 @@ test_api_casts(PyObject *Py_UNUSED(module), PyObject *Py_UNUSED(args))
static PyMethodDef _testcppext_methods[] = {
{"add", _testcppext_add, METH_VARARGS, _testcppext_add_doc},
- {"test_api_casts", test_api_casts, METH_NOARGS, NULL},
+ {"test_api_casts", test_api_casts, METH_NOARGS, nullptr},
{nullptr, nullptr, 0, nullptr} /* sentinel */
};
@@ -68,7 +68,7 @@ _testcppext_exec(PyObject *module)
static PyModuleDef_Slot _testcppext_slots[] = {
{Py_mod_exec, reinterpret_cast<void*>(_testcppext_exec)},
- {0, NULL}
+ {0, nullptr}
};
@@ -81,8 +81,8 @@ static struct PyModuleDef _testcppext_module = {
0, // m_size
_testcppext_methods, // m_methods
_testcppext_slots, // m_slots
- NULL, // m_traverse
- NULL, // m_clear
+ nullptr, // m_traverse
+ nullptr, // m_clear
nullptr, // m_free
};