Repository navigation
-
Main features
-
Framework bindings updated for macOS 27 SDK
-
Add support for the following frameworks (all new in macOS 27):
-
LinkSecurity
-
StateReporting
-
-
objc.formal_protocolcan now be used as an additional base class
to indicate that a class implements a protocol.The following two definitions are equivalent:
class MyClass(NSObject, protocols=[NSFilePresenter]): ...
and:
class MyClass(NSObject, NSFilePresenter): ...
The formal protocols that are used as a base class do not end
up in the MRO, but will be added to__pyobjc_protocols__.Mixing the two definition styles is supported as well, although
this will lead to less understandable code. -
#359: Introduce a
objc.bound_selectorfor bound
selector objects.In previous versions bound selectors used the same type as
unbound selectors (objc.python_selectoror
objc.native_selector).Using a separate bound selector results in slightly better
performance due to not creating the bound selector object
during regular method calls.A
objc.bound_selectoris a subclass ofobjc.selector,
just like the other two classes and has the same attributes
as the selector value it binds. The only user-visible behaviour
change w.r.t. previous versions is that it is no longer
possible to test the flavour of a bound selector using
andisinstancecheck.
-
-
Incompatible changes:
-
This release drops support for Python 3.10
-
It is no longer possible to use
objc.native_selector
the create new selector values, it used to behave the same
as invokingobjc.selector. -
objc.formal_protocolno longer accepts native of
bound selectors in the lists of required and optional
selectors. -
A number of framework bindings used to expose some complex
Apple API functions as regular Python builtin functions, those
are now instances ofobjc.function.In regular usage the only side effect of this is that keyword
arguments are no longer supported for such functions. -
objc.UninitializedDeallocWarningwas removed.The bridge already never emitted this warning starting from
version 11.1. -
A number of functions in framework bindings used to accept
keyword arguments and no longer do due to a changed implementation
strategy. -
The first argument of
CoreText.CTRunDelegateCreatemust now
be a tuple, earlier versions accepted arbitrary sequences. -
The last argument of
CoreText.CTParagraphStyleGetValueForSpecifier
must beNoneand can no longer be a mutable buffer object. -
Quartz.CGReleaseScreenRefreshRectswill now raise an exception. It
was already a no-op. -
Foundation.NSHFSFTypeCodeFromFileTypeis longer present,
this was a type for :func:Foundation.NSHFSTypeCodeFromFileType. -
AppKit.NSConvertGlyphsToPackedGlyphsnow returns(0, None)instead
ofNonewhen the ObjC function returns 0. The previous behaviour was
an unintended deviation from the PyObjC convention. -
CFDictionaryGetKeysAndValuesnow includesobjc.NULLinstead
ofNonein the return tuple when the keys or values arguments are
objc.NULL. This matches the behaviour of automatic bindings. -
AppKit.NSBezierPath.elementAtIndex_associatedPoints_allows leaving
of the last argument. This feature is deprecated, starting PyObjC 14 the
second argument must be present (andNone) to match default behaviour
of the bridge. -
The addresses in the return value of
AppKit.NSNetService.addressesare
now strings instead of byte strings (to match the socket module). -
It is currently possible to call
AppKit.NSBitmapImageRep.getBitmapDataPlanes_
without arguments. This behaviour is deprecated, passingNoneis required
starting PyObjC 14. -
When overriding
AppKit.NSBezierPath.elementAtIndex_associatedPoints_in
a subclass specify both parameters, previous versions required just one parameter. -
Quartz.CIVector.__getitem__now consistently raises when the index is
out of range. In previous versions a positive out of range value would return
0.0 (inherited fromvalueAtIndex_. -
Quartz.CGWaitForScreenRefreshRects,
Quartz.CGWaitForScreenUpdateRects,
Quartz.CGScreenRegisterMoveCallback,
Quartz.CGScreenUnregisterMoveCallbackare no longer supported.The first two had manual bindings that were removed because
the system API hangs forever since at least macOS 10.9. The latter
two required, dit not have, manual bindings. -
The metadata for a number of functions in the Quartz bindings were dropped,
in particular those for functions that were dropped in or before macOS 10.9. -
Dropped
CFNetwork.kCFStreamSocketSecurityNone,
CFNetwork.kCFStreamSocketSecuritySSLv2,
CFNetwork.kCFStreamSocketSecuritySSLv3,
CFNetwork.kCFStreamSocketSecuritySSLv23, and
CFNetwork.kCFStreamSocketSecurityTLSv1. All constants were
deprecated in macOS 10.5 and removed later. -
Dropped
CloudKit.CKSubscriptionOptionsFiresOnRecordCreation,
CloudKit.CKSubscriptionOptionsFiresOnRecordDeletion,
CloudKit.CKSubscriptionOptionsFiresOnRecordUpdate, and
CloudKit.CKSubscriptionOptionsFiresOnce, all of them
removed in the macOS 10.11 SDK. -
Dropped
CoreWLAN.kCWScanTypeActive,
CoreWLAN.kCWScanTypePassive,
CoreWLAN.kCWScanTypeFast,
CoreWLAN.kCWInterfaceStateInactive,
CoreWLAN.kCWInterfaceStateScanning,
CoreWLAN.kCWInterfaceStateAuthenticating,
CoreWLAN.kCWInterfaceStateAssociating,
CoreWLAN.kCWInterfaceStateRunning,
CoreWLAN.kCWSecurityModeOpen,
CoreWLAN.kCWSecurityModeWEP,
CoreWLAN.kCWSecurityModeWPA_PSK,
CoreWLAN.kCWSecurityModeWPA2_PSK,
CoreWLAN.kCWSecurityModeDynamicWEP,
CoreWLAN.kCWSecurityModeWPA_Enterprise,
CoreWLAN.kCWSecurityModeWPA2_Enterprise,
CoreWLAN.kCWSecurityModeWPS,
CoreWLAN.kCWOpModeStation,
CoreWLAN.kCWOpModeIBSS,
CoreWLAN.kCWOpModeHostAP,
CoreWLAN.kCWOpModeMonitorMode,
CoreWLAN.CoreWLANFrameworkVersionNumber2_0,
CoreWLAN.CWEventTypeVirtualInterfaceStateChanged,
CoreWLAN.CWEventTypeRangingReportEvent,
CoreWLAN.CWServiceDidChangeNotification,
CoreWLAN.kCWErrorDomain,
CoreWLAN.kCWModeDidChangeNotification,
CoreWLAN.kCWPowerDidChangeNotification,
CoreWLAN.kCWSSIDDidChangeNotification,
CoreWLAN.kCWScanKeyBSSID,
CoreWLAN.CWScanKeyDwellTime,
CoreWLAN.kCWScanKeyMerge,
CoreWLAN.kCWScanKeyRestTime,
CoreWLAN.kCWScanKeySSID,
CoreWLAN.kCWScanKeyScanType,
CoreWLAN.kCWPHYMode11ax,
CoreWLAN.kCWPHYMode11A,
CoreWLAN.kCWPHYMode11B,
CoreWLAN.kCWPHYMode11G, and
CoreWLAN.kCWPHYMode11N.
All of these were removed in the macOS 10.9 SDK or earlier. -
Dropped
ImageCaptureCore.ICReturnErrorDeviceEjected,
symbol was removed a log time ago. -
Dropped
Intents.INShortcutAvailabilityOptionSleepPrepareForTomorrow,
Intents.INChargingConnectorTypeOptionCCS1,
Intents.INChargingConnectorTypeOptionCCS2,
Intents.INChargingConnectorTypeOptionCHAdeMO,
Intents.INChargingConnectorTypeOptionGBTAC,
Intents.INChargingConnectorTypeOptionGBTDC,
Intents.INChargingConnectorTypeOptionJ1772,
Intents.INChargingConnectorTypeOptionMennekes,
Intents.INChargingConnectorTypeOptionNone, and
Intents.INChargingConnectorTypeOptionTesla.
All of these were only present in a beta SDK.Also dropped
Intents.INSendMessageIntentResponseCodeFailureMessageAttachmentErrorand
Intents.INSendMessageIntentResponseCodeFailureMessageLocationNotAllowed
which aren't present in any recent SDK. -
Dropped
LocationAuthentication.kLACredentialTypePasscodeand
LocationAutentication.kLACredentialTypePassphrasewhich
were only present in a beta SDK. -
Dropped
Metal.MDLPrimitiveTypeCapsule,
Metal.MDLPrimitiveTypeCone,
Metal.MDLPrimitiveTypeCube,
Metal.MDLPrimitiveTypeCylinder,
Metal.MDLPrimitiveTypeNone, and
Metal.MDLPrimitiveTypeSphere,
which were only present in a beta SDK. -
Dropped
NetworkExtension.NEVPNIKEv2DiffieHellmanGroup0,
which was only in a beta SDK. -
Dropped
SafariServices.SFSafariServicesVersion10_0,
SafariServices.SFSafariServicesVersion10_1,
SafariServices.SFSafariServicesVersion11_0,
SafariServices.SFSafariServicesVersion12_0,
SafariServices.SFSafariServicesVersion12_1,
SafariServices.SFSafariServicesVersion13_0, and
SafariServices.SFSafariServicesVersion27_0.
All of these are not part of the public API, but are
present in a separate header used for Swift support. -
Dropped
UserNotifications.UNNotificationGroupingSettingDefault,
UserNotifications.UNNotificationGroupingSettingSource,
UserNotifications.UNNotificationGroupingSettingOff.
All of these were only in a beta SDK. -
Dropped
DiskArbitration.kDADiskOptionEjectUponLogout,
DiskArbitration.kDADiskOptionMountAutomatic,
DiskArbitration.kDADiskOptionMountAutomaticNoDefer,
DiskArbitration.kDADiskOptionPrivate, all which were
removed before macOS 10.9. -
Dropped :data:
FileProvider.NSFileProviderErrorCausedByErrorsKey
which was only in a beta SDK. -
Dropped
Vision.VNAnimalDetectorDog,
Vision.VNAnimalDetectorCat, which
were only in a beta SDK.
-
-
Deprecations:
-
The attribute
objc.platformis deprecated and will be removed
in PyObjC 14. Its value is always"MACOSX". -
Quartz.CVPixelBufferCreateWithBytescurrently has an
optional last argument. That feature is deprecated, the argument
will be required in PyObjC 14. -
The last argument of
CoreFoundation.CFBagGetValuesand
CoreFpundation.CFRunLoopTimerGetContextis
currently optional. That feature is deprecated and the last
argument will be required in PyObjC 14.
-
-
The following frameworks are deprecated in macOS 27:
-
MultipeerConnectivity
-
AVRouting
-
-
All formal protocols (
@protocol ...in Objective-C) are exposed
as attributes on module that implements the binding for the framework
that defines the protocol, e.g.Foundation.NSFastEnumerationfor
@protocol(NSFastEnumeration).A number of protocols have the same name as an Objective-C classes, in
those cases the protocol is bound to a name ending with "Protocol". -
The test suite for the framework wrappers has been reworked with
more consistent test naming. Tests now assume macOS 10.9 or later. -
The CoreAudio bindings no longer contain a C++ extension because
Xcode 27 can no longer target macOS 10.15 or earlier when using
C++. -
Improved error message when the self argument in
calls to a class selector is invalid. -
The SIMD functions in the ARKit bindings are now supported as well.
-
Added an internal API to override how C functions are called
byobjc.function, similar to an override system used
for calling selectors.This enabled adding support for SIMD values in
objc.functions,
and enabled usingobjc.functionfor functions with interfaces
that cannot be described fully using the metadata system. -
#680: The change in the previous item causes problems
withSystemConfiguration.SCDynamicStoreCreate. Implemented
a workaround for that. -
Add support for C APIs that pass a function pointer to a callback
function (when that callback is implemented in Python). -
CoreText.CTParagraphStyleGetValueForSpecifierwill now
automatically size the buffer when passing 0 for the size parameter,
and will in that case also return the retrieved value with the expected
type instead of as bytes object.The passed in buffer must now be
Noneand cannot be a mutable
buffer type. -
Quartz.CGPSConverterCreatewill now accept :data:Nonefor
individual callbacks in the callbacks argument. -
CoreFoundation.CFMachPortCreate,CoreFoundation.CFMachPortCreateWithPort,
andCoreFoundation.CFMessagePortCreateLocalnow correctly handleobjc.NULL` for the last argument. -
The callback for
CFMessagePortCreateLocalnow actually works,
in previous versions the process would crash hard when the callback
was invoked and returned a buffer.note: The 'data' argument for the callback is an :class:
NSDataobject
that is invalidated by the system when the callback returns. Use
a copy of the buffer (e.g.bytes(data)) when the value
is used after the callback returns. -
CoreFoundation.CFReadStreamSetClientnow correctly handles
a callback value ofNone(removes the current callback)
and acceptsNoneof the context (with the same semantics
asobjc.NULL). -
I already regularly run the testsuite for pyobjc-core with coverage testing
(both Python and Objective-C) and have extended this to the framework
bindings.This resulted in more functional tests for the framework bindings to
get better test coverage, and fixed a small number of bugs. -
Foundation.NSLocalizedAttributedStringWithDefaultValuenow
actually works. -
CoreAudio.AudioValueTranslation.create_input_bufferand
CoreAudio.create_buffer
used to give an internal error when passed the wrong number or types
of arguments. -
Fix handling exceptions in the callback for
Quartz.CGPathApply. -
Fix handling exceptions and reference counts in callbacks for
MediaToolbox.MTAudioProcessingTapCreate. -
Calling
Quartz.CGEventTapCreateForPidis now supported. -
Fix crash when calling
Security.SecKeychainFindInternetPassword
with arguments of the incorrect type. -
Any exception raised in the callback for :func:
Security.AuthorizationCopyRightsAsync
is now reported as an unraisable exception because the application will crash
hard when raising Objective-C exceptions in this context. -
Port 'scan-build' target from pyobjc-core to the framework bindings and
fix issues found by the Clang static analyzer. -
Any exception raised in the callbacks for
Quartz.CGDataProviderCreateSequential
is now reported as an unraisable exception because the application will crash
hard when raising Objective-C exceptions in this context. -
Correct metadata for
Security.sec_protocol_options_set_tls_tickets_enabled,
Security.sec_protocol_options_set_tls_ocsp_enabled,
Security.sec_protocol_options_set_tls_false_start_enabled,
Security.sec_protocol_options_set_tls_resumption_enabled,
Security.sec_protocol_options_set_tls_is_fallback_attempt,
Security.sec_protocol_options_set_tls_sct_enabled, and
Security.sec_protocol_options_set_tls_renegotiation_enabled, -
Correct metadata for
ARKit.ar_anchor_get_identifier. -
Correct metadata for
CFOpenDirectory, a number of functions
had incorrect type encodings for CoreFoundation object types defined
by the framework. -
Correct metadata for
Quartz.CGFontCreatePostScriptEncoding. -
Correct metadata for various functions in the :mod:
Securitybindings. -
Cleanup the metadata overrides for framework metadata, which should make
it easier to maintain these overrides going forward. -
Fixed metadata for
CoreData.NSCustomMigrationStage.willMigrateHandler,
CoreData.NSCustomMigrationStage.setWillMigrateHandler_,
CoreData.NSCustomMigrationStage.didMigrateHandler, and
CoreData.NSCustomMigrationStage.setDidMigrateHandler_. -
Fix value of the (deprecated) constant
Quartz.CGGlyphMax. -
Fix value of the constant
dispatch.DISPATCH_WALLTIME_NOW. -
Fix type encoding for
ColorSync.ColorSync.ColorSyncMD5. -
Fix type encoding for
Metal.MTLMapIndirectArguments. -
Fix type encoding for
libdispatch.timespec. -
#689: Fix reference leak in
Foundation.NSData.bytes,
Foundation.NSData.mutableBytes, and
objc.varlist.as_buffer. -
Create more accurate metadata for selectors
in the "copy" category, and for functions with "Copy" or "Create"
in their name. -
#690: Fix reference count handling for selectors in
the "new" category.Before this fix calling methods like
newBufferWithLength_options_
on a Metal device would leak memory due to the result object
having a +1 reference count that the bridge didn't account for.In 12.2.3 a minimal fix was added to
pyobjc-core, in this release
a more comprehensive fix was done, in particular creating and
overview of the affected methods. All of these are already fixed
in release 12.2.3.