romainfrancois edited a comment on pull request #7819:
URL: https://github.com/apache/arrow/pull/7819#issuecomment-677645712


   I think the last commit 
(https://github.com/apache/arrow/pull/7819/commits/23b179e7d69d6042821a41878b86e37b18cdeb44)
 restore how things were before switching to `cpp11` wrt how `uintptr_t` goes 
back and forth. 
   
   This uses a `double` as a host for a `uintptr_t` which IIUC is only faithful 
to 53 bits. 
   
   This should really use an external pointer but then I have no idea how 
python would go about extracting the actual pointer from the external pointer 
`SEXP`. 
   
   This seems to work, at least according to the tests, but I really don't know 
if the `uintptr_t` hosted in a `double` is fine with ```x$`_export_to_c`() ``` 
expectations ? 
   
   cc @jjallaire @fsaintjacques @nealrichardson 
   
   ```r
   py_to_r.pyarrow.lib.Array <- function(x, ...) {
     schema_ptr <- allocate_arrow_schema()
     array_ptr <- allocate_arrow_array()
     on.exit({
       delete_arrow_schema(schema_ptr)
       delete_arrow_array(array_ptr)
     })
   
     x$`_export_to_c`(array_ptr, schema_ptr)
     Array$create(ImportArray(array_ptr, schema_ptr))
   }
   ```
   
   We get a `double` for both `schema_ptr` and `array_ptr` Is that ok ? 


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

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to