Skip to content

Commit

Permalink
Fixes for PyPy (#627)
Browse files Browse the repository at this point in the history
  • Loading branch information
misl6 authored Jun 18, 2022
1 parent 57e3ea0 commit bcf4e28
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
13 changes: 13 additions & 0 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name: Continuous Integration
jobs:
Tests:
name: base
continue-on-error: true
strategy:
matrix:
python:
Expand All @@ -11,6 +12,9 @@ jobs:
- '3.8'
- '3.9'
- '3.10'
- 'pypy-3.7'
- 'pypy-3.8'
- 'pypy-3.9'
java:
- '8'
# - '9' # commented out just for faster CI
Expand All @@ -31,6 +35,15 @@ jobs:
architecture: 'x86'
- os: macOs-latest
architecture: 'x86'
- os: windows-latest
architecture: 'x86'
python: 'pypy-3.7'
- os: windows-latest
architecture: 'x86'
python: 'pypy-3.8'
- os: windows-latest
architecture: 'x86'
python: 'pypy-3.9'

runs-on: ${{ matrix.os }}
steps:
Expand Down
6 changes: 1 addition & 5 deletions jnius/jnius_conversion.pxi
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from cpython.version cimport PY_MAJOR_VERSION
from cpython cimport PyUnicode_DecodeUTF16

activeLambdaJavaProxies = set()

Expand Down Expand Up @@ -257,10 +256,7 @@ cdef convert_jstring_to_python(JNIEnv *j_env, jstring j_string):
j_strlen = j_env[0].GetStringLength(j_env, j_string);

buffsize = j_strlen * sizeof(jchar)
# py_uni = (<char *>j_chars)[:buffsize].decode('utf-16')
# Calling directly into c-api for utf-16 decoding due to Cython code gen
# bug for utf-16: https://github.com/cython/cython/issues/1696
py_uni = PyUnicode_DecodeUTF16(<char *>j_chars, buffsize, NULL, NULL)
py_uni = (<char *>j_chars)[:buffsize].decode('utf-16')
finally:
j_env[0].ReleaseStringChars(j_env, j_string, j_chars)

Expand Down
2 changes: 1 addition & 1 deletion tests/test_jvm_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class TestJVMOptions:
)
def test_jvm_options(self):
options = ['-Dtest.var{}=value'.format(i) for i in range(40)]
process = subprocess.Popen(['python', '-c', textwrap.dedent(
process = subprocess.Popen([sys.executable, '-c', textwrap.dedent(
'''\
import jnius_config
import json
Expand Down

0 comments on commit bcf4e28

Please sign in to comment.