tustvold commented on code in PR #5070:
URL: https://github.com/apache/arrow-rs/pull/5070#discussion_r1394636318
##########
arrow/src/pyarrow.rs:
##########
@@ -166,6 +211,19 @@ impl ToPyArrow for Field {
impl FromPyArrow for Schema {
fn from_pyarrow(value: &PyAny) -> PyResult<Self> {
+ // Newer versions of PyArrow as well as other libraries with Arrow
data implement this
+ // method, so prefer it over _export_to_c.
+ // See
https://arrow.apache.org/docs/format/CDataInterface/PyCapsuleInterface.html
+ if value.hasattr("__arrow_c_schema__")? {
+ let capsule: &PyCapsule =
+
PyTryInto::try_into(value.getattr("__arrow_c_schema__")?.call0()?)?;
+ validate_pycapsule(capsule, "arrow_schema")?;
+
+ let schema_ptr = unsafe { capsule.reference::<FFI_ArrowSchema>() };
Review Comment:
Does the pycapsule not handle this?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]