Skip to content
Permalink
Browse files

Squash

  • Loading branch information
Thrameos committed Mar 4, 2020
1 parent 7cb0e97 commit c8611233e79a6012b2a2d70bb8e1d92865a8152b
Showing with 2,059 additions and 870 deletions.
  1. +1 −0 .gitignore
  2. +3 −0 doc/CHANGELOG.rst
  3. +2 −0 examples/stubs/buf_leak_test.py
  4. +10 −1 jpype/__init__.py
  5. +11 −53 jpype/_core.py
  6. +0 −98 jpype/_cygwin.py
  7. +0 −76 jpype/_darwin.py
  8. +1 −7 jpype/_jarray.py
  9. +0 −1 jpype/_jclass.py
  10. +3 −3 jpype/_jcollection.py
  11. +0 −1 jpype/_jcomparable.py
  12. +4 −7 jpype/_jexception.py
  13. +0 −3 jpype/_jinit.py
  14. +1 −2 jpype/_jio.py
  15. +8 −3 jpype/_jobject.py
  16. +1 −2 jpype/_jpackage.py
  17. +4 −10 jpype/_jproxy.py
  18. +1 −5 jpype/_jstring.py
  19. +0 −2 jpype/_jtypes.py
  20. +239 −2 jpype/_jvmfinder.py
  21. +0 −66 jpype/_linux.py
  22. +0 −119 jpype/_windows.py
  23. +0 −1 jpype/nio.py
  24. +7 −9 jpype/pickle.py
  25. +8 −9 jpype/reflect.py
  26. +0 −2 native/common/include/jp_booleantype.h
  27. +0 −2 native/common/include/jp_bytetype.h
  28. +0 −2 native/common/include/jp_chartype.h
  29. +0 −2 native/common/include/jp_doubletype.h
  30. +11 −2 native/common/include/jp_exception.h
  31. +0 −2 native/common/include/jp_field.h
  32. +0 −2 native/common/include/jp_floattype.h
  33. +0 −2 native/common/include/jp_inttype.h
  34. +0 −2 native/common/include/jp_longtype.h
  35. +0 −2 native/common/include/jp_primitivetype.h
  36. +0 −1 native/common/include/jp_shorttype.h
  37. +2 −0 native/common/include/jp_tracer.h
  38. +1 −2 native/common/include/jp_voidtype.h
  39. +23 −0 native/common/include/jpype.h
  40. +6 −15 native/common/jp_booleantype.cpp
  41. +5 −18 native/common/jp_bytetype.cpp
  42. +1 −14 native/common/jp_chartype.cpp
  43. +4 −4 native/common/jp_class.cpp
  44. +2 −2 native/common/jp_classhints.cpp
  45. +15 −18 native/common/jp_doubletype.cpp
  46. +1 −1 native/common/jp_exception.cpp
  47. +0 −6 native/common/jp_field.cpp
  48. +14 −17 native/common/jp_floattype.cpp
  49. +5 −19 native/common/jp_inttype.cpp
  50. +5 −19 native/common/jp_longtype.cpp
  51. +2 −2 native/common/jp_objecttype.cpp
  52. +3 −3 native/common/jp_proxy.cpp
  53. +5 −19 native/common/jp_shorttype.cpp
  54. +2 −1 native/common/jp_tracer.cpp
  55. +0 −5 native/common/jp_voidtype.cpp
  56. +0 −17 native/python/include/jp_pythontypes.h
  57. +9 −0 native/python/include/pyjp.h
  58. +18 −54 native/python/jp_pythontypes.cpp
  59. +25 −16 native/python/pyjp_array.cpp
  60. +5 −5 native/python/pyjp_class.cpp
  61. +8 −4 native/python/pyjp_classhints.cpp
  62. +2 −2 native/python/pyjp_field.cpp
  63. +2 −2 native/python/pyjp_method.cpp
  64. +38 −1 native/python/pyjp_module.cpp
  65. +2 −2 native/python/pyjp_monitor.cpp
  66. +62 −32 native/python/pyjp_number.cpp
  67. +12 −12 native/python/pyjp_object.cpp
  68. +4 −15 native/python/pyjp_proxy.cpp
  69. +3 −3 native/python/pyjp_value.cpp
  70. +1 −1 project/jpype_cpython/Makefile.linux
  71. +48 −6 project/jpype_cpython/nbproject/configurations.xml
  72. +0 −1 project/utility/alter.py
  73. +1 −1 setup.py
  74. +1 −0 setupext/__init__.py
  75. +3 −4 setupext/build_ext.py
  76. +1 −1 setupext/build_java.py
  77. +199 −0 setupext/build_makefile.py
  78. +0 −1 setupext/build_thunk.py
  79. +0 −3 setupext/platform.py
  80. +0 −3 setupext/sdist.py
  81. +3 −0 test/harness/jpype/fields/Fields.java
  82. +7 −0 test/jpypetest/common.py
  83. +35 −0 test/jpypetest/test_collection.py
  84. +77 −0 test/jpypetest/test_conversion.py
  85. +2 −4 test/jpypetest/test_conversionFloat.py
  86. +18 −0 test/jpypetest/test_core.py
  87. +874 −0 test/jpypetest/test_fault.py
  88. +14 −0 test/jpypetest/test_jchar.py
  89. +5 −0 test/jpypetest/test_jclass.py
  90. +70 −0 test/jpypetest/test_jdouble.py
  91. +4 −0 test/jpypetest/test_jmethod.py
  92. +6 −1 test/jpypetest/test_jstring.py
  93. +86 −11 test/jpypetest/test_jvmfinder.py
  94. +3 −2 test/jpypetest/test_numeric.py
