ninia / jep

Embed Python in Java
Other
1.28k stars 145 forks source link

NumPy 1.20 #485

Closed rapgro closed 7 months ago

rapgro commented 11 months ago

Describe the problem ERROR: testArrayParams (test_numpy.TestNumpy.testArrayParams)

Tests passing an ndarray to a Java method that is expecting
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILD/jep-3.9.1/src/test/python/test_numpy.py", line 73, in testArrayParams
    za = numpy.zeros((15, 5), numpy.bool)
                              ^^^^^^^^^^
  File "/usr/lib64/python3.11/site-packages/numpy/__init__.py", line 305, in __getattr__
    raise AttributeError(__former_attrs__[attr])
AttributeError: module 'numpy' has no attribute 'bool'.
`np.bool` was a deprecated alias for the builtin `bool`. To avoid this error in existing code, use `bool` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.bool_` here.
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
    https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations

Search for existing solutions see above, use builtin bool instead of np.bool deprecation.

Environment (please complete the following information):

Logs see above

Additional context Add any other context about the problem here.

bsteffensmeier commented 11 months ago

The current plan is to update this test in the 4.2 release later this year, a commit is already in place: c6981203ee.

This problem should only affect tests and not actual jep functionality so you can workaround it on existing jep versions by skipping or removing that unit test.

bsteffensmeier commented 7 months ago

Jep 4.2 was officially released today so upgrading to the latest version will fix this problem.

rapgro commented 7 months ago

Well, as there's a quickfix with trivial downstream patch in my Fedora package, no need to rebuild. But I'll take a look into other feature with Jep 4.2 released. Thanks for letting me know about.