diff --git a/docs/changelog.rst b/docs/changelog.rst index 30398dd01..1d763e8c4 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -38,6 +38,10 @@ Version 10.3.2 Fix by user rndblnch on github +* :issue:`625`: Fix crash for calling ``NSIndexSet.alloc().initWithIndex_(0)`` + + This "fix" is a workaround for what appears to be a bug in Foundation. + Version 10.3.1 -------------- diff --git a/pyobjc-core/Modules/objc/objc-class.m b/pyobjc-core/Modules/objc/objc-class.m index c6a8c4f92..6024e67d6 100644 --- a/pyobjc-core/Modules/objc/objc-class.m +++ b/pyobjc-core/Modules/objc/objc-class.m @@ -2659,15 +2659,16 @@ static Class _Nullable objc_metaclass_locate(PyObject* meta_class) PyType_Ready((PyTypeObject*)result); } - if (strcmp(className, "_NSPlaceholderData") == 0) { - /* XXX */ + if (strncmp(className, "_NSPlaceholder", sizeof("_NSPlaceholder")-1) == 0) { /* Workaround for an issue on macOS 10.15: For some * reason the call to class_getInstanceVariable crashes * when called early in the process, likely due to an * incompletely initialized class. * - * The workaround is hardcoded for this specific class - * to avoid issues with other magic classes. + * The issue is more widespread in later versions of the OS, + * and seems to be related to rewriting Foundation in Swift. + * + * Issues: #271, #625 */ [objc_class class]; }