[Checkins] [zopefoundation/zope.interface] 1e720c: Make provided/implementedBy and adapter registries...

Jason Madden noreply at github.com
Mon Mar 9 18:51:57 CET 2020


  Branch: refs/heads/issue11
  Home:   https://github.com/zopefoundation/zope.interface
  Commit: 1e720c3819b8daa07aaad0ee0258d9035597f27d
      https://github.com/zopefoundation/zope.interface/commit/1e720c3819b8daa07aaad0ee0258d9035597f27d
  Author: Jason Madden <jamadden at gmail.com>
  Date:   2020-03-09 (Mon, 09 Mar 2020)

  Changed paths:
    M .travis.yml
    M CHANGES.rst
    M docs/adapter.rst
    M docs/conf.py
    M setup.py
    M src/zope/interface/_zope_interface_coptimizations.c
    M src/zope/interface/adapter.py
    M src/zope/interface/declarations.py
    M src/zope/interface/tests/test_declarations.py
    M src/zope/interface/tests/test_registry.py

  Log Message:
  -----------
  Make provided/implementedBy and adapter registries respect super().

The query functions now start by looking at the next class in the MRO (interfaces directly provided by the underlying object are not found).

Adapter registries automatically pick up providedBy change to start finding the correct implementations of adapters, but to make that really useful they needed to change to unpack super() arguments and pass __self__ to the factory.

Fixes #11

Unfortunately, this makes PyPy unable to build the C extensions.

Additional crash-safety for adapter lookup.

Make the C functions get the cache only after resolving the
``required`` into a tuple, in case of side-effects like...clearing the
cache. This could lead to the ``cache`` object being deallocated
before we used it.

Drop the ``tuplefy`` function in favor of a direct call to
``PySequence_Tuple``. It's what the ``tuple`` constructor would do
anyway and saves a few steps.

Make sure that getting ``providedBy(super())`` and
``implementedBy(super())`` have no side effects.




More information about the checkins mailing list