https://github.com/python/cpython/commit/da461eacea5f30da8c3977679b8ca4cced005958
commit: da461eacea5f30da8c3977679b8ca4cced005958
branch: main
author: Victor Stinner <[email protected]>
committer: vstinner <[email protected]>
date: 2026-09-08T17:51:00+02:00
summary:

gh-121617: Fix Py_CLEAR() memcpy in C++: replace NULL with _Py_NULL (#157188)

files:
M Include/refcount.h

diff --git a/Include/refcount.h b/Include/refcount.h
index 8a3d440fd14b1e..b21697ae1780fa 100644
--- a/Include/refcount.h
+++ b/Include/refcount.h
@@ -494,7 +494,7 @@ static inline Py_ALWAYS_INLINE void Py_DECREF(PyObject *op)
     do { \
         PyObject **_tmp_op_ptr = _Py_CAST(PyObject**, &(op)); \
         PyObject *_tmp_old_op = (*_tmp_op_ptr); \
-        if (_tmp_old_op != NULL) { \
+        if (_tmp_old_op != _Py_NULL) { \
             PyObject *_null_ptr = _Py_NULL; \
             memcpy(_tmp_op_ptr, &_null_ptr, sizeof(PyObject*)); \
             Py_DECREF(_tmp_old_op); \

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to