jep 4.2.0__tar.gz → 4.2.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {jep-4.2.0/src/main/python/jep.egg-info → jep-4.2.2}/PKG-INFO +8 -6
- {jep-4.2.0 → jep-4.2.2}/README.rst +6 -2
- {jep-4.2.0 → jep-4.2.2}/commands/__init__.py +5 -2
- {jep-4.2.0 → jep-4.2.2}/commands/java.py +8 -1
- {jep-4.2.0 → jep-4.2.2}/commands/util.py +4 -0
- {jep-4.2.0 → jep-4.2.2}/pom.xml +2 -2
- {jep-4.2.0 → jep-4.2.2}/release_notes/4.2-notes.rst +1 -1
- {jep-4.2.0 → jep-4.2.2}/setup.py +12 -4
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/pyembed.h +1 -1
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Jep/maininterpreter.c +3 -2
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Jep/pyembed.c +14 -4
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Jep/python/jep_object.c +1 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Objects/pyjtype.c +30 -11
- jep-4.2.2/src/main/java/jep/AllowPythonClassEnquirer.java +96 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/java/jep/ClassEnquirer.java +1 -1
- {jep-4.2.0 → jep-4.2.2}/src/main/java/jep/ClassList.java +5 -2
- {jep-4.2.0 → jep-4.2.2}/src/main/java/jep/Jep.java +39 -14
- {jep-4.2.0 → jep-4.2.2}/src/main/java/jep/JepConfig.java +10 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/java/jep/MainInterpreter.java +2 -2
- {jep-4.2.0 → jep-4.2.2}/src/main/java/jep/PyConfig.java +32 -1
- {jep-4.2.0 → jep-4.2.2}/src/main/java/jep/Run.java +1 -1
- {jep-4.2.0 → jep-4.2.2}/src/main/java/jep/SubInterpreterOptions.java +71 -25
- {jep-4.2.0 → jep-4.2.2}/src/main/python/jep/version.py +1 -1
- {jep-4.2.0 → jep-4.2.2/src/main/python/jep.egg-info}/PKG-INFO +8 -6
- {jep-4.2.0 → jep-4.2.2}/src/main/python/jep.egg-info/SOURCES.txt +4 -0
- {jep-4.2.0 → jep-4.2.2}/src/test/java/jep/test/Test.java +8 -28
- jep-4.2.2/src/test/java/jep/test/TestAllowPythonEnquirer.java +132 -0
- {jep-4.2.0 → jep-4.2.2}/src/test/java/jep/test/TestGetJPyObject.java +32 -0
- {jep-4.2.0 → jep-4.2.2}/src/test/java/jep/test/TestSubInterpOptions.java +41 -1
- {jep-4.2.0 → jep-4.2.2}/src/test/java/jep/test/numpy/TestNumpy.java +3 -3
- jep-4.2.2/src/test/java/jep/test/util/SubInterpreterThread.java +41 -0
- jep-4.2.2/src/test/python/test_allow_python_enquirer.py +12 -0
- {jep-4.2.0 → jep-4.2.2}/src/test/python/test_regressions.py +14 -0
- {jep-4.2.0 → jep-4.2.2}/AUTHORS +0 -0
- {jep-4.2.0 → jep-4.2.2}/LICENSE +0 -0
- {jep-4.2.0 → jep-4.2.2}/MANIFEST.in +0 -0
- {jep-4.2.0 → jep-4.2.2}/commands/_msvccompiler.py +0 -0
- {jep-4.2.0 → jep-4.2.2}/commands/build_ext.py +0 -0
- {jep-4.2.0 → jep-4.2.2}/commands/clean.py +0 -0
- {jep-4.2.0 → jep-4.2.2}/commands/dist.py +0 -0
- {jep-4.2.0 → jep-4.2.2}/commands/install_lib.py +0 -0
- {jep-4.2.0 → jep-4.2.2}/commands/javadoc.py +0 -0
- {jep-4.2.0 → jep-4.2.2}/commands/link_util.py +0 -0
- {jep-4.2.0 → jep-4.2.2}/commands/msvc9compiler.py +0 -0
- {jep-4.2.0 → jep-4.2.2}/commands/python.py +0 -0
- {jep-4.2.0 → jep-4.2.2}/commands/scripts.py +0 -0
- {jep-4.2.0 → jep-4.2.2}/commands/test.py +0 -0
- {jep-4.2.0 → jep-4.2.2}/release_notes/1.0-notes.rst +0 -0
- {jep-4.2.0 → jep-4.2.2}/release_notes/1.1-notes.rst +0 -0
- {jep-4.2.0 → jep-4.2.2}/release_notes/2.0-notes.rst +0 -0
- {jep-4.2.0 → jep-4.2.2}/release_notes/2.1-notes.rst +0 -0
- {jep-4.2.0 → jep-4.2.2}/release_notes/2.2-notes.rst +0 -0
- {jep-4.2.0 → jep-4.2.2}/release_notes/2.3-notes.rst +0 -0
- {jep-4.2.0 → jep-4.2.2}/release_notes/2.4-notes.rst +0 -0
- {jep-4.2.0 → jep-4.2.2}/release_notes/3.0-notes.rst +0 -0
- {jep-4.2.0 → jep-4.2.2}/release_notes/3.1-notes.rst +0 -0
- {jep-4.2.0 → jep-4.2.2}/release_notes/3.2-notes.rst +0 -0
- {jep-4.2.0 → jep-4.2.2}/release_notes/3.3-notes.rst +0 -0
- {jep-4.2.0 → jep-4.2.2}/release_notes/3.4-notes.rst +0 -0
- {jep-4.2.0 → jep-4.2.2}/release_notes/3.5-notes.rst +0 -0
- {jep-4.2.0 → jep-4.2.2}/release_notes/3.6-notes.rst +0 -0
- {jep-4.2.0 → jep-4.2.2}/release_notes/3.7-notes.rst +0 -0
- {jep-4.2.0 → jep-4.2.2}/release_notes/3.8-notes.rst +0 -0
- {jep-4.2.0 → jep-4.2.2}/release_notes/3.9-notes.rst +0 -0
- {jep-4.2.0 → jep-4.2.2}/release_notes/4.0-notes.rst +0 -0
- {jep-4.2.0 → jep-4.2.2}/release_notes/4.1-notes.rst +0 -0
- {jep-4.2.0 → jep-4.2.2}/setup.cfg +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/Jep.h +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/convert_j2p.h +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/convert_p2j.h +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/java_access/AnnotatedElement.h +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/java_access/ArrayList.h +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/java_access/AutoCloseable.h +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/java_access/BigInteger.h +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/java_access/Boolean.h +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/java_access/Buffer.h +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/java_access/Byte.h +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/java_access/ByteBuffer.h +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/java_access/ByteOrder.h +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/java_access/CharBuffer.h +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/java_access/Character.h +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/java_access/Class.h +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/java_access/ClassLoader.h +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/java_access/Collection.h +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/java_access/Collections.h +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/java_access/Comparable.h +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/java_access/Double.h +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/java_access/DoubleBuffer.h +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/java_access/Entry.h +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/java_access/Executable.h +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/java_access/Field.h +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/java_access/Float.h +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/java_access/FloatBuffer.h +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/java_access/HashMap.h +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/java_access/IntBuffer.h +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/java_access/Integer.h +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/java_access/Iterable.h +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/java_access/Iterator.h +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/java_access/JPyCallable.h +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/java_access/JPyMethod.h +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/java_access/JPyObject.h +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/java_access/JepException.h +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/java_access/List.h +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/java_access/Long.h +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/java_access/LongBuffer.h +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/java_access/Map.h +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/java_access/Member.h +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/java_access/Method.h +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/java_access/Modifier.h +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/java_access/Number.h +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/java_access/Object.h +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/java_access/Proxy.h +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/java_access/Short.h +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/java_access/ShortBuffer.h +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/java_access/String.h +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/java_access/Throwable.h +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/jep_exceptions.h +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/jep_numpy.h +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/jep_platform.h +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/jep_util.h +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/pyjarray.h +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/pyjautocloseable.h +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/pyjbuffer.h +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/pyjclass.h +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/pyjcollection.h +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/pyjconstructor.h +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/pyjfield.h +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/pyjiterable.h +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/pyjiterator.h +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/pyjlist.h +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/pyjmap.h +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/pyjmethod.h +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/pyjmonitor.h +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/pyjmultimethod.h +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/pyjnumber.h +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/pyjobject.h +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/pyjtype.h +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/winconfig.h +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Jep/convert_j2p.c +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Jep/convert_p2j.c +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Jep/java_access/AnnotatedElement.c +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Jep/java_access/ArrayList.c +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Jep/java_access/AutoCloseable.c +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Jep/java_access/BigInteger.c +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Jep/java_access/Boolean.c +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Jep/java_access/Buffer.c +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Jep/java_access/Byte.c +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Jep/java_access/ByteBuffer.c +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Jep/java_access/ByteOrder.c +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Jep/java_access/CharBuffer.c +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Jep/java_access/Character.c +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Jep/java_access/Class.c +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Jep/java_access/ClassLoader.c +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Jep/java_access/Collection.c +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Jep/java_access/Collections.c +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Jep/java_access/Comparable.c +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Jep/java_access/Double.c +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Jep/java_access/DoubleBuffer.c +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Jep/java_access/Entry.c +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Jep/java_access/Executable.c +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Jep/java_access/Field.c +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Jep/java_access/Float.c +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Jep/java_access/FloatBuffer.c +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Jep/java_access/HashMap.c +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Jep/java_access/IntBuffer.c +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Jep/java_access/Integer.c +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Jep/java_access/Iterable.c +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Jep/java_access/Iterator.c +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Jep/java_access/JPyCallable.c +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Jep/java_access/JPyMethod.c +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Jep/java_access/JPyObject.c +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Jep/java_access/JepException.c +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Jep/java_access/List.c +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Jep/java_access/Long.c +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Jep/java_access/LongBuffer.c +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Jep/java_access/Map.c +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Jep/java_access/Member.c +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Jep/java_access/Method.c +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Jep/java_access/Modifier.c +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Jep/java_access/Number.c +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Jep/java_access/Object.c +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Jep/java_access/Proxy.c +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Jep/java_access/Short.c +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Jep/java_access/ShortBuffer.c +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Jep/java_access/String.c +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Jep/java_access/Throwable.c +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Jep/jep.c +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Jep/jep_exceptions.c +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Jep/jep_numpy.c +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Jep/jep_util.c +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Jep/python/invocationhandler.c +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Jep/python/jpycallable.c +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Jep/python/pypointer.c +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Objects/pyjarray.c +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Objects/pyjautocloseable.c +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Objects/pyjbuffer.c +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Objects/pyjclass.c +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Objects/pyjcollection.c +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Objects/pyjconstructor.c +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Objects/pyjfield.c +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Objects/pyjiterable.c +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Objects/pyjiterator.c +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Objects/pyjlist.c +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Objects/pyjmap.c +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Objects/pyjmethod.c +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Objects/pyjmonitor.c +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Objects/pyjmultimethod.c +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Objects/pyjnumber.c +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/c/Objects/pyjobject.c +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/java/jep/AbstractNDArray.java +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/java/jep/DirectNDArray.java +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/java/jep/Interpreter.java +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/java/jep/JepAccess.java +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/java/jep/JepException.java +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/java/jep/LibraryLocator.java +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/java/jep/NDArray.java +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/java/jep/NamingConventionClassEnquirer.java +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/java/jep/Proxy.java +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/java/jep/PyMethod.java +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/java/jep/SharedInterpreter.java +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/java/jep/SubInterpreter.java +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/java/jep/python/InvocationHandler.java +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/java/jep/python/MemoryManager.java +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/java/jep/python/PyBuiltins.java +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/java/jep/python/PyCallable.java +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/java/jep/python/PyObject.java +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/java/jep/python/PyPointer.java +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/python/jep/__init__.py +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/python/jep/console.py +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/python/jep/java_import_hook.py +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/python/jep/jdbc.py +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/python/jep/redirect_streams.py +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/python/jep/shared_modules_hook.py +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/python/jep.egg-info/dependency_links.txt +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/python/jep.egg-info/not-zip-safe +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/python/jep.egg-info/top_level.txt +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/resources/jep/classlist_10.txt +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/resources/jep/classlist_11.txt +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/resources/jep/classlist_8.txt +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/resources/jep/classlist_9.txt +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/scripts/jep +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/main/scripts/jep.bat +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/test/java/jep/test/TestCloseWithThreads.java +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/test/java/jep/test/TestCompiledScript.java +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/test/java/jep/test/TestDefaultMethods.java +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/test/java/jep/test/TestExceptionCause.java +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/test/java/jep/test/TestExec.java +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/test/java/jep/test/TestGetByteArray.java +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/test/java/jep/test/TestGetCollectionBoxing.java +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/test/java/jep/test/TestGetTempValue.java +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/test/java/jep/test/TestGetWithClass.java +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/test/java/jep/test/TestInvoke.java +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/test/java/jep/test/TestIteratorable.java +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/test/java/jep/test/TestOverload.java +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/test/java/jep/test/TestPreInitVariables.java +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/test/java/jep/test/TestPyBuiltins.java +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/test/java/jep/test/TestPyJObject.java +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/test/java/jep/test/TestPyJType.java +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/test/java/jep/test/TestRedirectStreams.java +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/test/java/jep/test/TestSharedArgv.java +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/test/java/jep/test/TestSharedInterpreter.java +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/test/java/jep/test/TestSharedModules.java +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/test/java/jep/test/TestSharedModulesThreads.java +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/test/java/jep/test/closeable/TestAutoCloseable.java +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/test/java/jep/test/numpy/TestNumpyArrayToString.java +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/test/java/jep/test/numpy/TestNumpyProdShared.java +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/test/java/jep/test/synchronization/TestCrossLangSync.java +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/test/java/jep/test/types/TestFieldTypes.java +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/test/java/jep/test/types/TestMethodTypes.java +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/test/java/jep/test/types/TestStaticFieldTypes.java +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/test/java/jep/test/types/TestStaticMethodTypes.java +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/test/python/__init__.py +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/test/python/data/read_file.txt +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/test/python/jep_pipe.py +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/test/python/lib/fakenetty.jar +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/test/python/lib/sqlitejdbc-v056.jar +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/test/python/runtests.py +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/test/python/subprocess/invoke_args.py +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/test/python/subprocess/iter_itr_crash.py +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/test/python/test_array.py +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/test/python/test_autocloseable.py +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/test/python/test_call.py +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/test/python/test_compare.py +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/test/python/test_convert.py +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/test/python/test_dir.py +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/test/python/test_exceptions.py +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/test/python/test_exec.py +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/test/python/test_getvalue.py +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/test/python/test_import.py +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/test/python/test_invoke.py +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/test/python/test_iterators.py +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/test/python/test_jdbc.py +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/test/python/test_jproxy.py +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/test/python/test_lists.py +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/test/python/test_maps.py +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/test/python/test_numbers.py +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/test/python/test_numpy.py +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/test/python/test_object.py +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/test/python/test_overload.py +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/test/python/test_preinits.py +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/test/python/test_pybuiltins.py +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/test/python/test_python_memory.py +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/test/python/test_redirect_streams.py +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/test/python/test_run_script.py +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/test/python/test_shared_interpreter.py +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/test/python/test_shared_modules.py +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/test/python/test_sub_interp_options.py +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/test/python/test_synchronized.py +0 -0
- {jep-4.2.0 → jep-4.2.2}/src/test/python/test_types.py +0 -0
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: jep
|
|
3
|
-
Version: 4.2.
|
|
3
|
+
Version: 4.2.2
|
|
4
4
|
Summary: Jep embeds CPython in Java
|
|
5
5
|
Home-page: https://github.com/ninia/jep
|
|
6
6
|
Author: Jep Developers
|
|
7
7
|
Author-email: jep-project@googlegroups.com
|
|
8
8
|
License: zlib/libpng
|
|
9
9
|
Keywords: java
|
|
10
|
-
Platform: UNKNOWN
|
|
11
10
|
Classifier: License :: OSI Approved :: zlib/libpng License
|
|
12
11
|
Classifier: Development Status :: 5 - Production/Stable
|
|
13
12
|
Classifier: Intended Audience :: Developers
|
|
@@ -21,6 +20,7 @@ Classifier: Programming Language :: Python :: 3.9
|
|
|
21
20
|
Classifier: Programming Language :: Python :: 3.10
|
|
22
21
|
Classifier: Programming Language :: Python :: 3.11
|
|
23
22
|
Classifier: Programming Language :: Python :: 3.12
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
24
24
|
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
25
25
|
License-File: LICENSE
|
|
26
26
|
License-File: AUTHORS
|
|
@@ -66,8 +66,12 @@ Some benefits of embedding CPython in a JVM:
|
|
|
66
66
|
|
|
67
67
|
Installation
|
|
68
68
|
------------
|
|
69
|
-
Simply run ``pip install jep`` or download
|
|
70
|
-
|
|
69
|
+
Simply run ``pip install --no-cache-dir --no-build-isolation jep`` or download
|
|
70
|
+
the source and run ``pip install .``. Building and installing require the JDK,
|
|
71
|
+
Python, setuptools, and optionally numpy to be installed beforehand. The
|
|
72
|
+
``--no-cache-dir`` and ``--no-build-isolation`` options are not strictly
|
|
73
|
+
required, however those settings enable Jep to make customizations for your
|
|
74
|
+
environment such as enabling numpy specific behavior if numpy is installed.
|
|
71
75
|
|
|
72
76
|
Dependencies
|
|
73
77
|
------------
|
|
@@ -99,5 +103,3 @@ been resolved.
|
|
|
99
103
|
|
|
100
104
|
|
|
101
105
|
*Jep Team*
|
|
102
|
-
|
|
103
|
-
|
|
@@ -39,8 +39,12 @@ Some benefits of embedding CPython in a JVM:
|
|
|
39
39
|
|
|
40
40
|
Installation
|
|
41
41
|
------------
|
|
42
|
-
Simply run ``pip install jep`` or download
|
|
43
|
-
|
|
42
|
+
Simply run ``pip install --no-cache-dir --no-build-isolation jep`` or download
|
|
43
|
+
the source and run ``pip install .``. Building and installing require the JDK,
|
|
44
|
+
Python, setuptools, and optionally numpy to be installed beforehand. The
|
|
45
|
+
``--no-cache-dir`` and ``--no-build-isolation`` options are not strictly
|
|
46
|
+
required, however those settings enable Jep to make customizations for your
|
|
47
|
+
environment such as enabling numpy specific behavior if numpy is installed.
|
|
44
48
|
|
|
45
49
|
Dependencies
|
|
46
50
|
------------
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
from
|
|
1
|
+
try:
|
|
2
|
+
from setuptools.command.build import build
|
|
3
|
+
except ImportError:
|
|
4
|
+
from distutils.command.build import build
|
|
5
|
+
|
|
3
6
|
from commands.java import build_java
|
|
4
7
|
|
|
5
8
|
class jep_build(build):
|
|
@@ -10,9 +10,10 @@ import fnmatch
|
|
|
10
10
|
import traceback
|
|
11
11
|
import sys
|
|
12
12
|
import logging
|
|
13
|
+
from pathlib import Path
|
|
13
14
|
|
|
14
15
|
from commands.util import configure_error
|
|
15
|
-
from commands.util import is_osx
|
|
16
|
+
from commands.util import is_osx, is_linux
|
|
16
17
|
from commands.util import shell
|
|
17
18
|
from commands.util import CommandFailed
|
|
18
19
|
from commands.util import warning
|
|
@@ -48,6 +49,12 @@ def get_java_home():
|
|
|
48
49
|
except CommandFailed:
|
|
49
50
|
traceback.print_exc()
|
|
50
51
|
|
|
52
|
+
if is_linux():
|
|
53
|
+
javac_path = shutil.which('javac')
|
|
54
|
+
if javac_path is not None:
|
|
55
|
+
_java_home = Path(javac_path).resolve().parent.parent.as_posix()
|
|
56
|
+
return _java_home
|
|
57
|
+
|
|
51
58
|
configure_error(
|
|
52
59
|
'Please set the environment variable JAVA_HOME to a path containing the JDK.')
|
|
53
60
|
|
{jep-4.2.0 → jep-4.2.2}/pom.xml
RENAMED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
<groupId>black.ninia</groupId>
|
|
8
8
|
<artifactId>jep</artifactId>
|
|
9
|
-
<version>4.2.
|
|
9
|
+
<version>4.2.2</version>
|
|
10
10
|
<packaging>jar</packaging>
|
|
11
11
|
|
|
12
12
|
<name>Java Embedded Python</name>
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
<scm>
|
|
40
40
|
<connection>scm:git:git://github.com/ninia/jep.git</connection>
|
|
41
41
|
<developerConnection>scm:git:ssh://github.com:ninia/jep.git</developerConnection>
|
|
42
|
-
<url>https://github.com/ninia/jep/tree/v4.2.
|
|
42
|
+
<url>https://github.com/ninia/jep/tree/v4.2.2</url>
|
|
43
43
|
</scm>
|
|
44
44
|
|
|
45
45
|
<properties>
|
|
@@ -28,7 +28,7 @@ situations where duck typing is not good enough and a dictionary is required.
|
|
|
28
28
|
|
|
29
29
|
Additions of PyBuiltins
|
|
30
30
|
***********************
|
|
31
|
-
The `PyBuiltins <http://ninia.github.io/jep/javadoc/4.2/jep/python/
|
|
31
|
+
The `PyBuiltins <http://ninia.github.io/jep/javadoc/4.2/jep/python/PyBuiltins.html>`_
|
|
32
32
|
class provides makes it easier to call some of the builtin Python functions
|
|
33
33
|
from Java.
|
|
34
34
|
|
{jep-4.2.0 → jep-4.2.2}/setup.py
RENAMED
|
@@ -29,11 +29,18 @@ numpy_include = []
|
|
|
29
29
|
numpy_found = 0
|
|
30
30
|
try:
|
|
31
31
|
import numpy
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
numpy1_include_path = os.path.join(numpy.__path__[0], 'core', 'include')
|
|
33
|
+
numpy2_include_path = os.path.join(numpy.__path__[0], '_core', 'include')
|
|
34
|
+
if os.path.exists(numpy1_include_path):
|
|
35
|
+
print('numpy include found at', numpy1_include_path)
|
|
35
36
|
numpy_found = 1
|
|
36
|
-
numpy_include = [
|
|
37
|
+
numpy_include = [numpy1_include_path]
|
|
38
|
+
elif os.path.exists(numpy2_include_path):
|
|
39
|
+
print('numpy include found at', numpy2_include_path)
|
|
40
|
+
numpy_found = 1
|
|
41
|
+
numpy_include = [numpy2_include_path]
|
|
42
|
+
else:
|
|
43
|
+
print('numpy include not found')
|
|
37
44
|
except ImportError:
|
|
38
45
|
print('numpy not found, running without numpy support')
|
|
39
46
|
|
|
@@ -100,6 +107,7 @@ if __name__ == '__main__':
|
|
|
100
107
|
'Programming Language :: Python :: 3.10',
|
|
101
108
|
'Programming Language :: Python :: 3.11',
|
|
102
109
|
'Programming Language :: Python :: 3.12',
|
|
110
|
+
'Programming Language :: Python :: 3.13',
|
|
103
111
|
'Programming Language :: Python :: Implementation :: CPython',
|
|
104
112
|
],
|
|
105
113
|
ext_modules=[
|
|
@@ -44,7 +44,7 @@ typedef struct __JepThread JepThread;
|
|
|
44
44
|
|
|
45
45
|
|
|
46
46
|
void pyembed_preinit(JNIEnv*, jint, jint, jint, jint, jint, jint, jint,
|
|
47
|
-
jstring);
|
|
47
|
+
jstring, jstring);
|
|
48
48
|
void pyembed_startup(JNIEnv*, jobjectArray);
|
|
49
49
|
void pyembed_shutdown(JavaVM*);
|
|
50
50
|
void pyembed_shared_import(JNIEnv*, jstring);
|
|
@@ -47,11 +47,12 @@ JNIEXPORT void JNICALL Java_jep_MainInterpreter_setInitParams
|
|
|
47
47
|
jint optimizeFlag,
|
|
48
48
|
jint dontWriteBytecodeFlag,
|
|
49
49
|
jint hashRandomizationFlag,
|
|
50
|
-
jstring pythonHome
|
|
50
|
+
jstring pythonHome,
|
|
51
|
+
jstring programName)
|
|
51
52
|
{
|
|
52
53
|
pyembed_preinit(env, noSiteFlag, noUserSiteDirectory, ignoreEnvironmentFlag,
|
|
53
54
|
verboseFlag, optimizeFlag, dontWriteBytecodeFlag,
|
|
54
|
-
hashRandomizationFlag, pythonHome);
|
|
55
|
+
hashRandomizationFlag, pythonHome, programName);
|
|
55
56
|
}
|
|
56
57
|
|
|
57
58
|
/*
|
|
@@ -239,7 +239,8 @@ void pyembed_preinit(JNIEnv *env,
|
|
|
239
239
|
jint optimizeFlag,
|
|
240
240
|
jint dontWriteBytecodeFlag,
|
|
241
241
|
jint hashRandomizationFlag,
|
|
242
|
-
jstring pythonHome
|
|
242
|
+
jstring pythonHome,
|
|
243
|
+
jstring programName)
|
|
243
244
|
{
|
|
244
245
|
if (noSiteFlag >= 0) {
|
|
245
246
|
Py_NoSiteFlag = noSiteFlag;
|
|
@@ -270,6 +271,14 @@ void pyembed_preinit(JNIEnv *env,
|
|
|
270
271
|
// Python documentation says that the string should not be changed for
|
|
271
272
|
// the duration of the program so it can never be freed.
|
|
272
273
|
}
|
|
274
|
+
if (programName) {
|
|
275
|
+
const char* nameAsUTF = (*env)->GetStringUTFChars(env, programName, NULL);
|
|
276
|
+
wchar_t* nameForPython = Py_DecodeLocale(nameAsUTF, NULL);
|
|
277
|
+
(*env)->ReleaseStringUTFChars(env, programName, nameAsUTF);
|
|
278
|
+
Py_SetProgramName(nameForPython);
|
|
279
|
+
// Python documentation says that the string should not be changed for
|
|
280
|
+
// the duration of the program so it can never be freed.
|
|
281
|
+
}
|
|
273
282
|
}
|
|
274
283
|
|
|
275
284
|
/*
|
|
@@ -561,7 +570,7 @@ void pyembed_shared_import(JNIEnv *env, jstring module)
|
|
|
561
570
|
intptr_t pyembed_thread_init(JNIEnv *env, jobject cl, jobject caller,
|
|
562
571
|
jboolean hasSharedModules, jboolean usesubinterpreter,
|
|
563
572
|
jboolean isolated, jint useMainObmalloc, jint allowFork,
|
|
564
|
-
|
|
573
|
+
jint allowExec, jint allowThreads, jint allowDaemonThreads,
|
|
565
574
|
jint checkMultiInterpExtensions, jint ownGIL)
|
|
566
575
|
{
|
|
567
576
|
JepThread *jepThread;
|
|
@@ -587,8 +596,8 @@ intptr_t pyembed_thread_init(JNIEnv *env, jobject cl, jobject caller,
|
|
|
587
596
|
PyEval_AcquireThread(mainThreadState);
|
|
588
597
|
|
|
589
598
|
#if PY_MAJOR_VERSION > 3 || PY_MINOR_VERSION >= 12
|
|
590
|
-
PyInterpreterConfig config;
|
|
591
|
-
|
|
599
|
+
PyInterpreterConfig config;
|
|
600
|
+
if (isolated) {
|
|
592
601
|
config = (PyInterpreterConfig) _PyInterpreterConfig_INIT;
|
|
593
602
|
} else {
|
|
594
603
|
config = (PyInterpreterConfig) _PyInterpreterConfig_LEGACY_INIT;
|
|
@@ -703,6 +712,7 @@ void pyembed_thread_close(JNIEnv *env, intptr_t _jepThread)
|
|
|
703
712
|
Py_DECREF(key);
|
|
704
713
|
|
|
705
714
|
Py_CLEAR(jepThread->globals);
|
|
715
|
+
PyGC_Collect();
|
|
706
716
|
|
|
707
717
|
if (jepThread->classloader) {
|
|
708
718
|
(*env)->DeleteGlobalRef(env, jepThread->classloader);
|
|
@@ -32,6 +32,13 @@ static PyTypeObject PyJType_Type;
|
|
|
32
32
|
static PyTypeObject* pyjtype_get_cached(JNIEnv*, PyObject*, jclass);
|
|
33
33
|
static int addMethods(JNIEnv*, PyObject*, jclass);
|
|
34
34
|
|
|
35
|
+
/*
|
|
36
|
+
* Flag to indicate if methods have been added to static types. Most types are
|
|
37
|
+
* reinitialized for each interpreter but static types are shared between
|
|
38
|
+
* interpreters and must be initialized only once.
|
|
39
|
+
*/
|
|
40
|
+
static int staticTypesInitialized = 0;
|
|
41
|
+
|
|
35
42
|
/*
|
|
36
43
|
* Populate pyjmethods for a type and add it to the cache. This is for custom
|
|
37
44
|
* types with extra logic in c since we are not able to add pyjmethods before
|
|
@@ -127,12 +134,24 @@ static int populateCustomTypeDict(JNIEnv *env, PyObject* fqnToPyType)
|
|
|
127
134
|
&PyJObject_Type)) {
|
|
128
135
|
return -1;
|
|
129
136
|
}
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
137
|
+
if (staticTypesInitialized) {
|
|
138
|
+
if (PyDict_SetItemString(fqnToPyType, PyJBuffer_Type.tp_name,
|
|
139
|
+
(PyObject * ) &PyJBuffer_Type)) {
|
|
140
|
+
return -1;
|
|
141
|
+
}
|
|
142
|
+
if (PyDict_SetItemString(fqnToPyType, PyJObject_Type.tp_name,
|
|
143
|
+
(PyObject * ) &PyJObject_Type)) {
|
|
144
|
+
return -1;
|
|
145
|
+
}
|
|
146
|
+
} else {
|
|
147
|
+
/* TODO In python 3.8 buffer protocol was added to spec so pybuffer type can use a spec */
|
|
148
|
+
if (!addCustomTypeToTypeDict(env, fqnToPyType, JBUFFER_TYPE, &PyJBuffer_Type)) {
|
|
149
|
+
return -1;
|
|
150
|
+
}
|
|
151
|
+
if (!addCustomTypeToTypeDict(env, fqnToPyType, JOBJECT_TYPE, &PyJObject_Type)) {
|
|
152
|
+
return -1;
|
|
153
|
+
}
|
|
154
|
+
staticTypesInitialized = 1;
|
|
136
155
|
}
|
|
137
156
|
return 0;
|
|
138
157
|
}
|
|
@@ -297,10 +316,10 @@ static int addMethods(JNIEnv* env, PyObject* dict, jclass clazz)
|
|
|
297
316
|
if (isAbstract) {
|
|
298
317
|
if (oneAbstractPyJMethod) {
|
|
299
318
|
/*
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
319
|
+
* If there is already one abstract method and this method is also
|
|
320
|
+
* abstract then this isn't a functional interface and there is no need
|
|
321
|
+
* to keep track of abstract methods.
|
|
322
|
+
*/
|
|
304
323
|
functionalInterface = JNI_FALSE;
|
|
305
324
|
oneAbstractPyJMethod = NULL;
|
|
306
325
|
} else {
|
|
@@ -440,7 +459,7 @@ static PyTypeObject* pyjtype_get_new(JNIEnv *env, PyObject *fqnToPyType,
|
|
|
440
459
|
* See https://docs.python.org/3/library/functions.html#type
|
|
441
460
|
*/
|
|
442
461
|
type = (PyTypeObject*) PyObject_CallFunctionObjArgs((PyObject*) &PyJType_Type,
|
|
443
|
-
|
|
462
|
+
shortName, bases, dict, NULL);
|
|
444
463
|
}
|
|
445
464
|
Py_DECREF(bases);
|
|
446
465
|
Py_DECREF(dict);
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2024 JEP AUTHORS.
|
|
3
|
+
*
|
|
4
|
+
* This file is licensed under the the zlib/libpng License.
|
|
5
|
+
*
|
|
6
|
+
* This software is provided 'as-is', without any express or implied
|
|
7
|
+
* warranty. In no event will the authors be held liable for any
|
|
8
|
+
* damages arising from the use of this software.
|
|
9
|
+
*
|
|
10
|
+
* Permission is granted to anyone to use this software for any
|
|
11
|
+
* purpose, including commercial applications, and to alter it and
|
|
12
|
+
* redistribute it freely, subject to the following restrictions:
|
|
13
|
+
*
|
|
14
|
+
* 1. The origin of this software must not be misrepresented; you
|
|
15
|
+
* must not claim that you wrote the original software. If you use
|
|
16
|
+
* this software in a product, an acknowledgment in the product
|
|
17
|
+
* documentation would be appreciated but is not required.
|
|
18
|
+
*
|
|
19
|
+
* 2. Altered source versions must be plainly marked as such, and
|
|
20
|
+
* must not be misrepresented as being the original software.
|
|
21
|
+
*
|
|
22
|
+
* 3. This notice may not be removed or altered from any source
|
|
23
|
+
* distribution.
|
|
24
|
+
*/
|
|
25
|
+
package jep;
|
|
26
|
+
|
|
27
|
+
import java.util.HashSet;
|
|
28
|
+
import java.util.Set;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* <p>
|
|
32
|
+
* A {@link ClassEnquirer} that defines specific packages as Python packages.
|
|
33
|
+
* This implementation takes a delegate ClassEnquirer to delegate all import
|
|
34
|
+
* determinations as Java or Python except in the cases of the specific Python
|
|
35
|
+
* package names provided. Imports of the specified packages in the embedded
|
|
36
|
+
* Python interpreter will use the Python importer and not the Java importer.
|
|
37
|
+
* This is useful when you have package name conflicts between Java and Python.
|
|
38
|
+
* Some examples are projects like py4j and tensorflow which have Python package
|
|
39
|
+
* names matching Java package names. In those cases, using the default
|
|
40
|
+
* ClassEnquirer of {@link ClassList} will lead to the Java packages on the
|
|
41
|
+
* classpath taking precedence on imports instead of the Python package. That
|
|
42
|
+
* can be solved by using this ClassEnquirer with a delegate of ClassList's
|
|
43
|
+
* instance.
|
|
44
|
+
* </p>
|
|
45
|
+
*
|
|
46
|
+
* @author Nate Jensen
|
|
47
|
+
*
|
|
48
|
+
* @since 4.2.1
|
|
49
|
+
*/
|
|
50
|
+
public class AllowPythonClassEnquirer implements ClassEnquirer {
|
|
51
|
+
|
|
52
|
+
protected ClassEnquirer delegate;
|
|
53
|
+
|
|
54
|
+
protected Set<String> pyPkgNames = new HashSet<>();
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Constructor
|
|
58
|
+
*
|
|
59
|
+
* @param delegate
|
|
60
|
+
* the ClassEnquirer instance to delegate method calls to except
|
|
61
|
+
* in the case of the specified Python package names
|
|
62
|
+
* @param pythonPackageNames
|
|
63
|
+
* the names of Python packages that should not be treated as a
|
|
64
|
+
* potential import from Java and instead should immediately
|
|
65
|
+
* default to being imported by the normal Python importer
|
|
66
|
+
*/
|
|
67
|
+
public AllowPythonClassEnquirer(ClassEnquirer delegate,
|
|
68
|
+
String... pythonPackageNames) {
|
|
69
|
+
this.delegate = delegate;
|
|
70
|
+
for (String pyPkg : pythonPackageNames) {
|
|
71
|
+
pyPkgNames.add(pyPkg);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
@Override
|
|
76
|
+
public boolean isJavaPackage(String name) {
|
|
77
|
+
for (String pyPkg : pyPkgNames) {
|
|
78
|
+
if (name.equals(pyPkg) || name.startsWith(pyPkg + ".")) {
|
|
79
|
+
return false;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
return delegate.isJavaPackage(name);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
@Override
|
|
87
|
+
public String[] getClassNames(String pkgName) {
|
|
88
|
+
return delegate.getClassNames(pkgName);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
@Override
|
|
92
|
+
public String[] getSubPackages(String pkgName) {
|
|
93
|
+
return delegate.getSubPackages(pkgName);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
}
|
|
@@ -48,7 +48,7 @@ public interface ClassEnquirer {
|
|
|
48
48
|
* Java packages unless a ClassEnquirer explicitly chooses to include them.
|
|
49
49
|
*/
|
|
50
50
|
public static final String[] RESTRICTED_PKG_NAMES = new String[] { "io",
|
|
51
|
-
"re" };
|
|
51
|
+
"re", "py4j" };
|
|
52
52
|
|
|
53
53
|
/**
|
|
54
54
|
* Checks if the name is likely available in Java as a package. A return
|
|
@@ -127,8 +127,11 @@ public class ClassList implements ClassEnquirer {
|
|
|
127
127
|
String[] relativePaths = classpath.split(" ");
|
|
128
128
|
|
|
129
129
|
for (String relativePath : relativePaths) {
|
|
130
|
-
String path =
|
|
131
|
-
|
|
130
|
+
String path = relativePath;
|
|
131
|
+
String parent = file.getParent();
|
|
132
|
+
if (parent != null) {
|
|
133
|
+
path = parent + File.separator + relativePath;
|
|
134
|
+
}
|
|
132
135
|
if (!seen.contains(path)) {
|
|
133
136
|
queue.add(path);
|
|
134
137
|
seen.add(path);
|
|
@@ -152,7 +152,9 @@ public abstract class Jep implements Interpreter {
|
|
|
152
152
|
boolean hasSharedModules = config.sharedModules != null
|
|
153
153
|
&& !config.sharedModules.isEmpty();
|
|
154
154
|
|
|
155
|
-
if (hasSharedModules && config.subInterpOptions.
|
|
155
|
+
if (hasSharedModules && config.subInterpOptions.isolated) {
|
|
156
|
+
throw new JepException("Shared modules cannot be used with isolated interpreters.");
|
|
157
|
+
} else if (hasSharedModules && config.subInterpOptions.useMainObmalloc == 0) {
|
|
156
158
|
throw new JepException("Shared modules can only be used with a shared allocator.");
|
|
157
159
|
}
|
|
158
160
|
|
|
@@ -160,10 +162,10 @@ public abstract class Jep implements Interpreter {
|
|
|
160
162
|
SubInterpreterOptions interpOptions = config.subInterpOptions;
|
|
161
163
|
this.tstate = init(this.classLoader, hasSharedModules,
|
|
162
164
|
useSubInterpreter, interpOptions.isolated,
|
|
163
|
-
|
|
165
|
+
interpOptions.useMainObmalloc,
|
|
164
166
|
interpOptions.allowFork, interpOptions.allowExec,
|
|
165
167
|
interpOptions.allowThreads, interpOptions.allowDaemonThreads,
|
|
166
|
-
interpOptions.
|
|
168
|
+
interpOptions.checkMultiInterpExtensions,
|
|
167
169
|
interpOptions.ownGIL);
|
|
168
170
|
threadUsed.set(true);
|
|
169
171
|
this.thread = Thread.currentThread();
|
|
@@ -438,17 +440,40 @@ public abstract class Jep implements Interpreter {
|
|
|
438
440
|
}
|
|
439
441
|
|
|
440
442
|
if (isSubInterpreter) {
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
443
|
+
/*
|
|
444
|
+
* All background threads must complete before closing an
|
|
445
|
+
* interpreter.
|
|
446
|
+
*
|
|
447
|
+
* If threading is not already imported then there are no other
|
|
448
|
+
* threads so avoid importing threading because that creates new
|
|
449
|
+
* objects that aren't needed.
|
|
450
|
+
*
|
|
451
|
+
* In recent Python versions(>=3.13) there will always be at least
|
|
452
|
+
* 2 active threads here, the main thread on the main interpreter
|
|
453
|
+
* and this thread running the sub-interpreter.
|
|
454
|
+
*
|
|
455
|
+
* In older versions of python the minimum number of active threads
|
|
456
|
+
* should be 1 because each sub-interpreter would treat the first
|
|
457
|
+
* thread on that interpreter as the main thread.
|
|
458
|
+
*
|
|
459
|
+
* This behavior change in python was caused by
|
|
460
|
+
* https://github.com/python/cpython/issues/114271
|
|
461
|
+
*/
|
|
462
|
+
exec("def _check_single_thread():\n" +
|
|
463
|
+
" import sys\n" +
|
|
464
|
+
" if 'threading' in sys.modules:\n" +
|
|
465
|
+
" import threading\n" +
|
|
466
|
+
" if sys.version_info.major == 3 \\\n" +
|
|
467
|
+
" and sys.version_info.minor < 13:\n" +
|
|
468
|
+
" return threading.active_count() <= 1\n" +
|
|
469
|
+
" else:\n" +
|
|
470
|
+
" return threading.active_count() <= 2\n" +
|
|
471
|
+
" else:\n" +
|
|
472
|
+
" return True\n");
|
|
473
|
+
Boolean singleThread = getValue("_check_single_thread()", Boolean.class);
|
|
474
|
+
if (!singleThread.booleanValue()) {
|
|
475
|
+
throw new JepException(
|
|
476
|
+
"All threads must be stopped before closing Jep.");
|
|
452
477
|
}
|
|
453
478
|
}
|
|
454
479
|
|
|
@@ -223,4 +223,14 @@ public class JepConfig {
|
|
|
223
223
|
return new SubInterpreter(this);
|
|
224
224
|
}
|
|
225
225
|
|
|
226
|
+
@Override
|
|
227
|
+
public String toString() {
|
|
228
|
+
return "JepConfig [interactive=" + interactive + ", includePath="
|
|
229
|
+
+ includePath + ", classLoader=" + classLoader
|
|
230
|
+
+ ", classEnquirer=" + classEnquirer + ", redirectStdout="
|
|
231
|
+
+ redirectStdout + ", redirectStderr=" + redirectStderr
|
|
232
|
+
+ ", sharedModules=" + sharedModules + ", subInterpOptions="
|
|
233
|
+
+ subInterpOptions + "]";
|
|
234
|
+
}
|
|
235
|
+
|
|
226
236
|
}
|
|
@@ -138,7 +138,7 @@ public final class MainInterpreter implements AutoCloseable {
|
|
|
138
138
|
setInitParams(pyConfig.noSiteFlag, pyConfig.noUserSiteDirectory,
|
|
139
139
|
pyConfig.ignoreEnvironmentFlag, pyConfig.verboseFlag,
|
|
140
140
|
pyConfig.optimizeFlag, pyConfig.dontWriteBytecodeFlag,
|
|
141
|
-
pyConfig.hashRandomizationFlag, pyConfig.pythonHome);
|
|
141
|
+
pyConfig.hashRandomizationFlag, pyConfig.pythonHome, pyConfig.programName);
|
|
142
142
|
}
|
|
143
143
|
|
|
144
144
|
thread = new Thread("JepMainInterpreter") {
|
|
@@ -293,7 +293,7 @@ public final class MainInterpreter implements AutoCloseable {
|
|
|
293
293
|
private static native void setInitParams(int noSiteFlag,
|
|
294
294
|
int noUserSiteDiretory, int ignoreEnvironmentFlag, int verboseFlag,
|
|
295
295
|
int optimizeFlag, int dontWriteBytecodeFlag,
|
|
296
|
-
int hashRandomizationFlag, String pythonHome);
|
|
296
|
+
int hashRandomizationFlag, String pythonHome, String programName);
|
|
297
297
|
|
|
298
298
|
private static native void initializePython(String[] mainInterpreterArgv);
|
|
299
299
|
|
|
@@ -35,6 +35,12 @@ package jep;
|
|
|
35
35
|
*/
|
|
36
36
|
public class PyConfig {
|
|
37
37
|
|
|
38
|
+
/*
|
|
39
|
+
* -1 is used to indicate not set, in which case we will not set it in the
|
|
40
|
+
* native code and the setting will be Python's default. A value of 0 or
|
|
41
|
+
* greater will cause the value to be set in the native code.
|
|
42
|
+
*/
|
|
43
|
+
|
|
38
44
|
protected int noSiteFlag = -1;
|
|
39
45
|
|
|
40
46
|
protected int noUserSiteDirectory = -1;
|
|
@@ -51,6 +57,8 @@ public class PyConfig {
|
|
|
51
57
|
|
|
52
58
|
protected String pythonHome;
|
|
53
59
|
|
|
60
|
+
protected String programName;
|
|
61
|
+
|
|
54
62
|
/**
|
|
55
63
|
* Set the Py_NoSiteFlag variable on the python interpreter. This
|
|
56
64
|
* corresponds to the python "-S" flag and will prevent the "site" module
|
|
@@ -149,7 +157,7 @@ public class PyConfig {
|
|
|
149
157
|
}
|
|
150
158
|
|
|
151
159
|
/**
|
|
152
|
-
* Set the home location on the python interpreter.
|
|
160
|
+
* Set the home location on the python interpreter. This is the location of
|
|
153
161
|
* the standard python libraries. This corresponds to the environment
|
|
154
162
|
* variable PYTHONHOME.
|
|
155
163
|
*
|
|
@@ -162,4 +170,27 @@ public class PyConfig {
|
|
|
162
170
|
return this;
|
|
163
171
|
}
|
|
164
172
|
|
|
173
|
+
/**
|
|
174
|
+
* Set the Py_SetProgramName variable on the python interpreter. This is
|
|
175
|
+
* used to initialize executable and in early error messages during python
|
|
176
|
+
* initialization.
|
|
177
|
+
*
|
|
178
|
+
* @param programName
|
|
179
|
+
* the name of the executable python program.
|
|
180
|
+
* @return a reference to this PyConfig
|
|
181
|
+
*/
|
|
182
|
+
public PyConfig setProgramName(String programName) {
|
|
183
|
+
this.programName = programName;
|
|
184
|
+
return this;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
@Override
|
|
188
|
+
public String toString() {
|
|
189
|
+
return "PyConfig [noSiteFlag=" + noSiteFlag + ", noUserSiteDirectory=" + noUserSiteDirectory
|
|
190
|
+
+ ", ignoreEnvironmentFlag=" + ignoreEnvironmentFlag + ", verboseFlag=" + verboseFlag
|
|
191
|
+
+ ", optimizeFlag=" + optimizeFlag + ", dontWriteBytecodeFlag=" + dontWriteBytecodeFlag
|
|
192
|
+
+ ", hashRandomizationFlag=" + hashRandomizationFlag + ", pythonHome=" + pythonHome + ", programName="
|
|
193
|
+
+ programName + "]";
|
|
194
|
+
}
|
|
195
|
+
|
|
165
196
|
}
|