summaryrefslogtreecommitdiff
path: root/dev-python/pyarrow/files/pyarrow-16.1.0-py313.patch
blob: f3e0053dd0035447b3c4955727226b7d89a7faf1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
diff --git a/python/pyarrow/src/arrow/python/udf.cc b/python/pyarrow/src/arrow/python/udf.cc
index e9b72a2592738..b6a862af8ca07 100644
--- a/pyarrow/src/arrow/python/udf.cc
+++ b/pyarrow/src/arrow/python/udf.cc
@@ -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
+#define Py_IsFinalizing() _Py_IsFinalizing()
+#endif
 namespace arrow {
 using compute::ExecSpan;
 using compute::Grouper;
@@ -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();
     }
   }
@@ -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();
     }
   }
@@ -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();
     }
   }
@@ -173,7 +177,7 @@ struct PythonUdfScalarAggregatorImpl : public ScalarUdfAggregator {
   };
 
   ~PythonUdfScalarAggregatorImpl() override {
-    if (_Py_IsFinalizing()) {
+    if (Py_IsFinalizing()) {
       function->detach();
     }
   }
@@ -270,7 +274,7 @@ struct PythonUdfHashAggregatorImpl : public HashUdfAggregator {
   };
 
   ~PythonUdfHashAggregatorImpl() override {
-    if (_Py_IsFinalizing()) {
+    if (Py_IsFinalizing()) {
       function->detach();
     }
   }