Releases: beeware/rubicon-objc
0.4.5rc1
Due to an incompatibility with Toga 0.3.0dev39, Rubicon-ObjC 0.4.4 was yanked from PyPI. This RC1 release was published so that development versions of Toga could access the bug fixes contained in that release.
Features
- Support for Python 3.6 was dropped. (#371)
Misc
v0.4.4
Due to an incompatibility with Toga 0.3.0dev39, Rubicon-ObjC 0.4.4 was yanked from PyPI.
Bugfixes
- Background threads will no longer lock up on iOS when an asyncio event loop is in use. (#228)
- The ObjCInstance cache no longer returns a stale wrapper objects if a memory address is re-used by the Objective C runtime. (#249)
- It is now safe to open an asyncio event loop on a secondary thread. Previously this would work, but would intermittently fail with a segfault when then loop was closed. (#250)
- A potential race condition that would lead to duplicated creation on ObjCInstance wrapper objects has been resolved. (#251)
- A race condition associated with populating the ObjCClass method/property cache has been resolved. (#252)
Misc
v0.4.3
v0.4.2
v0.4.1
Features
-
Added official support for Python 3.9. (#193)
-
Added official support for macOS 11 (Big Sur). (#195)
-
Autorelease Objective-C instances when the corresponding Python instance is destroyed. (#200)
-
Improved memory management when a Python instance is assigned to a new
ObjCInstanceattribute. (#209) -
Added support to declare weak properties on custom Objective-C classes. (#210)
Bugfixes
-
Fixed incorrect behavior of
Blockwhen trying to create a block with no arguments and using explicit types. This previously caused an incorrect exception about missing argument types; now a no-arg block is created as expected. (#153) -
Fixed handling of type annotations when passing a bound Python method into
Block. (#153) -
A cooperative entry point for starting event loop has been added. This corrects a problem seen when using Python 3.8 on iOS. (#182)
-
Improved performance of Objective-C method calls and
ObjCInstancecreation in many cases. (#183) -
Fix calling of signal handlers added to the asyncio loop with CFRunLoop integration. (#202)
-
Allow restarting a stopped event loop. (#205)
Deprecations and Removals
-
Removed automatic conversion of Objective-C numbers (
NSNumberandNSDecimalNumber) to Python numbers when received from Objective-C (i.e. returned from an Objective-C method or property or passed into an Objective-C method implemented in Python). This automatic conversion significantly slowed down every Objective-C method call that returns an object, even though the conversion doesn't apply to most method calls. If you have code that receives an Objective-C number and needs to use it as a Python number, please convert it explicitly usingpy_from_nsor an appropriate Objective-C method.As a side effect,
NSNumberandNSDecimalNumbervalues stored in Objective-C collections (NSArray,NSDictionary) are also no longer automatically unwrapped when retrieved from the collection, even when using Python syntax to access the collection. For example, ifarris aNSArrayof integerNSNumber,arr[0]now returns an Objective-CNSNumberand not a Pythonintas before. If you need the contents of an Objective-C collection as Python values, you can usepy_from_nsto convert either single values (e.g.py_from_ns(arr[0])) or the entire collection (e.g.py_from_ns(arr)). (#183) -
Removed macOS 10.12 through 10.14 from our automatic test matrix, due to pricing changes in one of our CI services (Travis CI). OS X 10.11 is still included in the test matrix for now, but will probably be removed relatively soon. Automatic tests on macOS 10.15 and 11.0 are unaffected as they run on a different CI service (GitHub Actions).
Rubicon will continue to support macOS 10.14 and earlier on a best-effort basis, even though compatibility is no longer tested automatically. If you encounter any bugs or other problems with Rubicon on these older macOS versions, please report them! (#197)
Misc
v0.4.0
Features
- Added macOS 10.15 (Catalina) to the test matrix. #145
- Added
517and518build system metadata to pyproject.toml. #156 - Added official support for Python 3.8. #162
- Added a
varargskeyword argument to send_message` to allow calling variadic methods more safely. #174 - Changed
ObjCMethodto call methods using send_messageinstead of calling IMPs directly. This is mainly an internal change and should not affect most existing code, although it may improve compatibility with Objective-C code that makes heavy use of runtime reflection and method manipulation (such as swizzling). #177
Bugfixes
- Fixed Objective-C method calls in "flat" syntax accepting more arguments than the method has. The extra arguments were previously silently ignored. An exception is now raised if too many arguments are passed. #123
- Fixed
ObjCInstance.__str__ <rubicon.objc.api.ObjCInstance.__str__>throwing an exception if the object's Objective-Cdescriptionisnil. #125 - Corrected a slow memory leak caused every time an asyncio timed event handler triggered. #146
- Fixed various minor issues in the build and packaging metadata. #156
- Removed unit test that attempted to pass a struct with bit fields into a C function by value. Although this has worked in the past on x86 and x86_64,
ctypesnever officially supported this, and started generating an error in Python 3.7.6 and 3.8.1 (see bpo-39295). #157 - Corrected the invocation of
NSApplication.terminate()when the CocoaLifecycle` is ended. #170 - Fixed send_message
not accepting SELobjects for theselectorparameter. The documentation stated that this is allowed, but actually doing so caused a type error. #177
Improved Documentation
- Added detailed
reference documentation </reference/index>for all public APIs ofrubicon.objc. #118 - Added a
how-to guide for calling regular C functions </how-to/c-functions>usingctypesandrubicon.objc. #147
Deprecations and Removals
- Removed the i386 architecture from the test matrix. It is still supported on a best-effort basis, but compatibility is not tested automatically. #139
- Tightened the API of send_message
, removing some previously allowed shortcuts and features that were rarely used, or likely to be used by accident in an unsafe way. In most cases, Rubicon's high-level method call syntax provided by ObjCInstancecan be used instead of send_message. This syntax is almost always more convenient to use, more readable and less error-prone. send_messageshould only be used in cases not supported by the high-level syntax. - Disallowed passing class names as
str/bytesas thereceiverargument of send_message. If you need to send a message to a class object (i. e. call a class method), use ObjCClassor get_classto look up the class, and pass the resulting ObjCClassor Class` object as the receiver. - Disallowed passing
~ctypes.c_void_pobjects as thereceiverargument of send_message. Thereceiverargument now has to be of type objc_id, or one of its subclasses (such as Class), or one of its high-level equivalents (such as ObjCInstance). All Objective-C objects returned by Rubicon's high-level and low-level APIs have one of these types. If you need to send a message to an object pointer stored as~ctypes.c_void_p,~ctypes.castit to objc_id` first. - Removed default values for send_message
'srestypeandargtypeskeyword arguments. Every send_messagecall now needs to have its return and argument types set explicitly. This ensures that all arguments and the return value are converted correctly between (Objective-)C and Python. - Disallowed passing more argument values than there are argument types in
argtypes. This was previously allowed to support calling variadic methods - any arguments beyond the types set inargtypeswould be passed as varargs. However, this feature was easy to misuse by accident, as it allowed passing extra arguments to any method, even though most Objective-C methods are not variadic. Extra arguments passed this way were silently ignored without causing an error or a crash. To prevent accidentally passing too many arguments like this, the number of arguments now has to exactly match the number ofargtypes. Variadic methods can still be called, but the varargs now need to be passed as a list into the separatevarargskeyword arugment. #174 - Removed the
rubicon.objc.core_foundationmodule. This was an internal module with few remaining contents and should not have any external uses. If you need to call Core Foundation functions in your code, please load the framework yourself usingload_library('CoreFoundation')and define the types and functions that you need. #175 - Removed the
ObjCMethodclass from the public API, as there was no good way to use it from external code. #177