Skip to content

Commit 4e04ff5

Browse files
clin1234ZeroIntensityvstinner
authored andcommitted
pythongh-135906: Use _PyObject_CAST in internal headers (pythonGH-135892)
Fixes build errors encountered in python-greenlet/greenlet#450 when building greenlet on the free-threaded build. --------- Co-authored-by: Peter Bierma <[email protected]> Co-authored-by: Victor Stinner <[email protected]>
1 parent e1ea753 commit 4e04ff5

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

Include/internal/pycore_object.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -614,7 +614,7 @@ static inline PyObject *
614614
_Py_XGetRef(PyObject **ptr)
615615
{
616616
for (;;) {
617-
PyObject *value = _Py_atomic_load_ptr(ptr);
617+
PyObject *value = _PyObject_CAST(_Py_atomic_load_ptr(ptr));
618618
if (value == NULL) {
619619
return value;
620620
}
@@ -629,7 +629,7 @@ _Py_XGetRef(PyObject **ptr)
629629
static inline PyObject *
630630
_Py_TryXGetRef(PyObject **ptr)
631631
{
632-
PyObject *value = _Py_atomic_load_ptr(ptr);
632+
PyObject *value = _PyObject_CAST(_Py_atomic_load_ptr(ptr));
633633
if (value == NULL) {
634634
return value;
635635
}

Include/internal/pycore_stackref.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -829,7 +829,7 @@ _Py_TryIncrefCompareStackRef(PyObject **src, PyObject *op, _PyStackRef *out)
829829
static inline int
830830
_Py_TryXGetStackRef(PyObject **src, _PyStackRef *out)
831831
{
832-
PyObject *op = _Py_atomic_load_ptr_relaxed(src);
832+
PyObject *op = _PyObject_CAST(_Py_atomic_load_ptr_relaxed(src));
833833
if (op == NULL) {
834834
*out = PyStackRef_NULL;
835835
return 1;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix compilation errors when compiling the internal headers with a C++ compiler.

0 commit comments

Comments
 (0)