Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jpype-project/jpype
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v1.3.0
Choose a base ref
...
head repository: jpype-project/jpype
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v1.4.1
Choose a head ref

Commits on May 10, 2021

  1. Remove line in terminate.

    Thrameos committed May 10, 2021
    Copy the full SHA
    05a62ef View commit details

Commits on Jun 4, 2021

  1. Copy the full SHA
    c619d60 View commit details

Commits on Jun 5, 2021

  1. Copy the full SHA
    53c0586 View commit details
  2. Repair whitespace

    Thrameos committed Jun 5, 2021
    Copy the full SHA
    10dcdfa View commit details
  3. Copy the full SHA
    661c541 View commit details

Commits on Jun 7, 2021

  1. Fix typo

    Thrameos committed Jun 7, 2021
    Copy the full SHA
    b24be1d View commit details
  2. Merge pull request #984 from Thrameos/dbapi_shutdown

    Documentation of sql shutdown issue
    Thrameos authored Jun 7, 2021
    Copy the full SHA
    83c7fe6 View commit details

Commits on Aug 24, 2021

  1. Updates to documentation

    Thrameos committed Aug 24, 2021
    Copy the full SHA
    fc6fc52 View commit details
  2. Documentation on annotations

    Thrameos committed Aug 24, 2021
    Copy the full SHA
    d5869ad View commit details
  3. Fix typo

    Thrameos committed Aug 24, 2021
    Copy the full SHA
    58fc762 View commit details

Commits on Sep 4, 2021

  1. Merge pull request #999 from Thrameos/docfix

    Docfix
    marscher authored Sep 4, 2021
    Copy the full SHA
    7880991 View commit details

Commits on Sep 22, 2021

  1. Add try block around setting autoCommit

    Alexander Bij authored and Alexander Bij committed Sep 22, 2021
    Copy the full SHA
    fb00ffe View commit details
  2. Merge pull request #1004 from abij/try-set-autocommit

    Add try block around setting autoCommit
    Thrameos authored Sep 22, 2021
    Copy the full SHA
    9c210eb View commit details

Commits on Oct 17, 2021

  1. Copy the full SHA
    52695df View commit details
  2. Copy the full SHA
    6402990 View commit details
  3. Arrays and test

    Thrameos committed Oct 17, 2021
    Copy the full SHA
    042530d View commit details

Commits on Oct 18, 2021

  1. Missed one.

    Thrameos committed Oct 18, 2021
    Copy the full SHA
    8c71b7c View commit details

Commits on Oct 22, 2021

  1. Copy the full SHA
    0b8b7e7 View commit details
  2. Try to update image.

    Thrameos committed Oct 22, 2021
    Copy the full SHA
    9325d37 View commit details
  3. Update .azure so CI runs

    Thrameos committed Oct 22, 2021
    Copy the full SHA
    32b8857 View commit details

Commits on Nov 2, 2021

  1. Merge pull request #1011 from Thrameos/ssize_t

    Fix for ssize_t issue on windows
    marscher authored Nov 2, 2021
    Copy the full SHA
    77b2aff View commit details
  2. Copy the full SHA
    bcf9ed6 View commit details
  3. Merge pull request #1012 from Thrameos/classtype_hints

    java.lang.Class and arrays conversion hints
    Thrameos authored Nov 2, 2021
    Copy the full SHA
    bbdca90 View commit details

Commits on Nov 26, 2021

  1. fix - #1016: Make functional conversion check argument count

    This commit modify functional conversion to check argument count:
    
    1. If the Java functional interface have more parameters than
       the Python function and the Python function does not accept
       variable arguments, conversion type is none
    
    2. If the Java functional interface have less parameters than
       the number of required positional parameters of the Python
       function, conversion type is none
    
    3. Otherwise, conversion type is implict.
    Christopher-Chianelli committed Nov 26, 2021
    Copy the full SHA
    80153b1 View commit details

Commits on Dec 1, 2021

  1. Clear error indicator in functional matches, add @FunctionalInterface

    …to Test classes
    
    - The error indicator is potentially set by PyObject_GetAttrString, which
      will cause an error to be thrown by JP_PY_CHECK (a null check is
      performed versus doing a PyObject_HasAttrString first).
    
    - Add @FunctionalInterface to the interfaces used in the functional
      overloads test, as the annotation is used to determine if it is
      possible to cast a Python function to the Java type.
    Christopher-Chianelli committed Dec 1, 2021
    Copy the full SHA
    5803b3e View commit details
  2. Copy the full SHA
    9b84f7d View commit details

