Skip to content

Commit

Permalink
Fix PR collision
Browse files Browse the repository at this point in the history
  • Loading branch information
Thrameos committed Oct 19, 2024
1 parent 9d66c27 commit 8bfb5b0
Showing 1 changed file with 18 additions and 15 deletions.
33 changes: 18 additions & 15 deletions jpype/_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ def _hasClassPath(args) -> bool:

def _handleClassPath(
classpath: typing.Union[typing.Sequence[_PathOrStr], _PathOrStr, None] = None,
ascii: bool = True
) -> typing.Sequence[str]:
"""
Return a classpath which represents the given tuple of classpath specifications
Expand Down Expand Up @@ -151,7 +152,9 @@ def _handleClassPath(
out.extend(glob.glob(pth + '.jar'))
else:
out.append(pth)
return _classpath._SEP.join(out)
if ascii:
return _classpath._SEP.join([i for i in out if i.isascii()])
return [i for i in out if not i.isascii()]


_JVM_started = False
Expand Down Expand Up @@ -274,20 +277,20 @@ def startJVM(
raise RuntimeError(f"{jvmpath} is older than required Java version{version}") from ex
raise

# """Prior versions of JPype used the jvmargs to setup the class paths via
# JNI (Java Native Interface) option strings:
# i.e -Djava.class.path=...
# See: https://docs.oracle.com/javase/7/docs/technotes/guides/jni/spec/invocation.html
#
# Unfortunately, unicode is unsupported by this interface on windows, since
# windows uses wide-byte (16bit) character encoding.
# See: https://stackoverflow.com/questions/20052455/jni-start-jvm-with-unicode-support
#
# To resolve this issue we add the classpath after initialization since jpype
# itself supports unicode class paths.
# """
# for cp in _handleClassPath(classpath):
# addClassPath(Path.cwd() / Path(cp).resolve())
"""Prior versions of JPype used the jvmargs to setup the class paths via
JNI (Java Native Interface) option strings:
i.e -Djava.class.path=...
See: https://docs.oracle.com/javase/7/docs/technotes/guides/jni/spec/invocation.html
Unfortunately, unicode is unsupported by this interface on windows, since
windows uses wide-byte (16bit) character encoding.
See: https://stackoverflow.com/questions/20052455/jni-start-jvm-with-unicode-support
To resolve this issue we add the classpath after initialization since jpype
itself supports unicode class paths.
"""
for cp in _handleClassPath(classpath, False):
addClassPath(Path.cwd() / Path(cp).resolve())


def initializeResources():
Expand Down

0 comments on commit 8bfb5b0

Please sign in to comment.