Remove broken dlopen in pyobjc_internal_init; fix bogus fallback path#150
Open
ElliotGarbus wants to merge 2 commits into
Open
Remove broken dlopen in pyobjc_internal_init; fix bogus fallback path#150ElliotGarbus wants to merge 2 commits into
ElliotGarbus wants to merge 2 commits into
Conversation
On iOS 16+ system frameworks live only in the dyld shared cache — there is no on-disk file to dlopen. The absolute-path dlopen always fails and prints two scary-looking error lines on every launch. The /Groups/System/… fallback path has never existed on any Apple OS and was not fixed when kivy#22 and kivy#36 were closed in 2016. The dlopen handle was never read after being written; Foundation is already mapped into the process via direct linking before pyobjc_internal_init() runs, so the ObjC runtime (objc_getClass, …) works without it. Empty the function body and drop the now-unused <stdio.h> and <dlfcn.h> includes. Closes kivy#146
connection_didFailWithError_ calls CFRunLoopStop after each failure, so a single CFRunLoopRunInMode call exits after the first delegate fires and the second connection's event is never delivered. Run the loop in short bursts, restarting after each CFRunLoopStop, until both delegates have been called.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #146.
pyobjc_internal_init()in_runtime.htries todlopenFoundation by absolute filesystem path. On iOS 16+ (and matching simulators) that path does not exist — Apple moved system frameworks fully into the dyld shared cache. The call always fails, printing two noisy error lines on every app launch. The/Groups/System/…fallback path has never corresponded to any real macOS or iOS directory and was not corrected when #22 and #36 were closed in 2016.The fix is safe because:
foundationdlopen handle is written once and never read — verified by searching the tree for all uses of the variable.allocAndInitAutoreleasePool()reachesNSAutoreleasePoolviaobjc_getClass, which goes through the ObjC runtime's class registry and has no dependency on the dlopen handle.pyobjc_internal_init()runs, so the ObjC runtime works without an explicit handle.Changes
pyobjus/_runtime.h— empty the body ofpyobjc_internal_init()and drop the now-unused<stdio.h>and<dlfcn.h>includes.Result
The two
Got dlopen error on Foundation/Got fallback dlopen error on Foundationlines that appeared on every launch are gone. No other behaviour changes.