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

Jason Madden noreply at github.com
Tue Mar 10 12:16:48 CET 2020


  Branch: refs/heads/master
  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.


  Commit: 364fd0caf88d8b8a12ca81a0ab80b039cdc9f6c9
      https://github.com/zopefoundation/zope.interface/commit/364fd0caf88d8b8a12ca81a0ab80b039cdc9f6c9
  Author: Jason Madden <jamadden at gmail.com>
  Date:   2020-03-10 (Tue, 10 Mar 2020)

  Changed paths:
    M src/zope/interface/_zope_interface_coptimizations.c

  Log Message:
  -----------
  Remove unused str variables

The DEFINE_STRING macro prevents the linter from seeing them as unused
so I temporarily redefined it to find all such variables.


  Commit: fb8180d4521dc7333498731d1361a82d0034582b
      https://github.com/zopefoundation/zope.interface/commit/fb8180d4521dc7333498731d1361a82d0034582b
  Author: Jason Madden <jamadden at gmail.com>
  Date:   2020-03-10 (Tue, 10 Mar 2020)

  Changed paths:
    M src/zope/interface/tests/test_adapter.py

  Log Message:
  -----------
  Add additional low-level tests for super() unwrapping.


  Commit: 354faccebd5b612a2ac8e081a7e5d2f7fb1089c1
      https://github.com/zopefoundation/zope.interface/commit/354faccebd5b612a2ac8e081a7e5d2f7fb1089c1
  Author: Jason Madden <jamadden at gmail.com>
  Date:   2020-03-10 (Tue, 10 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_adapter.py
    M src/zope/interface/tests/test_declarations.py
    M src/zope/interface/tests/test_registry.py

  Log Message:
  -----------
  Merge pull request #181 from zopefoundation/issue11

Make provided/implementedBy and adapter registries respect super().


Compare: https://github.com/zopefoundation/zope.interface/compare/4afc5ec8ac8f...354faccebd5b


More information about the checkins mailing list