NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
PyPI · #4515 most downloaded on PyPI
Wrappers for the framework WebKit on macOS
Last release 1 months ago
11 Aug 2026
Ships fairly regularly
a new release about every 2 months
Nearly every release is documented
notes for 60 of 60 stable releases
Nothing withdrawn
no release was ever pulled
17 years old
67 releases · first in 2009
Fix a number of OSX 10.10 support issues.
Issue #86: Fix installation issue with setuptools 3.6.
Issue #86: Fix installation issue with setuptools 3.6.
Issue #85: Remove debug output from the wrapper for NSApplicationMain.
Issue #82: NSArray.iter was accedently removed in PyObjC 3.0
PyObjCTools.Debugging didn't work properly on recent OSX versions (at least OSX 10.9)
because /usr/bin/atos no longer worked.
One column per quarter.
PyObjC could crash when calling a method that is dynamically generated (that is, the selector is not present in the class according to the Objective-C
PyObjC could crash when calling a method that is dynamically generated (that is, the selector is not present in the class according to the Objective-C runtime but the instance responds to it anyway).
The cases that used to crash now raise objc.error instead.
Note
It is highly unlikely that real code would run into this, found while working on PyObjC 3.x.
When writing a python unicode object to an NSArchiver or NSKeyedArchiver the object is now stored exactly the same as a normal NSString, and will be read back as such.
This increases interoperability with code that expects to read back a non-keyed archive in a different process. An example of this is the use of Growl (see issue 31)
Instances of subclasses of unicode are not affected by this change, and can only be read back by other PyObjC programs.
43: It was no longer possible to create instances of LaunchServices.LSLaunchURLSpec due to incomplete metadata.
41: the 'install.py' script in the root of pyobjc repository failed to perform an install when running in a clean checkout of the tree.
44: the various Cocoa frameworks only export @protocol definitions when they happen to be used by code in the framework. Added extensions to the various framework wrappers to ensure that all protocols are available to python code.
Opaque pointer types now can be constructed with a "c_void_p" keyword argument that contains a ctypes.c_void_p value for the pointer.
This is the reverse of the __c_void_p__() method that was added earlier.
46: It was not possible to use the Quartz.CoreGraphics module on OSX 10.5 when the binary was build on 10.8 (and using a 10.5 deployment target).
Similar issues may be present in some of the other framework wrappers, there will be a more generic fix for this issue in a future release.
objc.addConvenienceForSelector is deprecated, primarily to make it possible to restructure the pyobjc internals.
Note
Sadly enough this changelog is incomplete.
Fix crash when unarchiving a Python object.
Add missing calls to [super init] in the implementation of OC_PythonUnicode and OC_PythonString (the ObjC proxies for python's unicode and str types)
objc.addConvenienceForSelector is deprecated, primarily to make it possible to restructure the pyobjc internals.
Workaround for bug in pip that resulted in pyobjc-core not being pip installable. Patch by Marc Abramowitz.
Creating new formal protocols now uses the new runtime API that was introduced in OSX 10.7. Because of this it is now possible to create new formal protocols in 64-bit code (when running on OSX 10.7 or later)
Codebase should work again when Python using --enable-unicode=ucs4.
BUG: Avoid crashes in calculating with NSDecimal values in Python 3
Implement '//' operator for NSDecimal and NSDecimalNumber.
Implement support for the round builtin in NSDecimal and NSDecimalNumber
There is now limited support for packed struct definitions. This requires that the struct is wrapped using objc.createStructType.
Struct packing is not described in the encoding string for a structure, which is why special support is needed.
objc.registerStructAlias now returns the alias type instead of None
In Python 3.x there is a new way to explicitly specify which (informal) protocols a class conforms to:
class MyClass (NSObject, protocols=[Protocol1, Protocol2]): pass
Python 2.x does not support this syntax, you can still use the following code there:
class MyClass (NSObject, Protocol1, Protocol2): pass
Note: The Python 2.x style works up to Python 3.2. In Python 3.3 and later the Python 2.x style declaration no longer works due to changes in the language.
It is also possible to specify the protocols that a class conforms to using a "__pyobjc_protocols__" attribute in the class body. This has the same interface as the "protocols" keyword argument in Python 3.x.
This is primarily meant to be used by code that needs to work in Python 2 as well as Python 3.
Updated Python support. With this release PyObjC supports Python 2.6 and later, including Python 3.3 (which has a completely new representation for unicode strings)
NOTE: Support for 3.3 is very much work in progress right now, there have been changes for the new unicode representation, but more changes are required.
Known issues:
metadata conflict error when explicitly implementing a prototype
one test failure w.r.t. unichar argument arrays
Furthermore there are two refcounting test failures in both 3.2 and 3.3
Add objc.setObjCPointerIsError and objc.getObjCPointerIsError.
By default PyObjC will create a PyObjCPointer object when it tries to convert a pointer it doesn't know about to Python. These values are fairly useless and obvious an indication that an API is wrapped improperly.
With objc.setObjCPointerIsError(True) you can tell the bridge to raise an exception instead of creating these values.
-[OC_PythonNumber compare:] calls super when the other value is an NSNumber and the Python value can be represented using a basic C type.
This could slightly affect the results of comparing Python and Cocoa numbers, and avoids unbounded recursion when comparing Python numbers with NSDecimalNumbers on OSX 10.7 or later.
Add implementations for methods from the NSComparisonMethods informal protocol to OC_PythonNumber
Add '__cmp__' method when the Objective-C class implements the 'compare:' selector.
Introduced a way to compile bridgesupport data and lazily load wrappers.
Avoid using "from Cocoa import *" to get the most benefits from this, use either "import Cocoa" or "from Cocoa import NSObject".
objc.initFrameworkWrapper is now deprecated, switch to the new compiled metadata code instead.
objc.allocateBuffer now returns a bytearray on python >= 2.6, it used to return a buffer object in Python 2.
a TypeError.
objc.getAssociatedObject, objc.setAssociatedObject and objc.removeAssociatedObjects are wrappers for the corresponding functions in the Objective-C runtime API. These functions are only available when PyObjC was build on a system running OSX 10.6 or later, and the script is also running on such as system.
The policy argument for objc.setAssociatedObject is optional and defaults to objc.OBJC_ASSOCIATION_RETAIN.
Renamed the assertion functions in PyObjCTools.TestSupport, added assertFoo methods and deprecated the failIfFoo and failUnlessFoo methods (similarly…
Add some experimental code that slightly reduces the amount of memory used when loading bridgesupport files.
Further work is needed to investigate what causes the memory usage to increase as much as it does, sadly enough Instruments doesn't play nice with --with-pymalloc and for some reason 'import Foundation' crashes with --without-pymalloc.
"<struct>" definitions in the bridgesupport files can now have an alias attribute containing the name of Python type that should be used to proxy values of this type.
This is used in the Quartz bindings to ensure that CGRect and NSRect (from the Foundation framework) map onto the same Python type.
Added objc.registerStructAlias, a helper function to add a type encoding that should map on an already existing struct type.
Use this to ensure that NSRect and CGRect are the same (in the Foundation and Quartz bindings).
This version requires Python 2.6 or later, and also supports Python 3.1 or later.
BUGFIX: The generic proxy for Python objects now implements -(CFTypeID)_cfTypeID, which should result in less hard to understand Objective-C exceptions.
BUGFIX: The metadata file support now checks if the metadata is compatible with information gathered from the Objective-C runtime.
This ensures that when a native method signature is incompatible with the signature in a metadata file the bridge won't garble the correct information (and that in turn avoids hard crashes).
PyObjC's support for NSCoding now also works with plain NSArchiver instances, not just with NSKeyedArchiver.
(This item is currently only true for python3, need tests for python 2.x)
NSDictionary now fully implements the dict API, except for the differences not below:
NSDictionary doesn't have the __missing__ hook.
semantics from Python.
NSDictionary.copy always returns an immutable dictionary, use NSDictionary.mutableCopy to get a mutable dictionary.
Instances of NSDictionary cannot be pickled
NSDictionary implements one important feature that native Python dictionaries don't: full support for Key-Value Observations. Sadly enough it is not possible to support Key-Value Observation of native Python dictionaries without patching the interpreter.
NSSet and NSMutableSet implement the same interface as frozenset and set, except for the differences listed below:
object, use the mutableCopy method to create a mutable copy.
Instances of NSSet cannot be pickled
In-place operators are not implemented, which means that aSet |= value will assign a new object to aSet (as if you wrote aSet = aSet | value.
This is needed because the bridge cannot know if if aSet is mutable, let alone if aSet is a value that you are allowed to mutate by API contracts.
It is not possible to subclass NSSet and NSMutableSet in the same way as Python's set and frozenset classes because the Cocoa classes are class clusters (which means that all instances of NSSet are actually instances of, non-necessarily public, subclasses.
Sadly enough set([1,2,3]) == NSSet([1, 2, 3]) evaluates to False, even though the values are equivalent. Reversing the order of the test (NSSet([1, 2, 3]) == set([1,2,3])) results in the expected result.
This is caused by the way equality tests for sets are implemented in CPython and is not something that can be fixed in PyObjC.
BUGFIX: accessing methods through anObject.pyobjc_instancMethods is now safer, before this release this could cause unlimited recursion (although I'm not sure if it was possible to trigger this without other changes in this release).
The PyObjC egg now includes the header files that should be used to compile to compile the extensions in the framework wrappers, which makes it a lot easier to access those headers.
BUGFIX: The definition for Py_ARG_SIZE_T was incorrect, which causes problems in 64-bit code.
Initial port to Python 3.x
C-style 'char' characters and 'char*' strings are translated to/from byte strings ('str' in Python 2.x, 'bytes' in Python 3.x). There is no automatic translation from Unicode strings.
Objective-C selector names and encoded type strings are byte strings as well.
NOTE: Python 3 support is pre-alpha at this time: the code compiles but does not pass tests yet. The code also needs to be reviewed to check for python3<->objc integration (dict.keys now returns a view, NSDictionary.keys still returns a basic iterator, ...)
TODO:
Implement new style buffer support when depythonifying an array of C structures.
Documentation updates
The Python 3.x port does not support transparent proxies for 'FILE*' "objects" because the file type in Python3 is not implemented on top of the C library stdio.
The Python 2.x port has been enhanced to accept Unicode strings in more locations.
Implement support for PEP-3118, for both Python 2.x and Python 3.x.
This means that proxying arrays of basic C types to ObjC can now make use of the extended type information provided by the PEP-3118 API.
Furthermore it is possible to use memoryview objects with NSData instances, with the limitation that the memoryview must be cleaned up before the currently active autorelease pool is cleared, or the data instance is resized. That's a result of API restrictions in Apple's frameworks.
The PyObjCTest testsuite now supports version-specific tests: for Python 2.x it will load modules whose name starts with 'test2_' and for Python 3.x those starting with 'test3_'. For both versions it will load test modules whose name starts with 'test_' as well.
Renamed the assertion functions in PyObjCTools.TestSupport, added assertFoo methods and deprecated the failIfFoo and failUnlessFoo methods (similarly to what's happening in the stdlib).
Added objc.propertiesForClass. This function returns information about properties for a class from the Objective-C runtime. The information does not include information about properties in superclasses.
Added objc.object_property. This is class behaves similarly to property, but integrates better with Objective-C code and APIs like Key-Value Observation.
Added objc.array_property. This is similar to objc.object_property, but models a list-like object and implements the right Objective-C interfaces for Key-Value Coding/Observations.
Added objc.set_property. This is similar to objc.object_property, but models a set-like object and implements the right Objective-C interfaces for Key-Value Coding/Observations.
Added objc.dict_property. This is similar to objc.object_property, but models a dict-like object and implements the right Objective-C interfaces for Key-Value Coding/Observations.
NOTE: The interfaces of array_property, set_property and dict_property are minimal w.r.t. options for tweaking their behaviour. That will change in future versions of PyObjC.
Please let us know which hooks would be useful.
The documentation is now written using Sphinx.
NOTE: This is an operation in progress, the documentation needs work to be truly useful.
The (undocument) module PyObjCTools.DistUtilsSupport is no longer present.
Converting a negative value to an unsigned integer now causes a deprecation warning, this will be a hard error once I update all framework wrapper metadata.
They must be specified both in method implementations and method calls. In PyObjC 2.0 they were optional, but raised a deprecation warning, for backwa…
BUGFIX: Ensure PyObjC compiles cleanly with Python 2.6.4.
BUGFIX: It is now possible to explicitly define __getitem__ (and other special methods) if your class implements objectForKey::
class MyObject (NSObject):
def objectForKey_(self, k):
pass
def __getitem__(self, k):
pass
In previous version of PyObjC the implementation of __getitem__ would silently be replaced by a generic one.
The default value for the __useKVO__ attribute in class definitions can now be controlled by objc.setUseKVOForSetattr(b). The default is True.
Note: in previous versions the default was False.
Note2: the __useKVO__ attribute is an implementation detail and should not be used in normal code.
This change fixes an issue where KVO failed to detect some changes when those changes were done in Python using attribute access syntax.
Wrappers for objc_sync_wait, objc_sync_notify and objc_sync_notifyAll have been removed. These have never been part of the public API and this should therefore not affect existing code.
BUGFIX: There was a refcount leak in the code that proxies native code to Python. This causes refcount leaks in user code when a Python class is instantiated from native code, when that class has an initializer written in Python.
Thanks to Dirk Stoop of Made by Sofa for providing the bugreport that helped fix this issue.
objc.recycleAutoreleasePool is now a no-op when a python bundle is loaded in an Objective-C program and the PyObjC's global release pool gets drained by an outer release pool. This should not affect user programs.
BUGFIX: Storing pure python objects in a NSKeyedArchiver archive didn't full work for all tuples, especially self-recursive tuples.
The current support for archiving Python objects passes all pickle unittests in Python 2.7.
BUGFIX: +new is supposed to return an already retained object (that is, the caller owns a reference). Until now PyObjC has assumed that the return value of +new is an autoreleased value. The same is true for all class methods whose name starts with new.
There is initial support for Objective-C blocks, based on the implementation description in the clang repository. Blocks are represented in Python as callable objects. This means you can pass an arbitrary callable when an Objective-C argument is a block, and that when your method accepts a block it will get passed a callable object.
There are some limitations on the usage of blocks due to lack of introspection in the current implementation of blocks. This has two side-effects:
There must be metadata to describe the signature of blocks in PyObjC's metadata XML files.
Block metadata is not retained when a block is stored in an ObjC datastructure, such as an NSArray, and there are no direct references to the block from Python.
objc.inject is no longer support. This was code that had no real relation to the rest of PyObjC and was only working in 32-bit mode with little reason to expect that it would ever be ported to 64-bit mode.
Move the testsuite from objc.test to PyObjCTest and no longer install the tests.
The tests are no longer installed because they aren't needed for day-to-day usage of PyObjC. Furthermore this change will make it possible to copy all of the pyobjc-core "egg" into an application bundle without adding unnecessary files to that bundle.
BUGFIX: Storing pure python objects in a NSKeydArchiver archive didn't work 100% reliably for Python floats. I've changed the implementation on for encoding floats a little and now floats do get rounddtripped properly.
The side effect of this is that archives written by PyObjC 2.2b2 or later cannot always be read by earlier versions (but PyObjC 2.2b2 can read archives created with earlier versions).
BUGFIX: Enable building from source with the Python.org binary distribution.
BUGFIX: Fix crash when using the animotor proxy feature of CoreAnimation. That is, the following code now works:
Improve handling of non-methods in objc.Category:
The docstring of a category is now ignored
You'll get an explicit error exception when trying to add and ivar to a class
It's now possible to add class attributes in a category:
Fixed support for FSRef and FSSpec structures.
Transparently convert Carbon.File.FSRef and Carbon.File.FSSpec instances to C.
The types objc.FSRef and objc.FSSpec are the native PyObjC representation for FSRef and FSSpec structures.
Added more magic signature heuristics: the delegate selector for sheets is now automatically recognized, removing the need for the decorator AppHelper.didEndSelector (which will stay present for backward compatibility).
FIXME: Do the same thing for objc.accessor. Both are a frequent source for errors.
Added PyObjC.TestSupport. This is an unsupported module containing useful functionality for testing PyObjC itself.
Added free_result attribute to the retval element in metadata files. When this attribute has value 'true' the return value of the C function (or ObjC-method) will be free-ed using the function free(), otherwise the bridge assumes other code is responsible to free the result.
This is to be used for low-level C API's that return a pointer to a dynamically allocated array that is to be free-ed by the caller. One example is the function DHCPClientPreferencesCopyApplicationOptions in the SystemConfiguration framework.
Added objc.context, which is helpful for dealing with "context" arguments as used by several Cocoa APIs. The context argument must be a number in Python, while you'd prefer to pass in an arbitrary object instead. The objc.context registry allows you to get a context integer for an arbitrary Python object, and retrieve that later on.
To get the context integer for a Python object:
ctx = objc.context.register(myValue)
To unregister the object when you no longer need the context integer:
objc.context.unregister(myValue)
To retrieve the Python object given a context integer:
myValue = objc.context.get(ctx)
NOTE: This API is particularly handy when using Key-Value Observing, where the context number should be a unique value to make ensure that KVO usage by the superclass doesn't get confused with your own usage of KVO.
PyObjC can now run in 64-bit mode.
NOTE: 64-bit support is beta quality, that is: all unittests pass, but I haven't tried running real programs yet and hence there might be issues lurking below the surface.
NOTE: 64-bit support does not yet work on PPC due to a bug in libffi which prevents catching Objective-C exceptions.
This requires Leopard (OSX 10.5), earlier version of the OS don't have a 64-bit Objective-C runtime at all. This currently also requires a copy of python that was build with MACOSX_DEPLOYMENT_TARGET=10.5.
Note that class posing (the poseAsClass_ class method) is not supported in 64-bit mode. It is also not possible to create new protocols in 64-bit code. Neither are supported by the 64-bit runtime APIs (that is, it is a restriction in Apple's Objective-C 2.0 runtime).
There now is a custom proxy class for instances of datetime.date and datetime.datetime, which takes away the need to manually convert these instances before using them from Objective-C (such as using an NSDateFormatter)
Objective-C classes that support the NSCopying protocol can now be copied using copy.copy as well.
OC_PythonArray and OC_PythonDictionary now explicitly implement copyWithZone: and mutableCopyWithZone:, copies will now be Python objects instead of regular NSDictionary instances.
Pure Python objects now support the NSCopying protocol.
A new decorator: objc.namedselector for overriding the Objective-C selector. Usage:
A number of new type signature values were added. These are not present in the Objective-C runtime, but are used to more precisely describe the type of some arguments.
The new values are:
_C_UNICHAR: A "UniChar" value in Objective-C
_C_NSBOOL: A "BOOL" value in Objective-C
_C_CHAR_AS_INT: A "char" in Objective-C that is used as a number
_C_CHAR_AS_TEXT: A "char" in Objective-C that is used as a character
PyObjC will automatically translate these values into the correct Objective-C type encoding when communicating with the Objective-C runtime, making this change transparent to anyone but Python users.
NOTE: _C_CHR is of course still supported, with the same semi-schizofrenic behaviour as always.
NOTE2: The non-standard metadata extensions we used before to indicate that a C short is used as a unicode string are no longer supported.
Output arguments are no longer optional. They must be specified both in method implementations and method calls. In PyObjC 2.0 they were optional, but raised a deprecation warning, for backward compatibility with PyObjC 1.x.
The backward compatibility code was removed because it made code more complicated and actually caused some bugs.
In PyObjC 1.x you could redefine an Objective-C class, as long as you redefined it in the same module (such as by reloading a module). That functionality didn't work in PyObjC 2.0 and is now completely removed because the functionality isn't supported by the Objective-C 2.0 runtime.
Adds custom wrappers for some more Python types:
OC_PythonNumber: wraps python numeric types
This is used instead of NSNumber because we might loose information otherwise (such as when using custom subclasses of int).
OC_PythonSet: wraps a python set and is a subclass of NSMutableSet
BUGFIX: OC_PythonEnumerator now actually works.
BUGFIX: using the @throw syntax one can raise arbitrary objects as exceptions (not just instances of NSException) in Objective-C. All instances of NSObject are now converted to Python exceptions, throwing some other object (such as a C++ exception) will still case a fatal error due to an uncaught exception.
(SF Bug: 1741095)
BUGFIX: repr(CoreFoundation.kCFAllocatorUseContext) now works
(SF Bug: 1827746)
BUGFIX: The wrappers for CoreFoundation types no longer create a new type in the Objective-C runtime, that type wasn't used anywhere and was an unwanted side-effect of how CoreFoundation types are wrapped.
BUGFIX: The docstring for newly defined methods is no longer hidden by PyObjC. That is, given this code:
MyObject.doit.__doc__ now evaluates to "do something", in previous versions of PyObjC the docstring was None.
BUGFIX: Fixed calling and implementation methods where one or more of the arguments are defined as arrays, like this:
-(void)fooCallback:(NSRect[4])rects;
There were various issues that caused these to not work correctly in all earlier versions of PyObjC (which wasn't noticed earlier because Apple's frameworks don't use this construction).
BUGFIX: correctly select the native implementation of the compatibility routines for the ObjC 2.0 runtime API when running on 10.5 (when compiled for OSX 10.3 or later).
BUGFIX: fix a number of compatibility routines (ObjC 2.0 runtime API on OSX 10.4 or earlier).
Nothing published for this version
Your coding agent can read these notes before it upgrades. Set up the MCP server →