@@ -1,4 +1,5 @@
MANIFEST
Makefile
*~
/test/classes/
/test/jars/
@@ -5,6 +5,9 @@ This changelog *only* contains changes from the *first* pypi release (0.5.4.3) o

- **Next version - unreleased**

- float properly follows Java rules for conversion from double.
floats outside of range map to inf and -inf.

- **0.7.2 - 2-28-2019**

- C++ and Java exceptions hold the traceback as a Python exception
@@ -20,5 +20,7 @@ def __del__(self):

while True:
buf = java.lang.String('5' * 1024 * 1024 * 5)
del buf
buf = nio.convertToDirectBuffer(MyStr('5' * 1024 * 1024))
del buf
# time.sleep(1)
@@ -21,15 +21,24 @@
from ._gui import *
from ._classpath import *
from ._jclass import *
from ._jobject import *
from . import _jarray
from . import _jexception
from .types import *
from ._jcustomizer import *
from . import reflect
from . import nio
from . import types
from ._jcustomizer import *
# Import all the class customizers
# Customizers are applied in the order that they are defined currently.
from . import _jmethod
from . import _jcollection
from . import _jcomparable
from . import _jio


__all__ = ['java', 'javax', 'JException', 'JOverride']
__all__ = ['java', 'javax']
__all__.extend(_core.__all__)
__all__.extend(_classpath.__all__)
__all__.extend(types.__all__)
@@ -14,25 +14,13 @@
# limitations under the License.
#
# *****************************************************************************
import sys as _sys
import sys
import _jpype
from . import _jclass
from . import _jobject
from . import _jstring
from . import _jtypes
from . import _classpath

# Import all the class customizers
# Customizers are applied in the order that they are defined currently.
#from . import _properties
from . import _jarray
from . import _jexception
from . import _jcollection
from . import _jcomparable
from . import _jio
from . import _jmethod
from . import _jinit
from ._jvmfinder import JVMNotFoundException, JVMNotSupportedException

from ._jvmfinder import *

__all__ = [
'isJVMStarted', 'startJVM', 'attachToJVM', 'shutdownJVM',
@@ -41,16 +29,18 @@
'JVMNotFoundException', 'JVMNotSupportedException'
]

