Skip to content

Update for JPype deprecation and raw prepend for regex string #207

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions jaydebeapi/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ def _jdbc_connect_jpype(jclassname, url, driver_args, jars, libs):
global old_jpype
if hasattr(jpype, '__version__'):
try:
ver_match = re.match('\d+\.\d+', jpype.__version__)
ver_match = re.match(r'\d+\.\d+', jpype.__version__)
if ver_match:
jpype_ver = float(ver_match.group(0))
if jpype_ver < 0.7:
Expand All @@ -197,8 +197,8 @@ def _jdbc_connect_jpype(jclassname, url, driver_args, jars, libs):
else:
jpype.startJVM(jvm_path, *args, ignoreUnrecognized=True,
convertStrings=True)
if not jpype.isThreadAttachedToJVM():
jpype.attachThreadToJVM()
if not jpype.java.lang.Thread.isAttached():
jpype.java.lang.Thread.attach()
jpype.java.lang.Thread.currentThread().setContextClassLoader(jpype.java.lang.ClassLoader.getSystemClassLoader())
if _jdbc_name_to_const is None:
types = jpype.java.sql.Types
Expand Down