[Checkins] [zopefoundation/zope.interface] 0fc414: Additional crash-safety for adapter lookup.

Jason Madden noreply at github.com
Mon Mar 9 16:32:56 CET 2020


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

  Changed paths:
    M CHANGES.rst
    M src/zope/interface/_zope_interface_coptimizations.c
    M src/zope/interface/declarations.py
    M src/zope/interface/interface.py
    M src/zope/interface/tests/test_declarations.py
    M src/zope/interface/tests/test_registry.py

  Log Message:
  -----------
  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