From fe97888884d1df8967f617f680b67c46501af1e9 Mon Sep 17 00:00:00 2001 From: jianfengmao Date: Thu, 24 Oct 2024 14:19:17 -0600 Subject: [PATCH] Rollback temp change and add clarifying comments --- setup.py | 2 +- src/main/java/org/jpy/PyObjectReferences.java | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 31a5529..b2a2635 100644 --- a/setup.py +++ b/setup.py @@ -280,7 +280,7 @@ def test_python_with_java_classes(self): def test_java(self): assert test_maven() - # suite.addTest(test_python_with_java_runtime) + suite.addTest(test_python_with_java_runtime) suite.addTest(test_python_with_java_classes) # comment out because the asynchronous nature of the PyObject GC in Java makes stopPython/startPython flakey. # suite.addTest(test_java) diff --git a/src/main/java/org/jpy/PyObjectReferences.java b/src/main/java/org/jpy/PyObjectReferences.java index 6d26604..68cc7fe 100644 --- a/src/main/java/org/jpy/PyObjectReferences.java +++ b/src/main/java/org/jpy/PyObjectReferences.java @@ -153,6 +153,8 @@ def cleanup(references): sleep_time = 0.1 if size == 1024 else 1.0 time.sleep(sleep_time) */ + // try-catch block to handle PyLib not initialized exception when a race condition occurs in the free-threaded + // mode that the cleanup thread starts running after Python is already finalized. try { final PyObjectCleanup proxy = asProxy();