JPype 0.7.3
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
optionconvertStrings
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 fromJDouble
.
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
andjava.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 Pythonint
andfloat
types
thus no change in behavior unless chaining from a Java methods
which is not allowed in Java without a cast.
JBoolean
andJChar
still produce Python types only. -
Add support for direct conversion of multi-dimensional primitive arrays
withJArray.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 implementtoString
,
hashCode
, andequals
. -
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 argumentdeferred
can be started
prior to starting the JVM. Methods are checked at first object
creation. -
Fix bug that was causing
java.lang.Comparable
,byte[]
,
andchar[]
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 Pythoncollections.abc.Mapping
API. -
java.lang.ArrayIndexOutOfBoundsException
can be caught with
IndexError
for consistency with Python exception usage. -
java.lang.NullPointerException
can be caught withValueError
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 intojava.lang.File
andjava.lang.Path
. -
datetime.datatime
can implicitly convert tojava.time.Instant
. -
dict
andcollections.abc.Mapping
can convert tojava.util.Map
if all element are convertable to Java. Otherwise,TypeError
is
raised. -
list
andcollections.abc.Sequence
can convert tojava.util.Collection
if all elements are convertable to Java. Otherwise,TypeError
is
raised.