Skip to content

JPype 0.7.3

Compare
Choose a tag to compare
@Thrameos Thrameos released this 21 Apr 14:52
· 1245 commits to master since this release
4ef503e

This is a maintenance release correcting a number of issues from NumPy removal. Yet another stepping stone on the way to 1.0.

  • Replaced type management system, memory management for internal
    classes is now completely in Java to allow enhancements for
    buffer support and revised type conversion system.

  • Python module jpype.reflect will be removed in the next release.

  • jpype.startJVM option convertStrings default will become False
    in the next release.

  • Undocumented feature of using a Python type in JObject(obj, type=tp)
    is deprecated to support casting to Python wrapper types in Java in a
    future release.

  • Dropped support for Cygwin platform.

  • JFloat properly follows Java rules for conversion from JDouble.
    Floats outside of range map to inf and -inf.

  • java.lang.Number converts automatically from Python and Java numbers.
    Java primitive types will cast to their proper box type when passed
    to methods and fields taking Number.

  • java.lang.Object and java.lang.Number box signed, sized numpy types
    (int8, int16, int32, int64, float32, float64) to the Java boxed type
    with the same size automatically. Architecture dependent numpy
    types map to Long or Double like other Python types.

  • Explicit casting using primitives such as JInt will not produce an
    OverflowError. Implicit casting from Python types such as int or float
    will.

  • Returns for number type primitives will retain their return type
    information. These are derived from Python int and float types
    thus no change in behavior unless chaining from a Java methods
    which is not allowed in Java without a cast.
    JBoolean and JChar still produce Python types only.

  • Add support for direct conversion of multi-dimensional primitive arrays
    with JArray.of(array, [dtype=type])

  • java.nio.Buffer derived objects can convert to memoryview if they
    are direct. They can be converted to NumPy arrays with
    numpy.asarray(memoryview(obj)).

  • Proxies created with @JImplements properly implement toString,
    hashCode, and equals.

  • Proxies pass Python exceptions properly rather converting to
    java.lang.RuntimeException

  • JProxy.unwrap() will return the original instance object for proxies
    created with JProxy. Otherwise will return the proxy.

  • JProxy instances created with the convert=True argument will automatic
    unwrap when passed from Java to Python.

  • JProxy only creates one copy of the invocation handler per
    garbage collection rather than once per use. Thus proxy objects
    placed in memory containers will have the same object id so long
    as Java holds on to it.

  • @JImplements with keyword argument deferred can be started
    prior to starting the JVM. Methods are checked at first object
    creation.

  • Fix bug that was causing java.lang.Comparable, byte[],
    and char[] to be unhashable.

  • Fix bug causing segfault when throwing Exceptions which lack a
    default constructor.

  • Fixed segfault when methods called by proxy have incorrect number of
    arguments.

  • Fixed stack overflow crash on iterating ImmutableList

  • java.util.Map conforms to Python collections.abc.Mapping API.

  • java.lang.ArrayIndexOutOfBoundsException can be caught with
    IndexError for consistency with Python exception usage.

  • java.lang.NullPointerException can be caught with ValueError
    for consistency with Python exception usage.

  • Replaced type conversion system, type conversions test conversion
    once per type improving speed and increasing flexiblity.

  • User defined implicit conversions can be created with @JConversion
    decorator on Python function taking Java class and Python object.
    Converter function must produce a Java class instance.

  • pathlib.Path can be implicitly converted into java.lang.File
    and java.lang.Path.

  • datetime.datatime can implicitly convert to java.time.Instant.

  • dict and collections.abc.Mapping can convert to java.util.Map
    if all element are convertable to Java. Otherwise, TypeError is
    raised.

  • list and collections.abc.Sequence can convert to java.util.Collection
    if all elements are convertable to Java. Otherwise, TypeError is
    raised.