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

corona10 webhook-mailer at python.org
Sun Jun 5 02:47:36 EDT 2022


https://github.com/python/cpython/commit/c21f2bdaf14aae4dc272e66565ada87568641b1e
commit: c21f2bdaf14aae4dc272e66565ada87568641b1e
branch: 3.11
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: corona10 <donghee.na92 at gmail.com>
date: 2022-06-05T15:47:12+09:00
summary:

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

(cherry picked from commit 713eb184b50f2b8b138fb01187ee32fa29a815c9)

Co-authored-by: Neil Schemenauer <nas-github at arctrix.com>

Co-authored-by: Neil Schemenauer <nas-github at arctrix.com>

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