westonpace commented on issue #34564:
URL: https://github.com/apache/arrow/issues/34564#issuecomment-1473895747

   I started trying to fix these but ran into some problems that I think are 
bugs in cython?
   
   This one is a warning (the method `__pyx_convert_vector_to_py_int` is a 
cython method I think):
   ```
   /home/pace/dev/arrow/python/build/temp.linux-x86_64-cpython-311/lib.cpp: In 
function ‘PyObject* __pyx_convert_vector_to_py_int(const std::vector<int>&)’:
   
/home/pace/dev/arrow/python/build/temp.linux-x86_64-cpython-311/lib.cpp:236294:49:
 warning: comparison of integer expressions of different signedness: 
‘Py_ssize_t’ {aka ‘long int’} and ‘size_t’ {aka ‘long unsigned int’} 
[-Wsign-compare]
   236294 |                   for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; 
__pyx_t_5+=1) {
          |                                       ~~~~~~~~~~^~~~~~~~~~~
   ```
   
   This one is an error (the method `input_stream` is in our `pxi` files but I 
verified it does not call `PyMemoryView_Check` and the two places we do call 
that method the capitalization is correct):
   ```
   /home/pace/dev/arrow/python/build/temp.linux-x86_64-cpython-311/lib.cpp: In 
function ‘PyObject* __pyx_pf_7pyarrow_3lib_214input_stream(PyObject*, 
PyObject*, PyObject*, PyObject*)’:
   
/home/pace/dev/arrow/python/build/temp.linux-x86_64-cpython-311/lib.cpp:202114:31:
 error: ‘PyMemoryview_Check’ was not declared in this scope; did you mean 
‘PyMemoryView_Check’?
   202114 |                   __pyx_t_9 = PyMemoryview_Check(__pyx_v_source);
          |                               ^~~~~~~~~~~~~~~~~~
          |                               PyMemoryView_Check
   ```
   
   And then this code:
   
   ```
       @property
       def dim_names(self):
           return tuple(frombytes(x) for x in tuple(self.stp.dim_names()))
   ```
   
   at some point unwraps into:
   
   ```
                /* "pyarrow/tensor.pxi":556                                     
                                                                                
                                                   
    *     @property                                                             
                                                                                
                                                      
    *     def dim_names(self):                                                  
                                                                                
                                                      
    *         return tuple(frombytes(x) for x in tuple(self.stp.dim_names()))   
          # <<<<<<<<<<<<<<                                                      
                                                      
    *                                                                           
                                                                                
                                                      
    *     @property                                                             
                                                                                
                                                      
    */
   
                   static PyObject 
*__pyx_pf_7pyarrow_3lib_15SparseCOOTensor_9dim_names_7__get___genexpr(CYTHON_UNUSED
 PyObject *__pyx_self, std::vector<std::string>  const __pyx_genexpr_arg_0) {
                     struct 
__pyx_obj_7pyarrow_3lib___pyx_scope_struct_15_genexpr *__pyx_cur_scope;
                     PyObject *__pyx_r = NULL;
                     __Pyx_RefNannyDeclarations
                     int __pyx_lineno = 0;
                     const char *__pyx_filename = NULL;
                     int __pyx_clineno = 0;
                     __Pyx_RefNannySetupContext("genexpr", 0);
                     __pyx_cur_scope = (struct 
__pyx_obj_7pyarrow_3lib___pyx_scope_struct_15_genexpr 
*)__pyx_tp_new_7pyarrow_3lib___pyx_scope_struct_15_genexpr(__pyx_ptype_7pyarrow_3lib___pyx_scope_struct_15_genexpr,
 __pyx_empty_tuple, NULL);
                     if (unlikely(!__pyx_cur_scope)) {
                       __pyx_cur_scope = ((struct 
__pyx_obj_7pyarrow_3lib___pyx_scope_struct_15_genexpr *)Py_None);
                       __Pyx_INCREF(Py_None);
                       __PYX_ERR(6, 556, __pyx_L1_error)
                     } else {
                       __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
                     }
                     __pyx_cur_scope->__pyx_genexpr_arg_0 = __pyx_genexpr_arg_0;
                     {
                       __pyx_CoroutineObject *gen = 
__Pyx_Generator_New((__pyx_coroutine_body_t) 
__pyx_gb_7pyarrow_3lib_15SparseCOOTensor_9dim_names_7__get___2generator17, 
NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, 
__pyx_n_s_SparseCOOTensor___get___locals_g, __pyx_n_s_pyarrow_lib); if 
(unlikely(!gen)) __PYX_ERR(6, 556, __pyx_L1_error)
                       __Pyx_DECREF(__pyx_cur_scope);
                       __Pyx_RefNannyFinishContext();
   ```
   
   However, the `__pyx_obj_7pyarrow_3lib___pyx_scope_struct_15_genexpr` is 
