Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GH-41475: [Python] Build with Python 3.13 #42034

Merged
merged 3 commits into from
Jun 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions python/pyarrow/src/arrow/python/udf.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@
#include "arrow/util/checked_cast.h"
#include "arrow/util/logging.h"

// Py_IsFinalizing added in Python 3.13.0a4
#if PY_VERSION_HEX < 0x030D00A4
tacaswell marked this conversation as resolved.
Show resolved Hide resolved
#define Py_IsFinalizing() _Py_IsFinalizing()
#endif
namespace arrow {
using compute::ExecSpan;
using compute::Grouper;
Expand All @@ -47,7 +51,7 @@ struct PythonUdfKernelState : public compute::KernelState {
// function needs to be destroyed at process exit
// and Python may no longer be initialized.
~PythonUdfKernelState() {
if (_Py_IsFinalizing()) {
if (Py_IsFinalizing()) {
function->detach();
}
}
Expand All @@ -64,7 +68,7 @@ struct PythonUdfKernelInit {
// function needs to be destroyed at process exit
// and Python may no longer be initialized.
~PythonUdfKernelInit() {
if (_Py_IsFinalizing()) {
if (Py_IsFinalizing()) {
function->detach();
}
}
Expand Down Expand Up @@ -132,7 +136,7 @@ struct PythonTableUdfKernelInit {
// function needs to be destroyed at process exit
// and Python may no longer be initialized.
~PythonTableUdfKernelInit() {
if (_Py_IsFinalizing()) {
if (Py_IsFinalizing()) {
function_maker->detach();
}
}
Expand Down Expand Up @@ -173,7 +177,7 @@ struct PythonUdfScalarAggregatorImpl : public ScalarUdfAggregator {
};

~PythonUdfScalarAggregatorImpl() override {
if (_Py_IsFinalizing()) {
if (Py_IsFinalizing()) {
function->detach();
}
}
Expand Down Expand Up @@ -270,7 +274,7 @@ struct PythonUdfHashAggregatorImpl : public HashUdfAggregator {
};

~PythonUdfHashAggregatorImpl() override {
if (_Py_IsFinalizing()) {
if (Py_IsFinalizing()) {
function->detach();
}
}
Expand Down
Loading