[Python-checkins] gh-93442: Add test for _Py_CAST(nullptr). (gh-93505)

corona10 webhook-mailer at python.org
Sat Jun 4 23:53:20 EDT 2022


https://github.com/python/cpython/commit/713eb184b50f2b8b138fb01187ee32fa29a815c9
commit: 713eb184b50f2b8b138fb01187ee32fa29a815c9
branch: main
author: Neil Schemenauer <nas-github at arctrix.com>
committer: corona10 <donghee.na92 at gmail.com>
date: 2022-06-05T12:53:16+09:00
summary:

gh-93442: Add test for _Py_CAST(nullptr). (gh-93505)

files:
M Lib/test/_testcppext.cpp

diff --git a/Lib/test/_testcppext.cpp b/Lib/test/_testcppext.cpp
index 70f434e6789ad..5e3d76b7b2072 100644
--- a/Lib/test/_testcppext.cpp
+++ b/Lib/test/_testcppext.cpp
@@ -77,6 +77,9 @@ test_api_casts(PyObject *Py_UNUSED(module), PyObject *Py_UNUSED(args))
     // gh-93442: Pass 0 as NULL for PyObject*
     Py_XINCREF(0);
     Py_XDECREF(0);
+    // ensure that nullptr works too
+    Py_XINCREF(nullptr);
+    Py_XDECREF(nullptr);
 
     Py_DECREF(obj);
     Py_RETURN_NONE;



More information about the Python-checkins mailing list