Skip to content

Binder: GIL release tests beyond 'does not crash' (#162) - #305

Merged
b-re-w merged 2 commits into
developfrom
feat/pmp-gil-release-tests
Oct 25, 2026
Merged

b-re-w merged 2 commits into
developfrom
feat/pmp-gil-release-tests

Conversation

@b-re-w

@b-re-w b-re-w commented Oct 25, 2026

Copy link
Copy Markdown
Member

Closes #162

  • Finding: the GIL has been released after initialisation since 4f5ec40 (Python3.kt:89, PyEval_SaveThread after Py_Initialize). SPEC C-4 was stale, so this PR adds tests and corrects the SPEC. There is no behaviour change.
  • GilReleaseTest (jvmTest, so it runs on desktop and Android) and GilReleaseNativeTest (nativeTest, so it runs on iOS and androidNative). Each has two tests:
    1. A second thread runs Python while the initialising thread waits in Kotlin.
    2. A withoutGIL wait lets another thread run Python.
      Every wait is bounded.
  • Mutants on desktop, each failing exactly its own test:
    • Remove the post-init SaveThread: test 1 fails.
    • Make withoutGIL a no-op: test 2 fails.
  • Results: desktop 2/2, iOS simulator 2/2. Android: the test compiles (compileDebugAndroidTestKotlinAndroid), but it was not run on a device because no AVD is available. Follow-up: Binder: run GilReleaseTest on an Android device #304.

…EC C-4 corrected (#162)

The GIL has been released after initialisation since 4f5ec40 (Python3.initialize saves the main
thread state); C-4 still said it was not. GilReleaseTest (jvmTest: desktop and Android) and
GilReleaseNativeTest (nativeTest: iOS and androidNative) prove it and withoutGIL beyond not crashing.
@b-re-w
b-re-w merged commit 71a6662 into develop Oct 25, 2026
@b-re-w
b-re-w deleted the feat/pmp-gil-release-tests branch October 25, 2026 10:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant