[3.14] gh-135906: Use _PyObject_CAST in internal headers (GH-135892) (GH-136392)
Some checks are pending
Tests / Windows MSI (push) Blocked by required conditions
Tests / (push) Blocked by required conditions
Tests / Change detection (push) Waiting to run
Tests / Docs (push) Blocked by required conditions
Tests / Check if the ABI has changed (push) Blocked by required conditions
Tests / Check if Autoconf files are up to date (push) Blocked by required conditions
Tests / WASI (push) Blocked by required conditions
Tests / Check if generated files are up to date (push) Blocked by required conditions
Tests / Hypothesis tests on Ubuntu (push) Blocked by required conditions
Tests / Ubuntu SSL tests with OpenSSL (push) Blocked by required conditions
Tests / Address sanitizer (push) Blocked by required conditions
Tests / Cross build Linux (push) Blocked by required conditions
Tests / CIFuzz (push) Blocked by required conditions
Tests / All required checks pass (push) Blocked by required conditions
Lint / lint (push) Waiting to run

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 fe187fae8d)

Co-authored-by: Charlie Lin <tuug@gmx.us>
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
This commit is contained in:
Miss Islington (bot) 2025-07-07 19:21:28 +02:00 committed by GitHub
parent 5a7d266fcb
commit c72699086f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 4 additions and 3 deletions

View file

@ -614,7 +614,7 @@ static inline PyObject *
_Py_XGetRef(PyObject **ptr)
{
for (;;) {
PyObject *value = _Py_atomic_load_ptr(ptr);
PyObject *value = _PyObject_CAST(_Py_atomic_load_ptr(ptr));
if (value == NULL) {
return value;
}
@ -629,7 +629,7 @@ _Py_XGetRef(PyObject **ptr)
static inline PyObject *
_Py_TryXGetRef(PyObject **ptr)
{
PyObject *value = _Py_atomic_load_ptr(ptr);
PyObject *value = _PyObject_CAST(_Py_atomic_load_ptr(ptr));
if (value == NULL) {
return value;
}

View file

@ -765,7 +765,7 @@ _Py_TryIncrefCompareStackRef(PyObject **src, PyObject *op, _PyStackRef *out)
static inline int
_Py_TryXGetStackRef(PyObject **src, _PyStackRef *out)
{
PyObject *op = _Py_atomic_load_ptr_relaxed(src);
PyObject *op = _PyObject_CAST(_Py_atomic_load_ptr_relaxed(src));
if (op == NULL) {
*out = PyStackRef_NULL;
return 1;

View file

@ -0,0 +1 @@
Fix compilation errors when compiling the internal headers with a C++ compiler.