declared as:
   
   ```
   /* "pyarrow/tensor.pxi":556                                                  
                                                                                
                                                      
    *     @property                                                             
                                                                                
                                                      
    *     def dim_names(self):                                                  
                                                                                
                                                      
    *         return tuple(frombytes(x) for x in tuple(self.stp.dim_names()))   
          # <<<<<<<<<<<<<<                                                      
                                                      
    *                                                                           
                                                                                
                                                      
    *     @property                                                             
                                                                                
                                                      
    */
   struct __pyx_obj_7pyarrow_3lib___pyx_scope_struct_15_genexpr {
     PyObject_HEAD
     std::vector<std::string>  const __pyx_genexpr_arg_0;
     PyObject *__pyx_v_x;
     PyObject *__pyx_t_0;
     Py_ssize_t __pyx_t_1;
   };
   ```
   
   Since `__pyx_genexpr_arg_0` is `const` this line triggers an error:
   
   ```
   __pyx_cur_scope->__pyx_genexpr_arg_0 = __pyx_genexpr_arg_0;
   ```
   
   ```
   /home/pace/dev/arrow/python/build/temp.linux-x86_64-cpython-311/lib.cpp: In 
function ‘PyObject* 
__pyx_pf_7pyarrow_3lib_15SparseCOOTensor_9dim_names_7__get___genexpr(PyObject*, 
std::vector<std::__cxx11::basic_string<char> >)’:
   
/home/pace/dev/arrow/python/build/temp.linux-x86_64-cpython-311/lib.cpp:161732:58:
 error: passing ‘const std::vector<std::__cxx11::basic_string<char> >’ as 
‘this’ argument discards qualifiers [-fpermissive]
   161732 |                   __pyx_cur_scope->__pyx_genexpr_arg_0 = 
__pyx_genexpr_arg_0;
          |                                                          
^~~~~~~~~~~~~~~~~~~
   In file included from /usr/include/c++/11/vector:72,
                    from 
/home/pace/miniconda3/envs/conbench3/include/arrow/array/array_base.h:24,
                    from 
/home/pace/miniconda3/envs/conbench3/include/arrow/array.h:41,
                    from 
/home/pace/miniconda3/envs/conbench3/include/arrow/pch.h:23,
                    from 
/home/pace/dev/arrow/python/pyarrow/src/arrow/python/pch.h:23,
                    from 
/home/pace/dev/arrow/python/build/temp.linux-x86_64-cpython-311/CMakeFiles/lib.dir/cmake_pch.hxx:5,
                    from <command-line>:
   /usr/include/c++/11/bits/vector.tcc:198:5: note:   in call to 
‘std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(const 
std::vector<_Tp, _Alloc>&) [with _Tp = std::__cxx11::basic_string<char>; _Alloc 
= std::allocator<std::__cxx11::basic_string<char> >]’
     198 |     vector<_Tp, _Alloc>::
         |     ^~~~~~~~~~~~~~~~~~~
   
   ```
   
   Is there somewhere I should file these against the cython project or are 
they already known issues?


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