if _sys.version_info < (3,):
raise ImportException("Python 2 is not supported")
def versionTest():
if sys.version_info < (3,):
raise ImportError("Python 2 is not supported")
versionTest()


# Activate jedi tab completion
try:
import jedi as _jedi
_jedi.evaluate.compiled.access.ALLOWED_DESCRIPTOR_ACCESS += \
(_jpype._JMethod, _jpype._JField)
except:
except Exception:
pass


@@ -109,7 +99,7 @@ def _handleClassPath(clsList):
out.extend(glob.glob(s+'.jar'))
else:
out.append(s)
if _sys.platform == "cygwin":
if sys.platform == "cygwin":
out = [_classpath._posix2win(i) for i in out]
return _classpath._SEP.join(out)

@@ -272,7 +262,7 @@ def startJVM(*args, **kwargs):
_jpype._object_classes[_jtypes.JFloat] = _jpype._java_lang_Float
_jpype._object_classes[_jtypes.JDouble] = _jpype._java_lang_Double
_jpype._object_classes[type(None)] = _jpype._java_lang_Object
_jpype._object_classes[_jstring.JString] = _jpype._java_lang_String
_jpype._object_classes[_jpype.JString] = _jpype._java_lang_String

# Set up table of automatic conversions of Python primitives
# this table supports "JArray(type)"
@@ -384,38 +374,6 @@ def synchronized(obj):
raise TypeError("synchronized only applies to java objects")


def getDefaultJVMPath():
"""
Retrieves the path to the default or first found JVM library
Returns:
The path to the JVM shared library file
Raises:
JVMNotFoundException: If there was no JVM found in the search path.
JVMNotSupportedException: If the JVM was found was not compatible with
Python due to cpu architecture.
"""
if _sys.platform == "cygwin":
# Cygwin
from ._cygwin import WindowsJVMFinder
finder = WindowsJVMFinder()
elif _sys.platform == "win32":
# Windows
from ._windows import WindowsJVMFinder
finder = WindowsJVMFinder()
elif _sys.platform == "darwin":
# Mac OS X
from ._darwin import DarwinJVMFinder
finder = DarwinJVMFinder()
else:
# Use the Linux way for other systems
from ._linux import LinuxJVMFinder
finder = LinuxJVMFinder()

return finder.get_jvm_path()


# Naming compatibility
@deprecated("getDefaultJVMPath")
@@ -436,7 +394,7 @@ def getJVMVersion():
return (0, 0, 0)

import re
runtime = _jclass.JClass('java.lang.Runtime')
runtime = _jpype.JClass('java.lang.Runtime')
version = runtime.class_.getPackage().getImplementationVersion()

# Java 9+ has a version method

This file was deleted.

This file was deleted.

@@ -15,13 +15,7 @@
#
# *****************************************************************************
import sys as _sys

from collections.abc import Sequence

import _jpype
from . import _jclass
from . import _jobject
from . import _jstring
from . import _jcustomizer


@@ -200,7 +194,7 @@ def __next__(self):
@_jcustomizer.JImplementationFor("char[]")
class _JCharArray(object):
def __str__(self):
return str(_jstring.JString(self))
return str(_jpype.JString(self))

def __eq__(self, other):
if isinstance(other, str):
@@ -12,7 +12,6 @@
# limitations under the License.
#
# *****************************************************************************
import sys as _sys
import _jpype
from ._pykeywords import pysafe
from . import _jcustomizer
@@ -57,9 +57,9 @@ def _sliceAdjust(slc, size):
stop = slc.stop
if slc.step and (slc.step > 1 or slc.step < 0):
raise TypeError("Stride not supported")
if start == None:
if start is None:
start = 0
if stop == None:
if stop is None:
stop = size
if start < 0:
start += size
@@ -134,7 +134,7 @@ def __delitem__(self, i):

def __getitem__(self, ndx):
item = self.get(ndx)
if item == None:
if item is None:
if not self.containsKey(ndx):
raise KeyError('%s'%ndx)
return item

0 comments on commit c861123

Please sign in to comment.
You can’t perform that action at this time.