google/flatbuffers

Test failures with Numpy 2.0

arkamar opened this issue · 2 comments

I tried to run tests with Numpy-2.0.0-rc2 and they fail with following errors:

 * python3_10: running distutils-r1_run_phase python_test
======================================================================
ERROR: test_create_numpy_vector_bool (__main__.TestByteLayout)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/var/tmp/portage/dev-python/flatbuffers-24.3.25/work/flatbuffers-24.3.25/tests/py_test.py", line 1430, in test_create_numpy_vector_bool
    x_other_endian = x.byteswap().newbyteorder()
AttributeError: `newbyteorder` was removed from the ndarray class in NumPy 2.0. Use `arr.view(arr.dtype.newbyteorder(order))` instead.

======================================================================
ERROR: test_create_numpy_vector_float32 (__main__.TestByteLayout)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/var/tmp/portage/dev-python/flatbuffers-24.3.25/work/flatbuffers-24.3.25/tests/py_test.py", line 1290, in test_create_numpy_vector_float32
    x_other_endian = x.byteswap().newbyteorder()
AttributeError: `newbyteorder` was removed from the ndarray class in NumPy 2.0. Use `arr.view(arr.dtype.newbyteorder(order))` instead.

======================================================================
ERROR: test_create_numpy_vector_float64 (__main__.TestByteLayout)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/var/tmp/portage/dev-python/flatbuffers-24.3.25/work/flatbuffers-24.3.25/tests/py_test.py", line 1364, in test_create_numpy_vector_float64
    x_other_endian = x.byteswap().newbyteorder()
AttributeError: `newbyteorder` was removed from the ndarray class in NumPy 2.0. Use `arr.view(arr.dtype.newbyteorder(order))` instead.

======================================================================
ERROR: test_create_numpy_vector_int64 (__main__.TestByteLayout)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/var/tmp/portage/dev-python/flatbuffers-24.3.25/work/flatbuffers-24.3.25/tests/py_test.py", line 1216, in test_create_numpy_vector_int64
    x_other_endian = x.byteswap().newbyteorder()
AttributeError: `newbyteorder` was removed from the ndarray class in NumPy 2.0. Use `arr.view(arr.dtype.newbyteorder(order))` instead.

======================================================================
ERROR: test_create_numpy_vector_int8 (__main__.TestByteLayout)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/var/tmp/portage/dev-python/flatbuffers-24.3.25/work/flatbuffers-24.3.25/tests/py_test.py", line 1098, in test_create_numpy_vector_int8
    x_other_endian = x.byteswap().newbyteorder()
AttributeError: `newbyteorder` was removed from the ndarray class in NumPy 2.0. Use `arr.view(arr.dtype.newbyteorder(order))` instead.

======================================================================
ERROR: test_create_numpy_vector_uint16 (__main__.TestByteLayout)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/var/tmp/portage/dev-python/flatbuffers-24.3.25/work/flatbuffers-24.3.25/tests/py_test.py", line 1147, in test_create_numpy_vector_uint16
    x_other_endian = x.byteswap().newbyteorder()
AttributeError: `newbyteorder` was removed from the ndarray class in NumPy 2.0. Use `arr.view(arr.dtype.newbyteorder(order))` instead.

----------------------------------------------------------------------
Ran 123 tests in 0.079s

FAILED (errors=6)
  • OS: Gentoo
  • Python 3.10.14
  • Numpy 2.0.0-rc2
  • GCC 15
  • FlatBuffers 24.3.25

It seems that the issue is still present in master branch but I didn't test it. I didn't find any related Issue nor PR.