Commits on Dec 7, 2021

  1. Copy the full SHA
    8ea0112 View commit details

Commits on Dec 21, 2021

  1. Copy the full SHA
    4b0c837 View commit details

Commits on Jan 14, 2022

  1. Copy the full SHA
    97e4bf6 View commit details
  2. Remove extra space

    LukasZahradnik committed Jan 14, 2022
    Copy the full SHA
    38fedf7 View commit details

Commits on Jan 16, 2022

  1. Merge pull request #1021 from HyukjinKwon/typo-in-example

    Fix java.nio.file import in AutoCloseable example
    Thrameos authored Jan 16, 2022
    Copy the full SHA
    7e12ac6 View commit details

Commits on Jan 17, 2022

  1. Fix issue with numpy arrays.

    Thrameos committed Jan 17, 2022
    Copy the full SHA
    0f8d7d9 View commit details
  2. Copy the full SHA
    a09f008 View commit details
  3. Merge pull request #1025 from LukasZahradnik/master

    User Guide documentation typos fixes
    marscher authored Jan 17, 2022
    Copy the full SHA
    cfd5f84 View commit details
  4. Copy the full SHA
    a48575d View commit details
  5. Copy the full SHA
    731454d View commit details

Commits on Feb 27, 2022

  1. Add python_requires.

    Thrameos committed Feb 27, 2022
    Copy the full SHA
    156f075 View commit details
  2. Merge pull request #1026 from Thrameos/numpy_bug

    Fix issue with numpy arrays.
    Thrameos authored Feb 27, 2022
    Copy the full SHA
    df54340 View commit details
  3. Merge pull request #1017 from Christopher-Chianelli/issue-1016

    fix - #1016: Make functional conversion check argument count
    Thrameos authored Feb 27, 2022
    Copy the full SHA
    1e1564f View commit details
  4. Fix for javadoc on Java14+

    Thrameos committed Feb 27, 2022
    Copy the full SHA
    7eb2098 View commit details
  5. Remove 3.5 from test matrix

    Thrameos committed Feb 27, 2022
    Copy the full SHA
    18dd810 View commit details
  6. Merge pull request #1032 from Thrameos/javadoc14

    Fix for javadoc on Java14+
    Thrameos authored Feb 27, 2022
    Copy the full SHA
    4e46640 View commit details
  7. Merge pull request #1033 from Thrameos/azure3.5

    Remove 3.5 from test matrix
    Thrameos authored Feb 27, 2022
    Copy the full SHA
    e0939df View commit details
  8. Fix for macos image

    Thrameos committed Feb 27, 2022
    Copy the full SHA
    0b608f4 View commit details

Commits on Feb 28, 2022

  1. Merge pull request #1035 from Thrameos/azure-macos

    Fix for macos image
    Thrameos authored Feb 28, 2022
    Copy the full SHA
    d578bf3 View commit details

Commits on Mar 11, 2022

  1. Remove old requirement check

    Thrameos committed Mar 11, 2022
    Copy the full SHA
    55fa68a View commit details
  2. Merge pull request #1031 from Thrameos/requires

    Add python_requires.
    Thrameos authored Mar 11, 2022
    Copy the full SHA
    5108fb7 View commit details
  3. Merge pull request #969 from Thrameos/cleanup2

    Remove line in terminate.
    Thrameos authored Mar 11, 2022
    Copy the full SHA
    c704d71 View commit details

Commits on Apr 5, 2022

  1. Update README.rst

    This might help someone else using Solaris/Unix and having to compile on two different environments.
    krowvin authored Apr 5, 2022
    Copy the full SHA
    d6d3c6e View commit details

