summaryrefslogtreecommitdiffstats
path: root/contrib/libs/apache/arrow/patches/support-python-3.13-with-pydebug.patch
blob: 051c105bcc3707c211514bc54ccd1c944c82156c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
--- contrib/libs/apache/arrow/cpp/src/arrow/python/common.h	(index)
+++ contrib/libs/apache/arrow/cpp/src/arrow/python/common.h	(working tree)
@@ -143,7 +143,14 @@ class ARROW_PYTHON_EXPORT OwnedRef {
     return *this;
   }
 
-  ~OwnedRef() { reset(); }
+  ~OwnedRef() {
+#ifdef Py_DEBUG
+    if (!Py_IsInitialized()) {
+        return;
+    }
+#endif
+    reset();
+  }
 
   void reset(PyObject* obj) {
     Py_XDECREF(obj_);