From b0317f2b2b62b3be9beb8d834aa51b776fb0179e Mon Sep 17 00:00:00 2001
From: David Li
Date: Tue, 20 Aug 2024 17:04:33 +0900
Subject: [PATCH] GH-43707: [Python] Fix compilation on Cython<3 (#43765)
### Rationale for this change
Fix compilation on Cython < 3
### What changes are included in this PR?
Add an explicit cast
### Are these changes tested?
N/A
### Are there any user-facing changes?
No
* GitHub Issue: #43707
Authored-by: David Li
Signed-off-by: Joris Van den Bossche
---
python/pyarrow/types.pxi | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/python/pyarrow/types.pxi b/python/pyarrow/types.pxi
index 93d68fb847890..dcd2b61c33411 100644
--- a/python/pyarrow/types.pxi
+++ b/python/pyarrow/types.pxi
@@ -5328,8 +5328,9 @@ def opaque(DataType storage_type, str type_name not None, str vendor_name not No
cdef:
c_string c_type_name = tobytes(type_name)
c_string c_vendor_name = tobytes(vendor_name)
- shared_ptr[CDataType] c_type = make_shared[COpaqueType](
+ shared_ptr[COpaqueType] c_opaque_type = make_shared[COpaqueType](
storage_type.sp_type, c_type_name, c_vendor_name)
+ shared_ptr[CDataType] c_type = static_pointer_cast[CDataType, COpaqueType](c_opaque_type)
OpaqueType out = OpaqueType.__new__(OpaqueType)
out.init(c_type)
return out