Commits on Apr 7, 2022

  1. [readthedocs] install openjdk-8-jdk via apt (#1044)

    [readthedocs] install openjdk-8-jdk via apt to be able to compile jpypes java library.
    marscher authored Apr 7, 2022
    Copy the full SHA
    8e90e5a View commit details
Showing with 1,387 additions and 533 deletions.
  1. +26 −26 .azure/build.yml
  2. +16 −16 .azure/release.yml
  3. +3 −4 .azure/scripts/build-wheels.sh
  4. +13 −6 .azure/scripts/osx-python.sh
  5. +1 −2 .bumpversion.cfg
  6. +8 −1 .readthedocs.yml
  7. +2 −0 README.rst
  8. +47 −0 doc/CHANGELOG.rst
  9. +5 −7 doc/conf.py
  10. +35 −1 doc/dbapi2.rst
  11. +1 −1 doc/java/lang.py
  12. +3 −11 doc/quickguide.py
  13. +2 −2 doc/quickguide.rst
  14. +183 −92 doc/userguide.rst
  15. +1 −1 jpype/__init__.py
  16. +13 −10 jpype/_core.py
  17. +3 −1 jpype/_jclass.py
  18. +6 −0 jpype/_jproxy.py
  19. +3 −3 jpype/_jvmfinder.py
  20. +4 −1 jpype/_pykeywords.py
  21. +7 −1 jpype/dbapi2.py
  22. +0 −5 jpype/imports.py
  23. +1 −6 jpype/pickle.py
  24. +0 −12 jpype/protocol.py
  25. +2 −2 native/common/include/jp_booleantype.h
  26. +2 −2 native/common/include/jp_bytetype.h
  27. +2 −2 native/common/include/jp_chartype.h
  28. +2 −2 native/common/include/jp_doubletype.h
  29. +2 −2 native/common/include/jp_floattype.h
  30. +2 −2 native/common/include/jp_inttype.h
  31. +2 −2 native/common/include/jp_longtype.h
  32. +2 −2 native/common/include/jp_primitivetype.h
  33. +2 −2 native/common/include/jp_shorttype.h
  34. +2 −0 native/common/include/jp_typemanager.h
  35. +2 −2 native/common/include/jp_voidtype.h
  36. +2 −2 native/common/jp_array.cpp
  37. +2 −0 native/common/jp_arrayclass.cpp
  38. +1 −1 native/common/jp_booleantype.cpp
  39. +1 −1 native/common/jp_bytetype.cpp
  40. +1 −1 native/common/jp_chartype.cpp
  41. +0 −1 native/common/jp_class.cpp
  42. +12 −0 native/common/jp_classhints.cpp
  43. +6 −6 native/common/jp_classtype.cpp
  44. +1 −5 native/common/jp_context.cpp
  45. +224 −20 native/common/jp_convert.cpp
  46. +1 −1 native/common/jp_doubletype.cpp
  47. +27 −49 native/common/jp_exception.cpp
  48. +1 −1 native/common/jp_floattype.cpp
  49. +51 −0 native/common/jp_functional.cpp
  50. +2 −2 native/common/jp_gc.cpp
  51. +3 −3 native/common/jp_inttype.cpp
  52. +3 −3 native/common/jp_longtype.cpp
  53. +3 −0 native/common/jp_methoddispatch.cpp
  54. +1 −1 native/common/jp_shorttype.cpp
  55. +1 −1 native/common/jp_stringtype.cpp
  56. +11 −0 native/common/jp_typemanager.cpp
  57. +2 −2 native/common/jp_voidtype.cpp
  58. +1 −1 native/java/org/jpype/JPypeContext.java
  59. +5 −1 native/java/org/jpype/javadoc/JavadocExtractor.java
  60. +1 −0 native/java/org/jpype/manager/ClassDescriptor.java
  61. +28 −0 native/java/org/jpype/manager/TypeManager.java
  62. +1 −1 native/python/include/jp_pythontypes.h
  63. +3 −3 native/python/jp_pythontypes.cpp
  64. +4 −12 native/python/pyjp_array.cpp
  65. +95 −95 native/python/pyjp_char.cpp
  66. +1 −5 native/python/pyjp_class.cpp
  67. +2 −1 native/python/pyjp_method.cpp
  68. +1 −9 native/python/pyjp_module.cpp
  69. +23 −3 native/python/pyjp_value.cpp
  70. +19 −0 project/debug/unix/README.rst
  71. +8 −9 setup.py
  72. +8 −3 setupext/platform.py
  73. +2 −2 setupext/test_java.py
  74. +3 −3 test-requirements.txt
  75. +2 −2 test/harness/jpype/doc/Test.java
  76. +48 −0 test/harness/jpype/overloads/Test2.java
  77. +8 −0 test/harness/jpype/str/Test.java
  78. +3 −3 test/jpypetest/test_array.py
  79. +154 −17 test/jpypetest/test_buffer.py
  80. +42 −0 test/jpypetest/test_classhints.py
  81. +0 −8 test/jpypetest/test_closeable.py
  82. +2 −2 test/jpypetest/test_conversionInt.py
  83. +2 −2 test/jpypetest/test_conversionLong.py
  84. +2 −2 test/jpypetest/test_conversionShort.py
  85. +0 −8 test/jpypetest/test_core.py
  86. +3 −3 test/jpypetest/test_jboolean.py
  87. +2 −2 test/jpypetest/test_jbyte.py
  88. +19 −0 test/jpypetest/test_jchar.py
  89. +1 −1 test/jpypetest/test_jdouble.py
  90. +1 −1 test/jpypetest/test_jfloat.py
  91. +2 −1 test/jpypetest/test_jint.py
  92. +2 −1 test/jpypetest/test_jlong.py
  93. +1 −1 test/jpypetest/test_jshort.py
  94. +6 −1 test/jpypetest/test_keywords.py
  95. +15 −0 test/jpypetest/test_legacy.py
  96. +94 −1 test/jpypetest/test_overloads.py
  97. +12 −0 test/jpypetest/test_proxy.py
52 changes: 26 additions & 26 deletions .azure/build.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# JPype CI pipeline
pr:
trigger:
branches:
include:
- master
@@ -22,67 +22,67 @@ variables:
jobs:
- job: Deps
pool:
vmImage: "ubuntu-16.04"
vmImage: "ubuntu-latest"
steps:
- template: scripts/ivy.yml

- job: Documentation
pool:
vmImage: "ubuntu-16.04"
vmImage: "ubuntu-latest"
steps:
- template: scripts/documentation.yml

- job: Coverage
pool:
vmImage: "ubuntu-16.04"
vmImage: "ubuntu-latest"
dependsOn: Deps
steps:
- template: scripts/deps.yml
- template: scripts/coverage.yml

- job: Tracing
pool:
vmImage: "ubuntu-16.04"
vmImage: "ubuntu-latest"
steps:
- template: scripts/tracing.yml

- job: Test
dependsOn: Deps
strategy:
matrix:
linux-3.5:
imageName: "ubuntu-16.04"
python.version: '3.5'
linux-3.6:
imageName: "ubuntu-16.04"
python.version: '3.6'
linux-3.7:
imageName: "ubuntu-16.04"
imageName: "ubuntu-latest"
python.version: '3.7'
linux-3.8:
imageName: "ubuntu-16.04"
imageName: "ubuntu-latest"
python.version: '3.8'
linux-3.9:
imageName: "ubuntu-16.04"
imageName: "ubuntu-latest"
python.version: '3.9'
windows-3.5:
imageName: "vs2017-win2016"
python.version: '3.5'
windows-3.6:
imageName: "vs2017-win2016"
python.version: '3.6'
linux-3.10:
imageName: "ubuntu-latest"
python.version: '3.10'
linux-3.11:
imageName: "ubuntu-latest"
python.version: '3.11'
windows-3.7:
imageName: "vs2017-win2016"
imageName: "windows-2019"
python.version: '3.7'
windows-3.8:
imageName: "vs2017-win2016"
imageName: "windows-2019"
python.version: '3.8'
#windows-3.9:
#imageName: "vs2017-win2016"
#python.version: '3.9'
windows-3.9:
imageName: "windows-2019"
python.version: '3.9'
#jpypetest.fast: 'true'
windows-3.10:
imageName: "windows-2019"
python.version: '3.10'
windows-3.11:
imageName: "windows-2019"
python.version: '3.11'
mac-3.9:
imageName: "macos-10.14"
imageName: "macos-11"
python.version: '3.9'
jpypetest.fast: 'true'

32 changes: 16 additions & 16 deletions .azure/release.yml
Original file line number Diff line number Diff line change
@@ -30,25 +30,20 @@ stages:
strategy:
matrix:
# Disabled because it is fetching beta images
# 64Bit2010:
# arch: x86_64
# plat: manylinux2010_x86_64
# image: quay.io/pypa/manylinux2010_x86_64
# python.architecture: x64
# 64Bit2014:
# arch: aarch64
# plat: manylinux2014_aarch64
# image: quay.io/pypa/manylinux2014_aarch64
# python.architecture: aarch64
64Bit:
arch: x86_64
plat: manylinux1_x86_64
image: quay.io/pypa/manylinux1_x86_64
plat: manylinux2010_x86_64
image: quay.io/pypa/manylinux2010_x86_64
python.architecture: x64
32Bit:
arch: i686
plat: manylinux1_i686
image: quay.io/pypa/manylinux1_i686
plat: manylinux2010_i686
image: quay.io/pypa/manylinux2010_i686
python.architecture: x86
pool:
vmImage: "ubuntu-latest"
@@ -61,9 +56,6 @@ stages:
condition: eq(1,1)
strategy:
matrix:
Python36:
python.version: '3.6'
python.architecture: 'x64'
Python37:
python.version: '3.7'
python.architecture: 'x64'
@@ -73,8 +65,14 @@ stages:
Python39:
python.version: '3.9'
python.architecture: 'x64'
Python310:
python.version: '3.10'
python.architecture: 'x64'
Python311:
python.version: '3.11'
python.architecture: 'x64'
pool:
vmImage: 'vs2017-win2016'
vmImage: "windows-2019"
steps:
- template: scripts/deps.yml
- task: UsePythonVersion@0
@@ -93,16 +91,18 @@ stages:
python.architecture: 'x64'
strategy:
matrix:
Python36:
python.version: '3.6'
Python37:
python.version: '3.7'
Python38:
python.version: '3.8'
Python39:
python.version: '3.9'
Python310:
python.version: '3.10'
Python311:
python.version: '3.11'
pool:
vmImage: "macOS-10.14"
vmImage: "macos-11"
steps:
- template: scripts/deps.yml
- script: .azure/scripts/osx-python.sh '$(python.version)'
7 changes: 3 additions & 4 deletions .azure/scripts/build-wheels.sh
Original file line number Diff line number Diff line change
@@ -2,11 +2,10 @@
set -e -x

# Collect the pythons
pys=(/opt/python/*/bin)
pys=(/opt/python/cp*/bin)

# Filter out Python 3.4
pys=(${pys[@]//*34*/})
pys=(${pys[@]//*27*/})
# Exclude specific Pythons (3.6)
pys=(${pys[@]//*36*/})

# Compile wheels
for PYBIN in "${pys[@]}"; do
19 changes: 13 additions & 6 deletions .azure/scripts/osx-python.sh
Original file line number Diff line number Diff line change
@@ -3,21 +3,28 @@
PYTHON_VERSION="$1"

case $PYTHON_VERSION in
3.6)
FULL_VERSION=3.6.8
;;
3.7)
FULL_VERSION=3.7.9
INSTALLER_NAME=python-$FULL_VERSION-macosx10.9.pkg
;;
3.8)
FULL_VERSION=3.8.6
FULL_VERSION=3.8.10
INSTALLER_NAME=python-$FULL_VERSION-macosx10.9.pkg
;;
3.9)
FULL_VERSION=3.9.0
FULL_VERSION=3.9.12
INSTALLER_NAME=python-$FULL_VERSION-macosx10.9.pkg
;;
3.10)
FULL_VERSION=3.10.4
INSTALLER_NAME=python-$FULL_VERSION-macos11.pkg
;;
3.11)
FULL_VERSION=3.11.0
INSTALLER_NAME=python-$FULL_VERSION-macos11.pkg
;;
esac

INSTALLER_NAME=python-$FULL_VERSION-macosx10.9.pkg
URL=https://www.python.org/ftp/python/$FULL_VERSION/$INSTALLER_NAME

PY_PREFIX=/Library/Frameworks/Python.framework/Versions
3 changes: 1 addition & 2 deletions .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 1.3.0
current_version = 1.4.1
commit = True
tag = False
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(\_(?P<release>[a-z]+)(?P<build>\d+))?
@@ -28,4 +28,3 @@ values =
search = Latest Changes:
replace = Latest Changes:
- **{new_version} - {now:%Y-%m-%d}**

9 changes: 8 additions & 1 deletion .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -13,9 +13,16 @@ sphinx:

# Optionally set the version of Python and requirements required to build your docs
python:
version: 3.8
version: "3.8"
install:
- method: pip
path: .
extra_requirements:
- docs

build:
image: latest
apt_packages:
- openjdk-8-jdk


2 changes: 2 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
@@ -26,6 +26,8 @@ access to the entirety of CPython and Java libraries.
<https://github.com/jpype-project/jpype>`_
:Issue tracker: `GitHub Issues
<https://github.com/jpype-project/jpype/issues>`_
:Discussions: `GitHub Discussions
<https://github.com/jpype-project/jpype/discussions>`_
:Documentation: `Python Docs`_
:License: `Apache 2 License`_
:Build status: |TestsCI|_ |Docs|_
47 changes: 47 additions & 0 deletions doc/CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -4,6 +4,53 @@ Changelog
This changelog *only* contains changes from the *first* pypi release (0.5.4.3) onwards.

Latest Changes:
- **1.4.1 - 2022-10-26**

- Fixed issue with startJVM changing locale settings.

- Changes to support Python 3.11

- Fix truncation of strings on null when using convert strings.

- Replaced distutil with packaging


- **1.4.0 - 2022-05-14**

- Support for all different buffer type conversions.

- Improved buffer transfers to numpy as guaranteed to match Java types.
However, exact dtype for conversions is os/numpy version dependent.

- Support for byte order channels on buffer transfers.

- Byte size for buffers now fixed to Java definitions.

- When directly accessing Java arrays using memory view, Python requires a
cast from buffers. Required because Python does not support memory view
alterations on non-native sizes.

- Fix crash when comparing JChar.

- Order handling for numerical operations with JChar fixed.

- Improved matching for Java functors based on parameter count.

- Dropped support for Python 3.5 and 3.6

- dbapi2 handles drivers that don't support autocommit.

- Fixed issue when Java classes with dunder methods such as ``__del__``
caused conflicts in Python type system. Java method which match dunder
patterns are longer translated to Python.

- Fix issue with numpy arrays with no dimensions resulting in crash.

- Support for user defined conversions for java.lang.Class and array types.

- Fixed issue with ssize_t on Windows for Python 3.10.


- **1.3.0 - 2021-05-19**

- Fixes for memory issues found when upgrading to Python 3.10 beta.
12 changes: 5 additions & 7 deletions doc/conf.py
Original file line number Diff line number Diff line change
@@ -31,7 +31,10 @@
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = ['sphinx.ext.napoleon', 'sphinx.ext.autodoc', 'sphinx.ext.autosectionlabel', 'readthedocs_ext.readthedocs', ]
extensions = ['sphinx.ext.napoleon',
'sphinx.ext.autodoc',
'sphinx.ext.autosectionlabel',
'readthedocs_ext.readthedocs', ]
autosectionlabel_prefix_document = True

# Add any paths that contain templates here, relative to this directory.
@@ -236,12 +239,7 @@ def patch(self, key):
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']

html_context = {
'css_files': [
'_static/theme_overrides.css', # override wide tables in RTD theme
],
}
html_css_files = ['theme_overrides.css']

# Add any extra paths that contain custom files (such as robots.txt or
# .htaccess) here, relative to this directory. These files are copied
36 changes: 35 additions & 1 deletion doc/dbapi2.rst
Original file line number Diff line number Diff line change
@@ -376,7 +376,41 @@ so that the custom return type accurately reflects the column type.
# Custom return converter here
return rc
JSON = JSONType("JSON")
Interactions with prepared statements
-------------------------------------

Certain calls can be problematic for dbapi2 depending on driver. In
particular, SQL calls which invalidate the state of the connection will issue
an exception when the connection is used. In HSQLDB the statement
``cur.execute('shutdown')`` invalidates the connection which when the statement
is then automatically closed will then produce an exception.

This exception is due to a conflict between dbapi2, Java, and HSQLDB
specifications. Dbapi2 requires that statements be executed as prepared
statements, Java requires that closing a statement yields no action if the
connection is already closed, and HSQLBD sets the ``isValid`` to false but not
``isClosed``. Thus executing a shutdown through dbapi2 would be expected to
close the prepared statement on an invalid connection resulting in an error.

We can address these sort of driver specific behaviors by applying a customizer
to the Java class to add additional behaviors.

.. code-block:: python
@jpype.JImplementationFor("java.sql.PreparedStatement")
class MyStatement(object):
@jpype.JOverride(sticky=True, rename='_close')
def close(self):
if not self.getConnection().isValid(100):
return
return self._close()
Alternatively we can access the ``java.sql.Connection`` directly and call the
shutdown routine using an unprepared statement. Though that would require
accessing private fields.


Conclusion
==========
2 changes: 1 addition & 1 deletion doc/java/lang.py
Original file line number Diff line number Diff line change
@@ -25,7 +25,7 @@ class AutoCloseable:
.. code-block:: python
from java.nio.files import Files, Paths
from java.nio.file import Files, Paths
with Files.newInputStream(Paths.get("foo")) as fd:
# operate on the input stream
Loading