Skip to content

Releases: ronaldoussoren/pyobjc

v3.0.1

29 Feb 09:31
Compare
Choose a tag to compare
  • 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.

v3.0

29 Feb 09:33
Compare
Choose a tag to compare
  • Issue #50: Accessing Objective-C methods on "magic cookie" variables,
    like LaunchServices.kLSSharedFileListItemLast would crash the interpreter.

    This affected code like::

    from LaunchServices import kLSSharedFileListItemLast
    
    kLSSharedFileListItemLast == kLSSharedFileListItemLast
    dir(kLSSharedFileListItemLast)
    kLSSharedFileListItemLast.compare_
    
  • Added a decorator "python_method" than can be used to decorate methods that should
    not be registered with the Objective-C runtime and should not be converted to a
    Objective-C selector.

    Usage::

    class MyClass (NSObject):
    
        @python_method
        @classmethod
        def fromkeys(self, keys):
            pass
    

    This makes it easier to add a more "pythonic" API to Objective-C subclasses without
    being hindered by PyObjC's conventions for naming methods.

  • Issue #64: Fix metadata for Quartz.CGEventKeyboardSetUnicodeString
    and Quartz.CGEventKeyboardGetUnicodeString.

  • Issue #77: Passing a bound selector as a block argument failed when the block
    was actually called because the trampoline that calls back to Python accidently
    ignored the bound self argument.

  • Issue #76: It is now possible to pass None to a method expecting a block
    argument, as with normal object arguments the Objective-C method receives
    a nil value.

  • Python integer values with values between 2 ** 63 and 2**64 are now proxied
    as plain NSNumber objects, not as using PyObjC specific subclass of NSNumber,
    to avoid a problem with writing them to binary plist files.

    This is a workaround and will likely be changed in some future version.

  • inspect.signature works for all functions and methods implemented in C,
    when using Python 3.4 or later.

  • The module PyObjCTools.NibClassBuilder is not longer available. It only worked
    with ancient versions of Interface Builder (pre-Xcode)

  • The wrapper type for opaque pointers didn't have a "module" attribute,
    which breaks code that (correctly) assumes that all types have such an attribute.

  • Archiving now supports nested definitions and method references, simular
    to the support of those added to pickle protocol 4 in Python 3.4.

    Encoding nested classes requires support for the __qualname__ attribute,
    and hence requires Python 3.3. Decoding should work with earlier python
    versions as well.

  • Addd objc.autorelease_pool, a context manager for managing an
    autorelease pool. Usage::

     with objc.autorelease_pool():
        pass
    

    This is equivalent to::

     _pool = NSAutoreleasePool.alloc().init()
     try:
         pass
    
     finally:
         del _pool
    
  • Added objc.registerABCForClass to make it possible to register
    a class with a number of ABC classes when the class becomes available.

  • NSDecimalNumber can now be instantatiated as a normal Python object::

    value = NSDecimalNumber(4)

  • NSData and NSMutableData can now be instantiated as a normal
    Python object::

    value = NSData(someBytes)
    

    or::

    value = NSData()
    
  • NSDecimal now coerces the other value to NSDecimal in coercions.
    Because of you can now order instances of NSDecimal and int.

  • PyObjCTools.KeyValueCoding.ArrayOperators and
    PyObjCTools.KeyValueCoding.arrayOperators were accidently public
    names in previous releases, and are now removed. Use the array operators
    in the KVC protocol instead.

  • Restructured the "convenience" method code. This shouldn't have user
    visible effects, but makes the code easier to maintain.

  • objc.addConvienceForSelector no longer exists, it isn't possible
    to provide this functionality with the current implementation of the
    bridge.

  • The build of pyobjc-core can now be configured by editing setup.cfg (or
    providing arguments to the build_ext command), instead of editing the
    setup.py file.

    Currently the following options are availabel for the build_ext command:

    • --use-system-libffi: When this option is used the build will use
      /usr/lib/libffi.dylib instead of the embedded copy of libffi. The latter
      is the default is and is better tested.

    • --deployment-target=VAL: The value of MACOSX_DEPLOYMENT_TARGET to use,
      defaults to the deployment target used for building Python itself

    • --sdk-root=VAL: Path to the SDK root used to build PyObjC, or "python" to
      use the default SDK selected by distutils. The default is to use the
      most recent SDK available.

  • The lazy importer has smarter calculation of the __all__ attribute,
    which should speed up 'from Cocoa import *'.

  • BUGFIX: using a method definition with only *args and **kwds used
    to crash the interpreter, the now once again raise a TypeError exception.

  • The metadata for pyobjc-framework-Accounts was incomplete, fixed that.

  • :func:objc.callbackFor now also adds a metadata method to decorated
    functions. This is primarily to make it easier to test the metadata values.

  • The typestr attribute of opaque pointer types is now a byte string,
    in previous versions this was an instance of :class:str (this only affects
    Python 3 support)

  • The JavaScriptCore bindings (in pyobjc-framework-WebKit) are now more usable
    because types like "JSValueRef" are now exposed to Python (they were missing
    due to incomplete metadata).

  • Exclude a number of keys from the metadata dictionary when they have the
    default value (in the result from the metadata() method on methods
    and functions)

  • The "lazy" modules used by framework wrappers now always have a __loader__
    attribute (as required by PEP 302). The value can be :data:None when there
    is no explicit loader (such as when importing from the filesystem in Python 3.2
    or earlier).

  • Method (and function) metadata is stored in a more compact manner, reducing the
    memory use of PyObjC applications.

  • Removed support for hiding "protected" methods, :func:objc.setHideProtected is gone,
    it complicated the code without real advantages.

    Reasons for this:

    • There were some conflicts because a class implemented two selectors that caused
      the same python method to be added to the class dict. Which one was added
      was basicly random.

    • The functionality required PyObjC to maintain a full dict for classes, even
      when most Cocoa methods were never called. Ensuring that the contents of dict
      is correct in the face of Objective-C categories and class patches required some
      very expensive code.

    As a side effect of this some classes may no longer have the convenience methods they
    had in earlier releases (in particular classes that are not mentioned in Apple's
    documentation).

  • Issue #3: The bridge now lazily looks for Objective-C methods as they are used from Python, instead
    of trying to maintain a class dict that mirrors the method list of the Objective-C
    class.

    Maintaining the dict was very expensive, on every method call the bridge would
    check if the method list had changed and there is no cheap way to perform that check.

    .. note::
    I haven't done performance tests at this time, it is not yet clear if this work will
    make the bridge more efficient or that there are other more important bottlenecks.

  • The default translation from a python name to a selector was slightly changed:

    • double underscores inside the name are no translated to colons, that is 'foo__bar_' is translated to 'foo__bar:', not 'foo::bar:'

    • if the Python name start with two uppercase letters and an underscore, that first underscore is not translated into
      an colon. Two leading capitals are often used as a way to add some kind of namespacing
      to selector names (and avoid conflicts when a method with the same name is added later by the library provider)

  • Added new method to NSString, it is now possible to explictly convert a python string to a Cocoa
    string with NSString(someString)

  • Added eq and ne methods to native selector objects, which mean you can now
    check if two method objects are the same using 'sel1 == sel2'. This works both for bound
    and unbound selectors.

  • NSData.bytes() could raise an exception on some version of Python 3 when the data object is empty.
    The function now returns an empty bytes object instead.

  • NSMutableData.mutableBytes() raises an exception when the data object has a 0-sized buffer.
    (see also the previous bullet)

  • Add attribute objclass to :class:objc.selector instances as an alias for definingClass. The name
    objclass is used by builtin method objects for the same purpose as definingClass.

    The new attribute is needed to ensure that help(NSObject) works (although all methods are shown as
    data descriptors, not methods)

  • :classobjc.selector no longer implements set, which means it is now classified as a method
    descriptor by the :mod:inspec module, which gives nicer output in :mod:pydoc.

    This doesn't change any functionality beyond that, it is still possible to overwrite methods and not
    possible to delete them.

  • :class:objc.native_selector and :class:objc.function now have a (minimal) docstring with information
    object. This makes :func:help <pydoc.help> for Cocoa classes and functions more useful.

    As a side-effect of this the docstring is no longer writeable.

    .. note::

    The docstring show the interface of a block with a function prototype instead of the proper
    C declaration, that makes the implementation slightly easier and the function prototype syntax
    is slightly easier to read for users that aren't C experts.

  • :class:`objc.sele...

Read more