mirror of
https://github.com/python/cpython.git
synced 2025-11-01 18:51:43 +00:00
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.
This commit is contained in:
parent
456cd513e3
commit
551d02b3e6
6 changed files with 28 additions and 18 deletions
|
|
@ -587,7 +587,7 @@ static inline void Py_DECREF(PyObject *op)
|
|||
/* Function to use in case the object pointer can be NULL: */
|
||||
static inline void Py_XINCREF(PyObject *op)
|
||||
{
|
||||
if (op != NULL) {
|
||||
if (op != _Py_NULL) {
|
||||
Py_INCREF(op);
|
||||
}
|
||||
}
|
||||
|
|
@ -597,7 +597,7 @@ static inline void Py_XINCREF(PyObject *op)
|
|||
|
||||
static inline void Py_XDECREF(PyObject *op)
|
||||
{
|
||||
if (op != NULL) {
|
||||
if (op != _Py_NULL) {
|
||||
Py_DECREF(op);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue