[Checkins] [zopefoundation/zope.interface] 024f64: Use C3 (mostly) to compute IRO.

Jason Madden noreply at github.com
Tue Mar 17 11:22:12 CET 2020


  Branch: refs/heads/master
  Home:   https://github.com/zopefoundation/zope.interface
  Commit: 024f6432270afd021da2d9fff5c3f496f788e54d
      https://github.com/zopefoundation/zope.interface/commit/024f6432270afd021da2d9fff5c3f496f788e54d
  Author: Jason Madden <jamadden at gmail.com>
  Date:   2020-03-15 (Sun, 15 Mar 2020)

  Changed paths:
    M CHANGES.rst
    M appveyor.yml
    M docs/api/declarations.rst
    M docs/api/index.rst
    A docs/api/ro.rst
    M docs/verify.rst
    M setup.py
    M src/zope/interface/__init__.py
    M src/zope/interface/common/__init__.py
    M src/zope/interface/common/builtins.py
    M src/zope/interface/common/collections.py
    M src/zope/interface/common/mapping.py
    M src/zope/interface/common/tests/__init__.py
    M src/zope/interface/common/tests/test_collections.py
    M src/zope/interface/declarations.py
    M src/zope/interface/interface.py
    M src/zope/interface/interfaces.py
    M src/zope/interface/registry.py
    M src/zope/interface/ro.py
    M src/zope/interface/tests/test_declarations.py
    M src/zope/interface/tests/test_interface.py
    M src/zope/interface/tests/test_ro.py

  Log Message:
  -----------
  Use C3 (mostly) to compute IRO.

Fixes #21

The 'mostly' is because interfaces are used in cases that C3 forbids;
when there's a conflict, we fallback to the legacy algorithm. It turns
out there are few conflicts (13K out of 149K total orderings in Plone).

I hoped the fix for #8 might shake out automatically, but it didn't.

Optimize the extremely common case of a __bases__ of length one.

In the benchmark, 4/5 of the interfaces and related objects have a base of length one.

Fix the bad IROs in the bundled ABC interfaces, and implement a way to get warnings or errors.

In running plone/buildout.coredev and tracking the RO requests, the
stats for equal, not equal, and inconsistent-so-fallback, I got
{'ros': 148868, 'eq': 138461, 'ne': 10407, 'inconsistent': 12934}

Add the interface module to the Attribute str.

This was extremely helpful tracking down the Plone problem; IDate is defined in multiple modules.


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

  Changed paths:
    M CHANGES.rst
    M appveyor.yml
    M docs/api/declarations.rst
    M docs/api/index.rst
    A docs/api/ro.rst
    M docs/verify.rst
    M setup.py
    M src/zope/interface/__init__.py
    M src/zope/interface/common/__init__.py
    M src/zope/interface/common/builtins.py
    M src/zope/interface/common/collections.py
    M src/zope/interface/common/mapping.py
    M src/zope/interface/common/tests/__init__.py
    M src/zope/interface/common/tests/test_collections.py
    M src/zope/interface/declarations.py
    M src/zope/interface/interface.py
    M src/zope/interface/interfaces.py
    M src/zope/interface/registry.py
    M src/zope/interface/ro.py
    M src/zope/interface/tests/test_declarations.py
    M src/zope/interface/tests/test_interface.py
    M src/zope/interface/tests/test_ro.py

  Log Message:
  -----------
  Merge pull request #182 from zopefoundation/issue21

Use C3 (mostly) to compute IRO.


Compare: https://github.com/zopefoundation/zope.interface/compare/7d638c3b1492...d0c6a5967af0


More information about the checkins mailing list