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.
Files changed (309) hide show
  1. {jep-4.2.0/src/main/python/jep.egg-info → jep-4.2.2}/PKG-INFO +8 -6
  2. {jep-4.2.0 → jep-4.2.2}/README.rst +6 -2
  3. {jep-4.2.0 → jep-4.2.2}/commands/__init__.py +5 -2
  4. {jep-4.2.0 → jep-4.2.2}/commands/java.py +8 -1
  5. {jep-4.2.0 → jep-4.2.2}/commands/util.py +4 -0
  6. {jep-4.2.0 → jep-4.2.2}/pom.xml +2 -2
  7. {jep-4.2.0 → jep-4.2.2}/release_notes/4.2-notes.rst +1 -1
  8. {jep-4.2.0 → jep-4.2.2}/setup.py +12 -4
  9. {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/pyembed.h +1 -1
  10. {jep-4.2.0 → jep-4.2.2}/src/main/c/Jep/maininterpreter.c +3 -2
  11. {jep-4.2.0 → jep-4.2.2}/src/main/c/Jep/pyembed.c +14 -4
  12. {jep-4.2.0 → jep-4.2.2}/src/main/c/Jep/python/jep_object.c +1 -0
  13. {jep-4.2.0 → jep-4.2.2}/src/main/c/Objects/pyjtype.c +30 -11
  14. jep-4.2.2/src/main/java/jep/AllowPythonClassEnquirer.java +96 -0
  15. {jep-4.2.0 → jep-4.2.2}/src/main/java/jep/ClassEnquirer.java +1 -1
  16. {jep-4.2.0 → jep-4.2.2}/src/main/java/jep/ClassList.java +5 -2
  17. {jep-4.2.0 → jep-4.2.2}/src/main/java/jep/Jep.java +39 -14
  18. {jep-4.2.0 → jep-4.2.2}/src/main/java/jep/JepConfig.java +10 -0
  19. {jep-4.2.0 → jep-4.2.2}/src/main/java/jep/MainInterpreter.java +2 -2
  20. {jep-4.2.0 → jep-4.2.2}/src/main/java/jep/PyConfig.java +32 -1
  21. {jep-4.2.0 → jep-4.2.2}/src/main/java/jep/Run.java +1 -1
  22. {jep-4.2.0 → jep-4.2.2}/src/main/java/jep/SubInterpreterOptions.java +71 -25
  23. {jep-4.2.0 → jep-4.2.2}/src/main/python/jep/version.py +1 -1
  24. {jep-4.2.0 → jep-4.2.2/src/main/python/jep.egg-info}/PKG-INFO +8 -6
  25. {jep-4.2.0 → jep-4.2.2}/src/main/python/jep.egg-info/SOURCES.txt +4 -0
  26. {jep-4.2.0 → jep-4.2.2}/src/test/java/jep/test/Test.java +8 -28
  27. jep-4.2.2/src/test/java/jep/test/TestAllowPythonEnquirer.java +132 -0
  28. {jep-4.2.0 → jep-4.2.2}/src/test/java/jep/test/TestGetJPyObject.java +32 -0
  29. {jep-4.2.0 → jep-4.2.2}/src/test/java/jep/test/TestSubInterpOptions.java +41 -1
  30. {jep-4.2.0 → jep-4.2.2}/src/test/java/jep/test/numpy/TestNumpy.java +3 -3
  31. jep-4.2.2/src/test/java/jep/test/util/SubInterpreterThread.java +41 -0
  32. jep-4.2.2/src/test/python/test_allow_python_enquirer.py +12 -0
  33. {jep-4.2.0 → jep-4.2.2}/src/test/python/test_regressions.py +14 -0
  34. {jep-4.2.0 → jep-4.2.2}/AUTHORS +0 -0
  35. {jep-4.2.0 → jep-4.2.2}/LICENSE +0 -0
  36. {jep-4.2.0 → jep-4.2.2}/MANIFEST.in +0 -0
  37. {jep-4.2.0 → jep-4.2.2}/commands/_msvccompiler.py +0 -0
  38. {jep-4.2.0 → jep-4.2.2}/commands/build_ext.py +0 -0
  39. {jep-4.2.0 → jep-4.2.2}/commands/clean.py +0 -0
  40. {jep-4.2.0 → jep-4.2.2}/commands/dist.py +0 -0
  41. {jep-4.2.0 → jep-4.2.2}/commands/install_lib.py +0 -0
  42. {jep-4.2.0 → jep-4.2.2}/commands/javadoc.py +0 -0
  43. {jep-4.2.0 → jep-4.2.2}/commands/link_util.py +0 -0
  44. {jep-4.2.0 → jep-4.2.2}/commands/msvc9compiler.py +0 -0
  45. {jep-4.2.0 → jep-4.2.2}/commands/python.py +0 -0
  46. {jep-4.2.0 → jep-4.2.2}/commands/scripts.py +0 -0
  47. {jep-4.2.0 → jep-4.2.2}/commands/test.py +0 -0
  48. {jep-4.2.0 → jep-4.2.2}/release_notes/1.0-notes.rst +0 -0
  49. {jep-4.2.0 → jep-4.2.2}/release_notes/1.1-notes.rst +0 -0
  50. {jep-4.2.0 → jep-4.2.2}/release_notes/2.0-notes.rst +0 -0
  51. {jep-4.2.0 → jep-4.2.2}/release_notes/2.1-notes.rst +0 -0
  52. {jep-4.2.0 → jep-4.2.2}/release_notes/2.2-notes.rst +0 -0
  53. {jep-4.2.0 → jep-4.2.2}/release_notes/2.3-notes.rst +0 -0
  54. {jep-4.2.0 → jep-4.2.2}/release_notes/2.4-notes.rst +0 -0
  55. {jep-4.2.0 → jep-4.2.2}/release_notes/3.0-notes.rst +0 -0
  56. {jep-4.2.0 → jep-4.2.2}/release_notes/3.1-notes.rst +0 -0
  57. {jep-4.2.0 → jep-4.2.2}/release_notes/3.2-notes.rst +0 -0
  58. {jep-4.2.0 → jep-4.2.2}/release_notes/3.3-notes.rst +0 -0
  59. {jep-4.2.0 → jep-4.2.2}/release_notes/3.4-notes.rst +0 -0
  60. {jep-4.2.0 → jep-4.2.2}/release_notes/3.5-notes.rst +0 -0
  61. {jep-4.2.0 → jep-4.2.2}/release_notes/3.6-notes.rst +0 -0
  62. {jep-4.2.0 → jep-4.2.2}/release_notes/3.7-notes.rst +0 -0
  63. {jep-4.2.0 → jep-4.2.2}/release_notes/3.8-notes.rst +0 -0
  64. {jep-4.2.0 → jep-4.2.2}/release_notes/3.9-notes.rst +0 -0
  65. {jep-4.2.0 → jep-4.2.2}/release_notes/4.0-notes.rst +0 -0
  66. {jep-4.2.0 → jep-4.2.2}/release_notes/4.1-notes.rst +0 -0
  67. {jep-4.2.0 → jep-4.2.2}/setup.cfg +0 -0
  68. {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/Jep.h +0 -0
  69. {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/convert_j2p.h +0 -0
  70. {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/convert_p2j.h +0 -0
  71. {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/java_access/AnnotatedElement.h +0 -0
  72. {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/java_access/ArrayList.h +0 -0
  73. {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/java_access/AutoCloseable.h +0 -0
  74. {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/java_access/BigInteger.h +0 -0
  75. {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/java_access/Boolean.h +0 -0
  76. {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/java_access/Buffer.h +0 -0
  77. {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/java_access/Byte.h +0 -0
  78. {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/java_access/ByteBuffer.h +0 -0
  79. {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/java_access/ByteOrder.h +0 -0
  80. {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/java_access/CharBuffer.h +0 -0
  81. {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/java_access/Character.h +0 -0
  82. {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/java_access/Class.h +0 -0
  83. {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/java_access/ClassLoader.h +0 -0
  84. {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/java_access/Collection.h +0 -0
  85. {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/java_access/Collections.h +0 -0
  86. {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/java_access/Comparable.h +0 -0
  87. {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/java_access/Double.h +0 -0
  88. {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/java_access/DoubleBuffer.h +0 -0
  89. {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/java_access/Entry.h +0 -0
  90. {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/java_access/Executable.h +0 -0
  91. {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/java_access/Field.h +0 -0
  92. {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/java_access/Float.h +0 -0
  93. {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/java_access/FloatBuffer.h +0 -0
  94. {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/java_access/HashMap.h +0 -0
  95. {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/java_access/IntBuffer.h +0 -0
  96. {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/java_access/Integer.h +0 -0
  97. {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/java_access/Iterable.h +0 -0
  98. {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/java_access/Iterator.h +0 -0
  99. {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/java_access/JPyCallable.h +0 -0
  100. {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/java_access/JPyMethod.h +0 -0
  101. {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/java_access/JPyObject.h +0 -0
  102. {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/java_access/JepException.h +0 -0
  103. {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/java_access/List.h +0 -0
  104. {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/java_access/Long.h +0 -0
  105. {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/java_access/LongBuffer.h +0 -0
  106. {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/java_access/Map.h +0 -0
  107. {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/java_access/Member.h +0 -0
  108. {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/java_access/Method.h +0 -0
  109. {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/java_access/Modifier.h +0 -0
  110. {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/java_access/Number.h +0 -0
  111. {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/java_access/Object.h +0 -0
  112. {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/java_access/Proxy.h +0 -0
  113. {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/java_access/Short.h +0 -0
  114. {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/java_access/ShortBuffer.h +0 -0
  115. {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/java_access/String.h +0 -0
  116. {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/java_access/Throwable.h +0 -0
  117. {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/jep_exceptions.h +0 -0
  118. {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/jep_numpy.h +0 -0
  119. {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/jep_platform.h +0 -0
  120. {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/jep_util.h +0 -0
  121. {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/pyjarray.h +0 -0
  122. {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/pyjautocloseable.h +0 -0
  123. {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/pyjbuffer.h +0 -0
  124. {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/pyjclass.h +0 -0
  125. {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/pyjcollection.h +0 -0
  126. {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/pyjconstructor.h +0 -0
  127. {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/pyjfield.h +0 -0
  128. {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/pyjiterable.h +0 -0
  129. {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/pyjiterator.h +0 -0
  130. {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/pyjlist.h +0 -0
  131. {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/pyjmap.h +0 -0
  132. {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/pyjmethod.h +0 -0
  133. {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/pyjmonitor.h +0 -0
  134. {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/pyjmultimethod.h +0 -0
  135. {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/pyjnumber.h +0 -0
  136. {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/pyjobject.h +0 -0
  137. {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/pyjtype.h +0 -0
  138. {jep-4.2.0 → jep-4.2.2}/src/main/c/Include/winconfig.h +0 -0
  139. {jep-4.2.0 → jep-4.2.2}/src/main/c/Jep/convert_j2p.c +0 -0
  140. {jep-4.2.0 → jep-4.2.2}/src/main/c/Jep/convert_p2j.c +0 -0
  141. {jep-4.2.0 → jep-4.2.2}/src/main/c/Jep/java_access/AnnotatedElement.c +0 -0
  142. {jep-4.2.0 → jep-4.2.2}/src/main/c/Jep/java_access/ArrayList.c +0 -0
  143. {jep-4.2.0 → jep-4.2.2}/src/main/c/Jep/java_access/AutoCloseable.c +0 -0
  144. {jep-4.2.0 → jep-4.2.2}/src/main/c/Jep/java_access/BigInteger.c +0 -0
  145. {jep-4.2.0 → jep-4.2.2}/src/main/c/Jep/java_access/Boolean.c +0 -0
  146. {jep-4.2.0 → jep-4.2.2}/src/main/c/Jep/java_access/Buffer.c +0 -0
  147. {jep-4.2.0 → jep-4.2.2}/src/main/c/Jep/java_access/Byte.c +0 -0
  148. {jep-4.2.0 → jep-4.2.2}/src/main/c/Jep/java_access/ByteBuffer.c +0 -0
  149. {jep-4.2.0 → jep-4.2.2}/src/main/c/Jep/java_access/ByteOrder.c +0 -0
  150. {jep-4.2.0 → jep-4.2.2}/src/main/c/Jep/java_access/CharBuffer.c +0 -0
  151. {jep-4.2.0 → jep-4.2.2}/src/main/c/Jep/java_access/Character.c +0 -0
  152. {jep-4.2.0 → jep-4.2.2}/src/main/c/Jep/java_access/Class.c +0 -0
  153. {jep-4.2.0 → jep-4.2.2}/src/main/c/Jep/java_access/ClassLoader.c +0 -0
  154. {jep-4.2.0 → jep-4.2.2}/src/main/c/Jep/java_access/Collection.c +0 -0
  155. {jep-4.2.0 → jep-4.2.2}/src/main/c/Jep/java_access/Collections.c +0 -0
  156. {jep-4.2.0 → jep-4.2.2}/src/main/c/Jep/java_access/Comparable.c +0 -0
  157. {jep-4.2.0 → jep-4.2.2}/src/main/c/Jep/java_access/Double.c +0 -0
  158. {jep-4.2.0 → jep-4.2.2}/src/main/c/Jep/java_access/DoubleBuffer.c +0 -0
  159. {jep-4.2.0 → jep-4.2.2}/src/main/c/Jep/java_access/Entry.c +0 -0
  160. {jep-4.2.0 → jep-4.2.2}/src/main/c/Jep/java_access/Executable.c +0 -0
  161. {jep-4.2.0 → jep-4.2.2}/src/main/c/Jep/java_access/Field.c +0 -0
  162. {jep-4.2.0 → jep-4.2.2}/src/main/c/Jep/java_access/Float.c +0 -0
  163. {jep-4.2.0 → jep-4.2.2}/src/main/c/Jep/java_access/FloatBuffer.c +0 -0
  164. {jep-4.2.0 → jep-4.2.2}/src/main/c/Jep/java_access/HashMap.c +0 -0
  165. {jep-4.2.0 → jep-4.2.2}/src/main/c/Jep/java_access/IntBuffer.c +0 -0
  166. {jep-4.2.0 → jep-4.2.2}/src/main/c/Jep/java_access/Integer.c +0 -0
  167. {jep-4.2.0 → jep-4.2.2}/src/main/c/Jep/java_access/Iterable.c +0 -0
  168. {jep-4.2.0 → jep-4.2.2}/src/main/c/Jep/java_access/Iterator.c +0 -0
  169. {jep-4.2.0 → jep-4.2.2}/src/main/c/Jep/java_access/JPyCallable.c +0 -0
  170. {jep-4.2.0 → jep-4.2.2}/src/main/c/Jep/java_access/JPyMethod.c +0 -0
  171. {jep-4.2.0 → jep-4.2.2}/src/main/c/Jep/java_access/JPyObject.c +0 -0
  172. {jep-4.2.0 → jep-4.2.2}/src/main/c/Jep/java_access/JepException.c +0 -0
  173. {jep-4.2.0 → jep-4.2.2}/src/main/c/Jep/java_access/List.c +0 -0
  174. {jep-4.2.0 → jep-4.2.2}/src/main/c/Jep/java_access/Long.c +0 -0
  175. {jep-4.2.0 → jep-4.2.2}/src/main/c/Jep/java_access/LongBuffer.c +0 -0
  176. {jep-4.2.0 → jep-4.2.2}/src/main/c/Jep/java_access/Map.c +0 -0
  177. {jep-4.2.0 → jep-4.2.2}/src/main/c/Jep/java_access/Member.c +0 -0
  178. {jep-4.2.0 → jep-4.2.2}/src/main/c/Jep/java_access/Method.c +0 -0
  179. {jep-4.2.0 → jep-4.2.2}/src/main/c/Jep/java_access/Modifier.c +0 -0
  180. {jep-4.2.0 → jep-4.2.2}/src/main/c/Jep/java_access/Number.c +0 -0
  181. {jep-4.2.0 → jep-4.2.2}/src/main/c/Jep/java_access/Object.c +0 -0
  182. {jep-4.2.0 → jep-4.2.2}/src/main/c/Jep/java_access/Proxy.c +0 -0
  183. {jep-4.2.0 → jep-4.2.2}/src/main/c/Jep/java_access/Short.c +0 -0
  184. {jep-4.2.0 → jep-4.2.2}/src/main/c/Jep/java_access/ShortBuffer.c +0 -0
  185. {jep-4.2.0 → jep-4.2.2}/src/main/c/Jep/java_access/String.c +0 -0
  186. {jep-4.2.0 → jep-4.2.2}/src/main/c/Jep/java_access/Throwable.c +0 -0
  187. {jep-4.2.0 → jep-4.2.2}/src/main/c/Jep/jep.c +0 -0
  188. {jep-4.2.0 → jep-4.2.2}/src/main/c/Jep/jep_exceptions.c +0 -0
  189. {jep-4.2.0 → jep-4.2.2}/src/main/c/Jep/jep_numpy.c +0 -0
  190. {jep-4.2.0 → jep-4.2.2}/src/main/c/Jep/jep_util.c +0 -0
  191. {jep-4.2.0 → jep-4.2.2}/src/main/c/Jep/python/invocationhandler.c +0 -0
  192. {jep-4.2.0 → jep-4.2.2}/src/main/c/Jep/python/jpycallable.c +0 -0
  193. {jep-4.2.0 → jep-4.2.2}/src/main/c/Jep/python/pypointer.c +0 -0
  194. {jep-4.2.0 → jep-4.2.2}/src/main/c/Objects/pyjarray.c +0 -0
  195. {jep-4.2.0 → jep-4.2.2}/src/main/c/Objects/pyjautocloseable.c +0 -0
  196. {jep-4.2.0 → jep-4.2.2}/src/main/c/Objects/pyjbuffer.c +0 -0
  197. {jep-4.2.0 → jep-4.2.2}/src/main/c/Objects/pyjclass.c +0 -0
  198. {jep-4.2.0 → jep-4.2.2}/src/main/c/Objects/pyjcollection.c +0 -0
  199. {jep-4.2.0 → jep-4.2.2}/src/main/c/Objects/pyjconstructor.c +0 -0
  200. {jep-4.2.0 → jep-4.2.2}/src/main/c/Objects/pyjfield.c +0 -0
  201. {jep-4.2.0 → jep-4.2.2}/src/main/c/Objects/pyjiterable.c +0 -0
  202. {jep-4.2.0 → jep-4.2.2}/src/main/c/Objects/pyjiterator.c +0 -0
  203. {jep-4.2.0 → jep-4.2.2}/src/main/c/Objects/pyjlist.c +0 -0
  204. {jep-4.2.0 → jep-4.2.2}/src/main/c/Objects/pyjmap.c +0 -0
  205. {jep-4.2.0 → jep-4.2.2}/src/main/c/Objects/pyjmethod.c +0 -0
  206. {jep-4.2.0 → jep-4.2.2}/src/main/c/Objects/pyjmonitor.c +0 -0
  207. {jep-4.2.0 → jep-4.2.2}/src/main/c/Objects/pyjmultimethod.c +0 -0
  208. {jep-4.2.0 → jep-4.2.2}/src/main/c/Objects/pyjnumber.c +0 -0
  209. {jep-4.2.0 → jep-4.2.2}/src/main/c/Objects/pyjobject.c +0 -0
  210. {jep-4.2.0 → jep-4.2.2}/src/main/java/jep/AbstractNDArray.java +0 -0
  211. {jep-4.2.0 → jep-4.2.2}/src/main/java/jep/DirectNDArray.java +0 -0
  212. {jep-4.2.0 → jep-4.2.2}/src/main/java/jep/Interpreter.java +0 -0
  213. {jep-4.2.0 → jep-4.2.2}/src/main/java/jep/JepAccess.java +0 -0
  214. {jep-4.2.0 → jep-4.2.2}/src/main/java/jep/JepException.java +0 -0
  215. {jep-4.2.0 → jep-4.2.2}/src/main/java/jep/LibraryLocator.java +0 -0
  216. {jep-4.2.0 → jep-4.2.2}/src/main/java/jep/NDArray.java +0 -0
  217. {jep-4.2.0 → jep-4.2.2}/src/main/java/jep/NamingConventionClassEnquirer.java +0 -0
  218. {jep-4.2.0 → jep-4.2.2}/src/main/java/jep/Proxy.java +0 -0
  219. {jep-4.2.0 → jep-4.2.2}/src/main/java/jep/PyMethod.java +0 -0
  220. {jep-4.2.0 → jep-4.2.2}/src/main/java/jep/SharedInterpreter.java +0 -0
  221. {jep-4.2.0 → jep-4.2.2}/src/main/java/jep/SubInterpreter.java +0 -0
  222. {jep-4.2.0 → jep-4.2.2}/src/main/java/jep/python/InvocationHandler.java +0 -0
  223. {jep-4.2.0 → jep-4.2.2}/src/main/java/jep/python/MemoryManager.java +0 -0
  224. {jep-4.2.0 → jep-4.2.2}/src/main/java/jep/python/PyBuiltins.java +0 -0
  225. {jep-4.2.0 → jep-4.2.2}/src/main/java/jep/python/PyCallable.java +0 -0
  226. {jep-4.2.0 → jep-4.2.2}/src/main/java/jep/python/PyObject.java +0 -0
  227. {jep-4.2.0 → jep-4.2.2}/src/main/java/jep/python/PyPointer.java +0 -0
  228. {jep-4.2.0 → jep-4.2.2}/src/main/python/jep/__init__.py +0 -0
  229. {jep-4.2.0 → jep-4.2.2}/src/main/python/jep/console.py +0 -0
  230. {jep-4.2.0 → jep-4.2.2}/src/main/python/jep/java_import_hook.py +0 -0
  231. {jep-4.2.0 → jep-4.2.2}/src/main/python/jep/jdbc.py +0 -0
  232. {jep-4.2.0 → jep-4.2.2}/src/main/python/jep/redirect_streams.py +0 -0
  233. {jep-4.2.0 → jep-4.2.2}/src/main/python/jep/shared_modules_hook.py +0 -0
  234. {jep-4.2.0 → jep-4.2.2}/src/main/python/jep.egg-info/dependency_links.txt +0 -0
  235. {jep-4.2.0 → jep-4.2.2}/src/main/python/jep.egg-info/not-zip-safe +0 -0
  236. {jep-4.2.0 → jep-4.2.2}/src/main/python/jep.egg-info/top_level.txt +0 -0
  237. {jep-4.2.0 → jep-4.2.2}/src/main/resources/jep/classlist_10.txt +0 -0
  238. {jep-4.2.0 → jep-4.2.2}/src/main/resources/jep/classlist_11.txt +0 -0
  239. {jep-4.2.0 → jep-4.2.2}/src/main/resources/jep/classlist_8.txt +0 -0
  240. {jep-4.2.0 → jep-4.2.2}/src/main/resources/jep/classlist_9.txt +0 -0
  241. {jep-4.2.0 → jep-4.2.2}/src/main/scripts/jep +0 -0
  242. {jep-4.2.0 → jep-4.2.2}/src/main/scripts/jep.bat +0 -0
  243. {jep-4.2.0 → jep-4.2.2}/src/test/java/jep/test/TestCloseWithThreads.java +0 -0
  244. {jep-4.2.0 → jep-4.2.2}/src/test/java/jep/test/TestCompiledScript.java +0 -0
  245. {jep-4.2.0 → jep-4.2.2}/src/test/java/jep/test/TestDefaultMethods.java +0 -0
  246. {jep-4.2.0 → jep-4.2.2}/src/test/java/jep/test/TestExceptionCause.java +0 -0
  247. {jep-4.2.0 → jep-4.2.2}/src/test/java/jep/test/TestExec.java +0 -0
  248. {jep-4.2.0 → jep-4.2.2}/src/test/java/jep/test/TestGetByteArray.java +0 -0
  249. {jep-4.2.0 → jep-4.2.2}/src/test/java/jep/test/TestGetCollectionBoxing.java +0 -0
  250. {jep-4.2.0 → jep-4.2.2}/src/test/java/jep/test/TestGetTempValue.java +0 -0
  251. {jep-4.2.0 → jep-4.2.2}/src/test/java/jep/test/TestGetWithClass.java +0 -0
  252. {jep-4.2.0 → jep-4.2.2}/src/test/java/jep/test/TestInvoke.java +0 -0
  253. {jep-4.2.0 → jep-4.2.2}/src/test/java/jep/test/TestIteratorable.java +0 -0
  254. {jep-4.2.0 → jep-4.2.2}/src/test/java/jep/test/TestOverload.java +0 -0
  255. {jep-4.2.0 → jep-4.2.2}/src/test/java/jep/test/TestPreInitVariables.java +0 -0
  256. {jep-4.2.0 → jep-4.2.2}/src/test/java/jep/test/TestPyBuiltins.java +0 -0
  257. {jep-4.2.0 → jep-4.2.2}/src/test/java/jep/test/TestPyJObject.java +0 -0
  258. {jep-4.2.0 → jep-4.2.2}/src/test/java/jep/test/TestPyJType.java +0 -0
  259. {jep-4.2.0 → jep-4.2.2}/src/test/java/jep/test/TestRedirectStreams.java +0 -0
  260. {jep-4.2.0 → jep-4.2.2}/src/test/java/jep/test/TestSharedArgv.java +0 -0
  261. {jep-4.2.0 → jep-4.2.2}/src/test/java/jep/test/TestSharedInterpreter.java +0 -0
  262. {jep-4.2.0 → jep-4.2.2}/src/test/java/jep/test/TestSharedModules.java +0 -0
  263. {jep-4.2.0 → jep-4.2.2}/src/test/java/jep/test/TestSharedModulesThreads.java +0 -0
  264. {jep-4.2.0 → jep-4.2.2}/src/test/java/jep/test/closeable/TestAutoCloseable.java +0 -0
  265. {jep-4.2.0 → jep-4.2.2}/src/test/java/jep/test/numpy/TestNumpyArrayToString.java +0 -0
  266. {jep-4.2.0 → jep-4.2.2}/src/test/java/jep/test/numpy/TestNumpyProdShared.java +0 -0
  267. {jep-4.2.0 → jep-4.2.2}/src/test/java/jep/test/synchronization/TestCrossLangSync.java +0 -0
  268. {jep-4.2.0 → jep-4.2.2}/src/test/java/jep/test/types/TestFieldTypes.java +0 -0
  269. {jep-4.2.0 → jep-4.2.2}/src/test/java/jep/test/types/TestMethodTypes.java +0 -0
  270. {jep-4.2.0 → jep-4.2.2}/src/test/java/jep/test/types/TestStaticFieldTypes.java +0 -0
  271. {jep-4.2.0 → jep-4.2.2}/src/test/java/jep/test/types/TestStaticMethodTypes.java +0 -0
  272. {jep-4.2.0 → jep-4.2.2}/src/test/python/__init__.py +0 -0
  273. {jep-4.2.0 → jep-4.2.2}/src/test/python/data/read_file.txt +0 -0
  274. {jep-4.2.0 → jep-4.2.2}/src/test/python/jep_pipe.py +0 -0
  275. {jep-4.2.0 → jep-4.2.2}/src/test/python/lib/fakenetty.jar +0 -0
  276. {jep-4.2.0 → jep-4.2.2}/src/test/python/lib/sqlitejdbc-v056.jar +0 -0
  277. {jep-4.2.0 → jep-4.2.2}/src/test/python/runtests.py +0 -0
  278. {jep-4.2.0 → jep-4.2.2}/src/test/python/subprocess/invoke_args.py +0 -0
  279. {jep-4.2.0 → jep-4.2.2}/src/test/python/subprocess/iter_itr_crash.py +0 -0
  280. {jep-4.2.0 → jep-4.2.2}/src/test/python/test_array.py +0 -0
  281. {jep-4.2.0 → jep-4.2.2}/src/test/python/test_autocloseable.py +0 -0
  282. {jep-4.2.0 → jep-4.2.2}/src/test/python/test_call.py +0 -0
  283. {jep-4.2.0 → jep-4.2.2}/src/test/python/test_compare.py +0 -0
  284. {jep-4.2.0 → jep-4.2.2}/src/test/python/test_convert.py +0 -0
  285. {jep-4.2.0 → jep-4.2.2}/src/test/python/test_dir.py +0 -0
  286. {jep-4.2.0 → jep-4.2.2}/src/test/python/test_exceptions.py +0 -0
  287. {jep-4.2.0 → jep-4.2.2}/src/test/python/test_exec.py +0 -0
  288. {jep-4.2.0 → jep-4.2.2}/src/test/python/test_getvalue.py +0 -0
  289. {jep-4.2.0 → jep-4.2.2}/src/test/python/test_import.py +0 -0
  290. {jep-4.2.0 → jep-4.2.2}/src/test/python/test_invoke.py +0 -0
  291. {jep-4.2.0 → jep-4.2.2}/src/test/python/test_iterators.py +0 -0
  292. {jep-4.2.0 → jep-4.2.2}/src/test/python/test_jdbc.py +0 -0
  293. {jep-4.2.0 → jep-4.2.2}/src/test/python/test_jproxy.py +0 -0
  294. {jep-4.2.0 → jep-4.2.2}/src/test/python/test_lists.py +0 -0
  295. {jep-4.2.0 → jep-4.2.2}/src/test/python/test_maps.py +0 -0
  296. {jep-4.2.0 → jep-4.2.2}/src/test/python/test_numbers.py +0 -0
  297. {jep-4.2.0 → jep-4.2.2}/src/test/python/test_numpy.py +0 -0
  298. {jep-4.2.0 → jep-4.2.2}/src/test/python/test_object.py +0 -0
  299. {jep-4.2.0 → jep-4.2.2}/src/test/python/test_overload.py +0 -0
  300. {jep-4.2.0 → jep-4.2.2}/src/test/python/test_preinits.py +0 -0
  301. {jep-4.2.0 → jep-4.2.2}/src/test/python/test_pybuiltins.py +0 -0
  302. {jep-4.2.0 → jep-4.2.2}/src/test/python/test_python_memory.py +0 -0
  303. {jep-4.2.0 → jep-4.2.2}/src/test/python/test_redirect_streams.py +0 -0
  304. {jep-4.2.0 → jep-4.2.2}/src/test/python/test_run_script.py +0 -0
  305. {jep-4.2.0 → jep-4.2.2}/src/test/python/test_shared_interpreter.py +0 -0
  306. {jep-4.2.0 → jep-4.2.2}/src/test/python/test_shared_modules.py +0 -0
  307. {jep-4.2.0 → jep-4.2.2}/src/test/python/test_sub_interp_options.py +0 -0
  308. {jep-4.2.0 → jep-4.2.2}/src/test/python/test_synchronized.py +0 -0
  309. {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.0
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 the source and run ``pip install .``.
70
- Building and installing require the JDK, Python, and optionally numpy to be installed beforehand.
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 the source and run ``pip install .``.
43
- Building and installing require the JDK, Python, and optionally numpy to be installed beforehand.
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
- # https://github.com/pypa/setuptools/issues/2928
2
- from distutils.command.build import build
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
 
@@ -26,6 +26,10 @@ def is_bsd():
26
26
  return 'bsd' in get_platform()
27
27
 
28
28
 
29
+ def is_linux():
30
+ return "linux" in get_platform()
31
+
32
+
29
33
  class CommandFailed(Exception):
30
34
  """
31
35
  The command failed to run for any reason
@@ -6,7 +6,7 @@
6
6
 
7
7
  <groupId>black.ninia</groupId>
8
8
  <artifactId>jep</artifactId>
9
- <version>4.2.0</version>
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.0</url>
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/PyBuiltin.html>`_
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
 
@@ -29,11 +29,18 @@ numpy_include = []
29
29
  numpy_found = 0
30
30
  try:
31
31
  import numpy
32
- include_path = os.path.join(numpy.__path__[0], 'core', 'include')
33
- if os.path.exists(include_path):
34
- print('numpy include found at', include_path)
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 = [include_path]
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
- jint allowExec, jint allowThreads, jint allowDaemonThreads,
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
- if (isolated) {
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);
@@ -114,6 +114,7 @@ JNIEXPORT void JNICALL Java_jep_python_PyObject_setAttr
114
114
  }
115
115
 
116
116
  EXIT:
117
+ Py_XDECREF(pyAttr);
117
118
  PyEval_ReleaseThread(jepThread->tstate);
118
119
  release_utf_char(env, str, attrName);
119
120
  }
@@ -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
- /* TODO In python 3.8 buffer protocol was added to spec so pybuffer type can use a spec */
131
- if (!addCustomTypeToTypeDict(env, fqnToPyType, JBUFFER_TYPE, &PyJBuffer_Type)) {
132
- return -1;
133
- }
134
- if (!addCustomTypeToTypeDict(env, fqnToPyType, JOBJECT_TYPE, &PyJObject_Type)) {
135
- return -1;
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
- * If there is already one abstract method and this method is also
301
- * abstract then this isn't a functional interface and there is no need
302
- * to keep track of abstract methods.
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
- shortName, bases, dict, NULL);
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 = file.getParent() + File.separator
131
- + relativePath;
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.useMainObmalloc == 0) {
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
- interpOptions.useMainObmalloc,
165
+ interpOptions.useMainObmalloc,
164
166
  interpOptions.allowFork, interpOptions.allowExec,
165
167
  interpOptions.allowThreads, interpOptions.allowDaemonThreads,
166
- interpOptions.checkMultiInterpeExtensions,
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
- exec("import sys");
442
- Boolean hasThreads = getValue("'threading' in sys.modules",
443
- Boolean.class);
444
- if (hasThreads.booleanValue()) {
445
- Integer count = getValue(
446
- "sys.modules['threading'].active_count()",
447
- Integer.class);
448
- if (count.intValue() > 1) {
449
- throw new JepException(
450
- "All threads must be stopped before closing Jep.");
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. THis is the location of
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
  }
@@ -123,7 +123,7 @@ public class Run {
123
123
  }
124
124
 
125
125
  // setup argv
126
- StringBuffer b = new StringBuffer("[");
126
+ StringBuilder b = new StringBuilder("[");
127
127
  // always the first arg
128
128
  b.append("'" + file + "',");
129
129
  // trailing comma is okay