Skip to content

v8.3

Compare
Choose a tag to compare
@ronaldoussoren ronaldoussoren released this 24 Feb 23:09
· 594 commits to master since this release

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 of NSNull.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 raises NSInvalidArgumentException
    instead of Python's KeyError for missing keys. This matches the documented
    behaviour of NSDictionary.

  • Backward incompatible change:

    -[Protocol descriptionForClassMethod:] now only accepts selector names
    (such as b"description") as its argument, not instances of
    :class:objc.selector. This matches the behaviour of other methods
    with an argument of the C type SEL.

  • :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 always OC_PythonNumber,
    in previous versions instances were proxied as NSNumber when the
    value was in the range of an unsigned long long that's outside of the
    range of a (signed) long long (that is, a value between
    2**63 and 2**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 and NSString* 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 the mutableBytes method in Objective-C.

    As a side effect of this OC_PythonData is now a sublcass of
    NSMutableData instead of NSData.

  • Fixed retrieving an :class:bytearray value from a Cocoa archive

    In 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
    regular NSArray 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 an NSDate 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 of NSDate and supports NSSecureCoding 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 an NSDate 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 return nil instead of
    raising an exception when the queried selector does not exist. This matches
    the behaviour of NSObject.

  • 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
    to inet_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 and objc._C_NSRange with the type
    encodings of the C types CFRange and NSRange.

  • Functions and methods where the length of a C array argument is passed
    in another argument (such as int function(int* buffer, size_t bufsize))
    now also work when the argument with the size is a pointer to
    a CFRange or a pointer to a char.

  • A :class:memoryview of an NSMutableData 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.