v8.3
This release contains a lot of small fixes dueo to the continued improvement
of test coverage for the C code in pyobjc-core.
-
Backward incompatible change:
-[OC_PythonDictionary setObject:value forKey:[NSNull null]]
now sets
key :data:None
in the Python dictionary instead ofNSNull.null()
.This is for consistency with
-[OC_PythonDictionary objectForKey:]
and
other collection classes. Getting and setting key[NSNull null]
now
actually works. -
Backward incompatible change:
-[OC_PythonDictionary removeObjectForKey:]
now raisesNSInvalidArgumentException
instead of Python'sKeyError
for missing keys. This matches the documented
behaviour ofNSDictionary
. -
Backward incompatible change:
-[Protocol descriptionForClassMethod:]
now only accepts selector names
(such asb"description"
) as its argument, not instances of
:class:objc.selector
. This matches the behaviour of other methods
with an argument of the C typeSEL
. -
:func"
objc.namedSelector
and :func:objc.typedSelector
now also work when
the decorated function is a :func:classmethod
. -
Fix build problem on macOS 10.14 or earlier
-
The Objective-C proxy for a python :class:
int
is now alwaysOC_PythonNumber
,
in previous versions instances were proxied asNSNumber
when the
value was in the range of anunsigned long long
that's outside of the
range of a (signed)long long
(that is, a value between
2**63
and2**64
). -
Two
NSString*
values in Objective-C are now proxied to the
same :class:objc.pyobjc_unicode
instance when the two pointers are
equal in Objective-C.That is, given
NSString* value1
andNSString* value2
value1 == value2
in Objective-C can be replaced by
value1 is value2
in Python. In older versions of PyObjC
this invariant was not maintained, requiring more involved code to
check if two strings represent the same object.This invariant was already maintained for other instances of other
Objective-C classes. -
The proxy for python's :class:
bytearray
(and other writable buffers) now
supports themutableBytes
method in Objective-C.As a side effect of this
OC_PythonData
is now a sublcass of
NSMutableData
instead ofNSData
. -
Fixed retrieving an :class:
bytearray
value from a Cocoa archiveIn previous versions this resulted in garbage data.
-
Instances of :class:
bytearray
can now be included in "secure" Cocoa archives -
Remove
-[OC_PythonArray getObjects:inRange:]
, it is not part of the
regularNSArray
interface and was never used. -
The proxy for python datetime objects was rewritten to be a lot simpler.
User visible changes:
-
The new implementation is more correct, the old implementation truncated
timestamps at whole seconds. -
Calculating in Objective-C (such as calling
-[NSDate dateByAddingTimeInterval:]
will now always result in anNSDate
value, not a Python value. -
The proxy code now calls the "timestamp" method instead of "strftime" during
conversion from Python to Objective-C.
-
-
Adding :class:
datetime.datetime
and :class:datetime.date
instances to an
archive now works, both for keyed and classic archives.For the exact types :class:
datetime.datetime
and :class:datetime.date
the encoding
is compatible with that ofNSDate
and supportsNSSecureCoding
as long as the
values are not timezone aware.When communicating with pure Objective-C code any timezone information will be lost.
Note that both :class:
datetime.datetime
and :class:datetime.date
are
represented as anNSDate
in Objective-C land, even though this Objective-C has
semantics of the latter class don't fully match that of the Cocoa class. -
Fix python internal error when the "module_globals" argument to
:func:objc.loadBundleFunctions
is not a :class:dict
. -
Fix the result of :func:
inspect.signature
for :class:objc.IMP
.In previous versions this included the implicit "selector" argument that isn't used
by Python callers. -
Avoid crash when trying to load a "magic" cookie CoreFoundation value for a
type unknown to the PyObjC bridge. -
Removed
-[OC_PythonObject pyObject]
.The method is no longer used by PyObjC itself, and these proxy objects are considered
a private API that may change at any time. -
Removed
+[OC_PythonObject classForUnarchiver]
This method was present for compatibility with the
NSObject
interface, but isn't
actually part of Cocoa. -
-[OC_PythonObject methodSignatureForSelector:]
and
+[OC_PythonObject methodSignatureForSelector:]
now returnnil
instead of
raising an exception when the queried selector does not exist. This matches
the behaviour ofNSObject
. -
Fix the metadata in the bindings for DiscRecording, Intents, SceneKit, and libdispatch
to ensure that the__all__
variable actually works. -
Eliminated usage of sscanf in pyobjc-core
A possible user visible change is that the use of sscanf
to parse an IPv4 address has been replaced by a call
toinet_pton()
, which may affect different representations
of an IPv4 address. -
OC_PythonSet
now epxlictly calls set related methods instead
of using C-API functions like :func:PySet_Clear
. This simplifies
the pyobjc-core code, and gives fewer problems with set subclasses. -
Fix the buffer size used to for "struct sockaddr" arguments
-
Added
objc._C_CFRange
andobjc._C_NSRange
with the type
encodings of the C typesCFRange
andNSRange
. -
Functions and methods where the length of a C array argument is passed
in another argument (such asint function(int* buffer, size_t bufsize)
)
now also work when the argument with the size is a pointer to
aCFRange
or a pointer to achar
. -
A :class:
memoryview
of anNSMutableData
instance is now writable. -
Fix crash when trying to create an :class:
objc.informal_protocol
with
a sequence of selectors that contains a value that isn't an instance
of :class:objc.selector
. -
#435: Fix build problem with Xcode 13.3
Xcode 13.3 introduces a new warning in
-Wall
:-Wunused-but-set-variable
,
and this found some code quality issues with PyObjC.