You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Python][C++] Python 3.15 Builds Fail due to PyWeakref_GET_OBJECT Removal #47823
changed the title [-][Python] Building `pyarrow` fails on apache-arrow-22.0.0-rc0 and Python 3.15.0a1: `'PyWeakref_GET_OBJECT’ was not declared`[/-][+][Python] Building `pyarrow` fails on apache-arrow-22.0.0-rc1 and Python 3.15.0a1: `'PyWeakref_GET_OBJECT’ was not declared`[/+]on Oct 20, 2025
247.4 In member function‘PyObject*arrow::py::PyExtensionType::GetInstance()
247.4 const’:
247.4 /root/builds/arrow/python/pyarrow/src/arrow/python/extension_type.cc:167:20:
247.4 error: ‘PyWeakref_GET_OBJECT’ was not declared in this scope
247.4 167 | PyObject* inst = PyWeakref_GET_OBJECT(type_instance_.obj());
247.4 | ^~~~~~~~~~~~~~~~~~~~
changed the title [-][Python] Building `pyarrow` fails on apache-arrow-22.0.0-rc1 and Python 3.15.0a1: `'PyWeakref_GET_OBJECT’ was not declared`[/-][+][Python][C++] Building `pyarrow` fails on apache-arrow-22.0.0-rc1 and Python 3.15.0a1: `'PyWeakref_GET_OBJECT’ was not declared`[/+]on Oct 21, 2025
Thank you for opening up the issue @p-vdp !
We do not yet support Python 3.15 but it's very helpful to get this kind of feedback early.
The substitute for PyWeakref_GET_OBJECT will be PyWeakref_GetRef which was added in 3.13. We will need a solution that works for all supported Python versions (currently 3.10 to 3.14).
changed the title [-][Python][C++] Building `pyarrow` fails on apache-arrow-22.0.0-rc1 and Python 3.15.0a1: `'PyWeakref_GET_OBJECT’ was not declared`[/-][+][Python][C++] Python 3.15 support[/+]on Oct 29, 2025
In my opinion we should use pythoncapi-compat as it is already vendored in the project and used for other compatibility functions like PyDict_GetItemStringRef or PyList_GetItemRef.
I'd suggest: Changing issue title to "Python 3.15 Builds Fail due to PyWeakref_GET_OBJECT Removal"? There's likely many other steps involved for 3.15 support.
In terms of next steps, once PR lands, would it make sense to file a separate issue for adding Python 3.15 to nightlys?
changed the title [-][Python][C++] Python 3.15 support[/-][+][Python][C++] Python 3.15 Builds Fail due to PyWeakref_GET_OBJECT Removal[/+]on Nov 3, 2025
In terms of next steps, once PR lands, would it make sense to file a separate issue for adding Python 3.15 to nightlys?
Yes, that would make sense. We could try building wheels for Python 3.15 alpha.
I have no experience here but musllinux might be an issue as we are stuck at June musllinux image, see #48028. Quite possible it wont be a problem though.
Activity
[-][Python] Building `pyarrow` fails on apache-arrow-22.0.0-rc0 and Python 3.15.0a1: `'PyWeakref_GET_OBJECT’ was not declared`[/-][+][Python] Building `pyarrow` fails on apache-arrow-22.0.0-rc1 and Python 3.15.0a1: `'PyWeakref_GET_OBJECT’ was not declared`[/+]p-vdp commentedon Oct 20, 2025
Still getting this with rc1:
[-][Python] Building `pyarrow` fails on apache-arrow-22.0.0-rc1 and Python 3.15.0a1: `'PyWeakref_GET_OBJECT’ was not declared`[/-][+][Python][C++] Building `pyarrow` fails on apache-arrow-22.0.0-rc1 and Python 3.15.0a1: `'PyWeakref_GET_OBJECT’ was not declared`[/+]p-vdp commentedon Oct 21, 2025
PyWeakref_GET_OBJECThas been deprecated since Python 3.13 and is being removed in 3.15: https://docs.python.org/3/c-api/weakref.html#c.PyWeakref_GetObjectarrow/python/pyarrow/src/arrow/python/extension_type.cc
Line 167 in 7df396e
AlenkaF commentedon Oct 21, 2025
Thank you for opening up the issue @p-vdp !
We do not yet support Python 3.15 but it's very helpful to get this kind of feedback early.
The substitute for
PyWeakref_GET_OBJECTwill bePyWeakref_GetRefwhich was added in 3.13. We will need a solution that works for all supported Python versions (currently3.10to3.14).[-][Python][C++] Building `pyarrow` fails on apache-arrow-22.0.0-rc1 and Python 3.15.0a1: `'PyWeakref_GET_OBJECT’ was not declared`[/-][+][Python][C++] Python 3.15 support[/+]paultiq commentedon Nov 2, 2025
Would you consider an #if block specific for 3.15+ like the following, leaving <=3.14 alone.
* This built/ran/passed tests on my local system.
Other approaches:
inst == NULLraulcd commentedon Nov 3, 2025
In my opinion we should use pythoncapi-compat as it is already vendored in the project and used for other compatibility functions like
PyDict_GetItemStringReforPyList_GetItemRef.arrow/python/pyarrow/src/arrow/python/vendored/pythoncapi_compat.h
Lines 561 to 584 in ff089cc
paultiq commentedon Nov 3, 2025
That works too!
In that case, it'd be:
raulcd commentedon Nov 3, 2025
@paultiq do you want to push a PR? I am happy to follow up with testing/review
paultiq commentedon Nov 3, 2025
PR opened.
I'd suggest: Changing issue title to "Python 3.15 Builds Fail due to PyWeakref_GET_OBJECT Removal"? There's likely many other steps involved for 3.15 support.
In terms of next steps, once PR lands, would it make sense to file a separate issue for adding Python 3.15 to nightlys?
[-][Python][C++] Python 3.15 support[/-][+][Python][C++] Python 3.15 Builds Fail due to PyWeakref_GET_OBJECT Removal[/+]AlenkaF commentedon Nov 4, 2025
Yes, that would make sense. We could try building wheels for Python 3.15 alpha.
I have no experience here but musllinux might be an issue as we are stuck at June musllinux image, see #48028. Quite possible it wont be a problem though.
GH-47823: [Python] Use PyWeakref_GetRef instead of PyWeakref_GET_OBJE…
AlenkaF commentedon Nov 19, 2025
Issue resolved by pull request 48027
#48027
apacheGH-47823: [Python] Use PyWeakref_GetRef instead of PyWeakref_GE…
apacheGH-47823: [Python] Use PyWeakref_GetRef instead of PyWeakref_GE…