Skip to content

Commit c726990

Browse files
miss-islingtonclin1234ZeroIntensityvstinner
authored
[3.14] gh-135906: Use _PyObject_CAST in internal headers (GH-135892) (GH-136392)
gh-135906: Use `_PyObject_CAST` in internal headers (GH-135892) Fixes build errors encountered in python-greenlet/greenlet#450 when building greenlet on the free-threaded build. --------- (cherry picked from commit fe187fa) Co-authored-by: Charlie Lin <[email protected]> Co-authored-by: Peter Bierma <[email protected]> Co-authored-by: Victor Stinner <[email protected]>
1 parent 5a7d266 commit c726990

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
@@ -765,7 +765,7 @@ _Py_TryIncrefCompareStackRef(PyObject **src, PyObject *op, _PyStackRef *out)
765765
static inline int
766766
_Py_TryXGetStackRef(PyObject **src, _PyStackRef *out)
767767
{
768-
PyObject *op = _Py_atomic_load_ptr_relaxed(src);
768+
PyObject *op = _PyObject_CAST(_Py_atomic_load_ptr_relaxed(src));
769769
if (op == NULL) {
770770
*out = PyStackRef_NULL;
771771
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)