Blob Blame History Raw
From a12f3b736a9c69e0d69e7f483e50e7cdf59d9fd2 Mon Sep 17 00:00:00 2001
From: Enric Tejedor Saavedra <enric.tejedor.saavedra@cern.ch>
Date: Fri, 10 Jun 2022 16:42:49 +0200
Subject: [PATCH] [PyROOT] Prevent cast error when calling PyTuple_SET_ITEM in
 3.11

PyTuple_SET_ITEM ends up calling _PyObject_CAST(nullptr) which
causes "error: invalid cast from type 'std::nullptr_t' to type
'const PyObject*' {aka 'const _object*'}
---
 bindings/pyroot/cppyy/CPyCppyy/src/CPPMethod.cxx | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bindings/pyroot/cppyy/CPyCppyy/src/CPPMethod.cxx b/bindings/pyroot/cppyy/CPyCppyy/src/CPPMethod.cxx
index 685ad3dc60..2189348594 100644
--- a/bindings/pyroot/cppyy/CPyCppyy/src/CPPMethod.cxx
+++ b/bindings/pyroot/cppyy/CPyCppyy/src/CPPMethod.cxx
@@ -580,7 +580,7 @@ PyObject* CPyCppyy::CPPMethod::ProcessKeywords(PyObject* self, PyObject* args, P
 // set all values to zero to be able to check them later (this also guarantees normal
 // cleanup by the tuple deallocation)
     for (Py_ssize_t i = 0; i < nArgs+nKeys; ++i)
-        PyTuple_SET_ITEM(newArgs, i, nullptr);
+        PyTuple_SET_ITEM(newArgs, i, static_cast<PyObject*>(nullptr));
 
 // next, insert the keyword values
     PyObject *key, *value;
-- 
2.36.1