You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It appears that when fully loading a bundle (such as Foundation), a bouncing python app appears in the dock, and NSApp() now returns an Object instead of None. This makes it impossible to stop the event loop without causing the entire python process to be terminated (due to
fromFoundationimportNSTimerfromPyObjCTools.AppHelperimportrunConsoleEventLoop, stopEventLoopfromAppKitimportNSAppimportFoundation# Load any boundle# This causes an app to appear in the dock on macOS >= 14.0dir(Foundation)
# This works too:# objc.loadBundle(# 'Foundation',# globals(),# bundle_identifier='com.apple.Foundation',# )# Confirm there's an App Runningprint(NSApp())
defstopper(self):
# Here this terminates the app - and thus the whole python process -instead of terminating the event loopstopEventLoop()
NSTimer.scheduledTimerWithTimeInterval_repeats_block_(0.3, False, stopper)
runConsoleEventLoop()
print("This should be printed, but it's not")
nik012003
changed the title
Terminating event loop causes process termination in Sonoma
Stopping event loop causes process termination in Sonoma
Feb 11, 2024
It appears that when fully loading a bundle (such as Foundation), a bouncing python app appears in the dock, and
NSApp()
now returns an Object instead of None. This makes it impossible to stop the event loop without causing the entire python process to be terminated (due topyobjc/pyobjc-framework-Cocoa/Lib/PyObjCTools/AppHelper.py
Lines 170 to 171 in dee913c
Here's a minimal PoC:
Output in Sonoma:
Output in Ventura:
We found this out while experimenting with the VisionKit on Ventura. Another snippet that presents the same problem is: #592 (comment)
The text was updated successfully, but these errors were encountered: