[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 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

@ -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;