Download Latest Version v11.1 source code.tar.gz (24.3 MB)
Email in envelope

Get an email when there's a new version of PyObjC

Home / v11.1
Name Modified Size InfoDownloads / Week
Parent folder
README.md 2025-06-14 6.9 kB
v11.1 source code.tar.gz 2025-06-14 24.3 MB
v11.1 source code.zip 2025-06-14 28.5 MB
Totals: 3 Items   52.8 MB 15

The major change in this release is aligning behaviour of the core bridge with clang's documentation for automatic reference counting <https://clang.llvm.org/docs/AutomaticReferenceCounting.html>_ for initializer methods. In particular, PyObjC now correctly models that methods in the "init" family steal a reference to self and return a new reference.

In previous version of PyObjC the proxy for [NSObject alloc] would be marked as 'partially initialized' and would be cleared when the -init method returns something else then self.

This has two problems:

  1. Behaviour is incorrect when +alloc returns a singleton whose -init method(s) are factory methods (such as NSArray in recent versions of macOS)

  2. The proxy for Objective-C objects needs to contain mutable state. This in turn requires locking in the implementation to work correctly with free-threading.

This version drops the concept of "uninitialized" values and correctly models how reference counts are handled by -init methods.

  • Update framework bindings for the macOS 15.5 SDK

  • Added bindings for the SecurityUI framework

  • Restructure the PyObjC website

The theme of the PyObjC websites is now shibuya to give a more modern look and feel to the website.

The actual content is mostly still the same, with some minor restructuring of pages. Restructuring will continue in future updates.

  • :class:objc.FSRef now implements :class:os.PathLike.

  • :issue:642: Fix concurrency issue when creating NSArray instances using NSArray.alloc().init....

In previous versions the following would fail on recent versions of macOS:

.. sourcecode:: python

value1 = NSArray.alloc()
value2 = NSArray.alloc()

value1 = value1.init()
value2 = value2.init()

That's a unrealistic code pattern, but the same can be triggered using NSArray.alloc().init() when run concurrently in multiple threads, especially when using free-threading.

  • Fixing the previous issue required rearchitecting the way partially initialized objects (e.g. the result of SomeClass.alloc() are handled, and has some other user visible behaviour changes (none of which should affect normal code):

  • :class:objc.UninitializedDeallocWarning is now soft deprecated because this warning will never be emitted.

  • Bit 0x1 will never be set in the __flags__ attribute of Objective-C objects.

  • The proxied value of an :class:objc.objc_object instance will never be nil, all exceptions about accessing attributes or methods of a NIL object are gone.

  • It is now possible to call methods on a partially initialized object, in previous versions that would often result in setting the proxied value to nil.

  • It is now possible to call an init method multiple times an an partially initialized value, e.g.:

    .. sourcecode:: python

    part = SomeClass.alloc() value1 = part.init() value2 = part.init()

    Whether or not this is safe depends on the implementation of the Objective-C class. In general it is advised to not use this pattern, but always call SomeClass.alloc().init...() or the more pythonic SomeClass(...) introduced in PyObjC 10.3.

  • The following code accidentally worked in previous versions of PyObjC and will now crash. Handling of partially initialized objects in previous versions hides the reference counting bug in this code.

    .. sourcecode:: python

    class NilObject(NSObject): def init(self): self.release() return None

  • The isAlloc attribute of :class:objc.selector is deprecated and will be removed in PyObjC 12.

  • The bridge no longer uses CFRetain and CFRelease to maintain the reference counts of Objective-C values. The original reason to do this is no longer needed, there are edge cases where mixing native ObjC retain count updates with these functions causes problems.

  • Python 3.14: Use PyUnstable_Object_IsUniquelyReferenced to check if the dealloc helper is uniquely referenced when trying to release it instead of manually checking the reference count.

This fixes an unlikely edge case in the free threading build where checking the reference count like this is not correct.

  • Deprecated :attr:objc.objc_object.pyobjc_ISA.

  • Implement __class_getitem__ for :class:objc.function, :class:objc.selector. :class:objc.varlist. and :class:objc.WeakRef

This allows for treating these classes a generic in type annotations.

  • Add some methods to :class:PyObjCTools.TestSupport.TestCase, in particular :meth:assertIsInitializer <PyObjCTools.TestSupport.TestCase.assertIsInitializer, :meth:assertIsNotInitializer <PyObjCTools.TestSupport.TestCase.assertIsNotInitializer, :meth:assertDoesFreeResult <PyObjCTools.TestSupport.TestCase.assertDoesFreeResult, :meth:assertDoesNotFreeResult <PyObjCTools.TestSupport.TestCase.assertDoesNotFreeResult.

  • Add implementation for NSMutableData.resize to match :meth:bytearray.resize that was introduced in Python 3.14.

  • Using a instance of a Python class with an __call__ method as an Objective-C block is now possible.

  • Change PyObjC's internal assertions in C code from PyObjC_Assert to assert (and only enable them using debug builds of CPython). This is slightly more efficient and enables removing error return paths in a number of functions due to internal APIs that could only fail due to assertion errors.

  • Removed some helper code that was used when subclassing a number of NSDecimalNumber methods. This should have no effect because overriding these methods is effectifly impossible anyway on recent versions of macOS.

  • Fix some free-threaded race conditions

  • Classes NSString and NSMutableString are marked as "final", which means these classes can no longer be subclassed.

Reason for this is that Cocoa strings have special handling in PyObjC and trying to subclass these classes in Python will result in crashes.

  • The objc._objc extension no longer performs imports from native code, all external dependencies are passed in as (private) options from Python code.

This simplifies PyObjC's code, and avoids having imports that are hidden from analysis tools.

  • Remove usage of pkg_resources in PyObjC's setup.py files.

This is needed because this library is deprecated in setuptools and will be removed.

  • :issue:651: Fix build issue on macOS 10.12 by changing the invocation of sw_vers(1).
Source: README.md, updated 2025-06-14