paleolimbot commented on code in PR #318:
URL: https://github.com/apache/arrow-nanoarrow/pull/318#discussion_r1395757543


##########
python/src/nanoarrow/_lib.pyx:
##########
@@ -200,6 +227,28 @@ cdef class Schema:
         self._base = base,
         self._ptr = <ArrowSchema*>addr
 
+    @staticmethod
+    def _import_from_c_capsule(schema_capsule):
+        """
+        Import from a ArrowSchema PyCapsule
+
+        Parameters
+        ----------
+        schema_capsule : PyCapsule
+            A valid PyCapsule with name 'arrow_schema' containing an
+            ArrowSchema pointer.
+        """
+        cdef:
+            ArrowSchema* c_schema
+            Schema out
+
+        c_schema = <ArrowSchema*> PyCapsule_GetPointer(schema_capsule, 
'arrow_schema')
+
+        out = Schema.allocate()

Review Comment:
   I wonder if what you want here is more like:
   
   ```
   cdef Schema schema = Schema(schema_capsule, 
<uintptr_t>PyCapsule_GetPointer(schema_capsule, 'arrow_schema'))
   ```
   
   (i.e., no need to "move" here...`base` can be a capsule, which does 
basically the same thing as the `SchemaHolder`)



-- 
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]

Reply via email to