An-DJ commented on PR #1885:
URL: https://github.com/apache/fury/pull/1885#issuecomment-2453037302

   @chaokunyang This UT is strange.
   
   ```
   @pytest.mark.parametrize("language", [Language.XLANG, Language.PYTHON])
   def test_array_serializer(language):
       fury = Fury(language=language, ref_tracking=True, 
require_class_registration=False)
       for typecode in PyArraySerializer.typecode_dict.keys():
           arr = array.array(typecode, list(range(10)))
   
           # additional code to print array attribute
           print(arr.itemsize, arr.typecode)
           # end
   
           assert ser_de(fury, arr) == arr
       for dtype in Numpy1DArraySerializer.dtypes_dict.keys():
           arr = np.array(list(range(10)), dtype=dtype)
           new_arr = ser_de(fury, arr)
           assert np.array_equal(new_arr, arr)
           np.testing.assert_array_equal(new_arr, arr)
   ```
   
   I test it on Ubuntu 20.04 and Windows 10, but there are different result:
   
   ```
   # Ubuntu
   
   pyfury/tests/test_serializer.py::test_array_serializer[Language.XLANG] 2 h
   4 i
   8 l
   4 f
   8 d
   PASSED
   pyfury/tests/test_serializer.py::test_array_serializer[Language.PYTHON] 2 h
   4 i
   8 l
   4 f
   8 d
   PASSED
   ```
   
   ```
   # Windows
   
   =================== 1 failed, 1 passed, 3 warnings in 0.88s 
===================
   FAILED         [ 50%]
   2 h
   4 i
   4 l
   ```
   
   The point is that `l` type could be 4 or 8 bit on different platform.
   
   In addition, in `_util.pyx`, there are also failed converted between `const 
int64_t` and `long`:
   
   ```
   cdef inline uint8_t* get_address(v):
       view = memoryview(v)
       cdef str dtype = view.format
       cdef:
          # ...
           const int64_t[:] signed_long_data
          # ...
           uint8_t* ptr
       if dtype == "b":
           signed_char_data = v
           ptr = <uint8_t*>(&signed_char_data[0])
       elif dtype == "l":  # here
           signed_long_data = v
           ptr = <uint8_t*>(&signed_long_data[0])
       else:
           raise Exception(f"Unsupported buffer of type {type(v)} and format 
{dtype}")
       return ptr
   ```
   
   Could you plz give me some advice?


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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to