Skip to content

Commit fe187fa

Browse files
clin1234ZeroIntensityvstinner
authored
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. --------- Co-authored-by: Peter Bierma <zintensitydev@gmail.com> Co-authored-by: Victor Stinner <vstinner@python.org>
1 parent 0b62523 commit fe187fa

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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy