Skip to content

Release the GIL while UIKit runs the application - #91

Merged
freakboy3742 merged 4 commits into
beeware:mainfrom
kattni:codex/846-ios-launcher-gil
Nov 6, 2026
Merged

freakboy3742 merged 4 commits into
beeware:mainfrom
kattni:codex/846-ios-launcher-gil

Conversation

@kattni

@kattni kattni commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Release Python's GIL around UIApplicationMain, restoring the thread state on return or an Objective-C exception. Advertise sys._ios_app_main_releases_gil = True before importing app code so Rubicon can safely disable nesting. Refs beeware/rubicon-objc#846.

The complete fix requires this PR and beeware/rubicon-objc#847. Either component can be upgraded independently; only updating both disables nesting. No Toga or application code change is needed, but generated native launchers must be updated and rebuilt.

All four old/new Rubicon and launcher combinations passed the included simulator checks for nesting and prompt worker callbacks, as did a smoke test with unmodified Toga 0.5.7. Pre-commit passes; physical iPad trackpad validation remains outstanding.

PR Checklist:

  • I will abide by the BeeWare Code of Conduct
  • I have read and have followed the CONTRIBUTING.md file
  • This PR was generated or assisted using an AI tool

Assisted-by: OpenAI Codex

@freakboy3742 freakboy3742 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've removed the test case (since it wasn't being actively used); I've also been able to remove the sys annotation code, as my testing suggests that as long as we make the next Rubicon release 0.6.0, we can gracefully introduce the new lifecycle handling.

@freakboy3742
freakboy3742 merged commit b3133d3 into beeware:main Nov 6, 2026
7 checks passed
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.

2 participants