From 152f53ea2740b0dd84a86c9e881e26539b59cd07 Mon Sep 17 00:00:00 2001 From: BREW <81044362+b-re-w@users.noreply.github.com> Date: Sat, 3 Oct 2026 19:53:05 +0900 Subject: [PATCH] Test: Always run the TypedPython leak test now that #98 is fixed --- .../commonMain/kotlin/fixture/app/TypedPythonBridge.kt | 6 ++++-- .../kotlin/fixture/app/TypedPythonKotlinCallTest.kt | 8 -------- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/ksp-fixtures/app/src/commonMain/kotlin/fixture/app/TypedPythonBridge.kt b/ksp-fixtures/app/src/commonMain/kotlin/fixture/app/TypedPythonBridge.kt index 1a856b27d..5b621546f 100644 --- a/ksp-fixtures/app/src/commonMain/kotlin/fixture/app/TypedPythonBridge.kt +++ b/ksp-fixtures/app/src/commonMain/kotlin/fixture/app/TypedPythonBridge.kt @@ -52,8 +52,10 @@ fun tpCheck(value: Double, limit: Double): Double { * wrapper unreachable -- so the token's `sys.getrefcount` is only meaningful after a JVM collection * and the cleaner have run (`TypedPythonKotlinCallTest.settledCounts`). * - * Deliberately **not** closed here: closing a `PyObject` argument inside an upcall releases its - * reference twice and crashed the test JVM (`Py_XDECREF` on the cleaner thread) -- binder issue #98. + * Not closed here, so the test also covers the cleaner path. Closing it would be equally correct: + * `close()` gives back the wrapper's one reference and the cleaner then has nothing left to release + * (`closeArgument`, `PyObjectArgumentReleaseTest`). The JVM crash once blamed on that (issue #98) came + * from a test wrapping fake addresses as owned objects, not from the binder. */ fun tpTouch(token: PyObject?): Long { TpBridgeLedger.touches += 1 diff --git a/ksp-fixtures/app/src/desktopTest/kotlin/fixture/app/TypedPythonKotlinCallTest.kt b/ksp-fixtures/app/src/desktopTest/kotlin/fixture/app/TypedPythonKotlinCallTest.kt index a1d4eec96..805106f9b 100644 --- a/ksp-fixtures/app/src/desktopTest/kotlin/fixture/app/TypedPythonKotlinCallTest.kt +++ b/ksp-fixtures/app/src/desktopTest/kotlin/fixture/app/TypedPythonKotlinCallTest.kt @@ -229,14 +229,6 @@ class TypedPythonKotlinCallTest { */ @Test fun tenThousandCompiledCallsLeakNoReferenceAndNoKotlinHandle() { - // Blocked by python-multiplatform#98: when the cleaner releases the wrappers that 10,000 - // upcalls leave behind, the binder releases one reference twice and the JVM dies (SIGSEGV in - // Py_XDECREF on Cleaner-0) -- on the interpreted control as much as on the compiled loop. - // Re-enable with -Dtypedpython.leakTest=true once #98 is fixed. - assumeTrue( - "blocked by python-multiplatform#98 (binder double release on the cleaner path)", - System.getProperty("typedpython.leakTest") == "true", - ) Python3.exec( """ import gc, sys, sysconfig