ronaldoussoren / pyobjc

The Python <-> Objective-C Bridge with bindings for macOS frameworks
https://pyobjc.readthedocs.io
553 stars 47 forks source link

Crashes on macOS 10.14 #582

Closed ronaldoussoren closed 10 months ago

ronaldoussoren commented 10 months ago

When running the full test suite on macOS 10.14 I get repeatable crashes in the metadata tests. This seems to be a problem with the system, but need to investigate if this affects real code or just the test suite.

For now I've disabled crashing tests.

ronaldoussoren commented 10 months ago

This appears to be related to partially initialised framework support, possibly related to catalyst (although that feature was formally introduced in 10.15)

ronaldoussoren commented 10 months ago

The problem is related to the AppKit framework: No crashes if I hack AppKit/__init__.py to not load the AppKit framework.

I'm seeing the same crash with both 3.12 and 3.8, but python.org installers (although the 3.8 install is ancient). This means the build host of the installer is not relevant for the crash.

Also: crash also happens when installing a wheel for the current release, so not a compiler bug in the version of Xcode I'm using.

ronaldoussoren commented 10 months ago

The problem is related to the initialisation of the private AnnotationKit framework. I'm testing a workaround that hardcodes the list of classes in this framework and ignores them (needed because using +[NSBundle bundleForClass:] also triggers the crash).

So far this appears to fix the issue.