From 39d126d17a48f14de9dcc6fc80a3a13f50ed87b3 Mon Sep 17 00:00:00 2001 From: alperyoney Date: Wed, 4 Feb 2026 09:41:47 -0800 Subject: [PATCH 1/2] Fix C++ compatibility in _PyCell_GetStackRef --- Include/internal/pycore_cell.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Include/internal/pycore_cell.h b/Include/internal/pycore_cell.h index cef01e80514f4b..a9b61b0d53c672 100644 --- a/Include/internal/pycore_cell.h +++ b/Include/internal/pycore_cell.h @@ -53,7 +53,7 @@ _PyCell_GetStackRef(PyCellObject *cell) { PyObject *value; #ifdef Py_GIL_DISABLED - value = _Py_atomic_load_ptr(&cell->ob_ref); + value = (PyObject *)_Py_atomic_load_ptr(&cell->ob_ref); if (value == NULL) { return PyStackRef_NULL; } From 9478ca68d5e309050d93a860f88cc0623c697958 Mon Sep 17 00:00:00 2001 From: alperyoney Date: Fri, 6 Feb 2026 09:25:51 -0800 Subject: [PATCH 2/2] Use _PyObject_CAST --- Include/internal/pycore_cell.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Include/internal/pycore_cell.h b/Include/internal/pycore_cell.h index a9b61b0d53c672..d0d45a2343654f 100644 --- a/Include/internal/pycore_cell.h +++ b/Include/internal/pycore_cell.h @@ -53,7 +53,7 @@ _PyCell_GetStackRef(PyCellObject *cell) { PyObject *value; #ifdef Py_GIL_DISABLED - value = (PyObject *)_Py_atomic_load_ptr(&cell->ob_ref); + value = _PyObject_CAST(_Py_atomic_load_ptr(&cell->ob_ref)); if (value == NULL) { return PyStackRef_NULL; }