Commit Graph

167 Commits

Author SHA1 Message Date
Jens Vagelpohl 946e0370a8
- prepare release 5.5.2 2022-11-17 15:25:14 +01:00
Jens Vagelpohl eb1af6e38b
- Add support for building arm64 wheels on macOS. 2022-11-13 11:34:59 +01:00
Jens Vagelpohl 50773ad042
- vb [ci skip] 2022-11-03 14:22:27 +01:00
Jens Vagelpohl d672d91c62
- prepare release 5.5.1 2022-11-03 13:50:45 +01:00
Jens Vagelpohl 391db8a4c4
- update to the latest meta/config and declare Python 3.11 support 2022-11-02 11:09:27 +01:00
Michael Howitz d65b9977fc Back to development: 5.5.1 2022-10-10 08:41:58 +02:00
Michael Howitz 32815ddb3c Preparing release 5.5.0 2022-10-10 08:41:33 +02:00
Michael Howitz 009c381866 Update to current meta/config. 2022-09-16 09:01:50 +02:00
Marius Gedminas 24bd6eefae Update changelog 2022-09-12 10:23:41 +03:00
Michael Howitz a07c82b781 Update to Python 3.11.0b4. 2022-08-03 08:44:34 +02:00
Michael Howitz fc36cf4f86 Fix PyPy2 run on GHA. 2022-07-07 09:06:38 +02:00
Michael Howitz 5f8e2e0410
Add support for Python 3.11. (#253)
* Add support for Python 3.11.
* Do not use the binary version of coverage as it has a Python 3.11 wheel on PyPI which is not ABI compatible with the current alpha release and caused segfaults.
* Do not push wheels of Python future releases to PyPI.
2022-01-28 08:22:00 +01:00
Kian-Meng Ang 7128155b28
Fix typos (#251)
Co-authored-by: Michael Howitz <mh@gocept.com>
2022-01-25 08:12:30 +01:00
Michael Howitz 67a4f6f7f2
Add support for Python 3.10 (#250)
* Fix tests on Python 3.10.
* "Fix" a test broken just on windows + allow to use posargs for tox test runs.
* Checking array.array non-strictly did not help on Windows. – So ignore it completely.
2022-01-24 13:03:51 +01:00
Colin Watson e9eb5850ef Add some more entries to zope.interface.interfaces.__all__
`ComponentLookupError`, `Invalid`, `Registered`, and `Unregistered` are
all documented
(https://zopeinterface.readthedocs.io/en/latest/api/components.html), so
it seems odd not to list them in `__all__`.  `ObjectEvent` isn't
documented there, but it seems reasonable to export it as a base class
for similar events.
2021-09-02 10:45:32 +01:00
Michael Howitz d18b5478f4
Configure with meta/config. (#243)
* Add support for Python 3.9.
* Improve coverage.
2021-06-02 14:35:12 +02:00
Jason Madden 7928bb3374
Back to development: 5.4.1 2021-04-15 04:55:23 -05:00
Jason Madden 324ba685da
Preparing release 5.4.0 2021-04-15 04:53:40 -05:00
Jason Madden 24b6a016bf
Merge pull request #240 from zopefoundation/issue239
Make C's __providedBy__ stop ignoring all errors and catch only AttributeError
2021-04-15 04:50:36 -05:00
Jason Madden 8a0a8f1dea
Make C's __providedBy__ stop ignoring all errors and catch only AttributeError.
Fixes #239

There was a similar bug in the Python side where it would ignore a __provides__ of None, unlike the C implementation.
I documented this in the code but not the CHANGES.rst because I can't imagine anyone relying on that.
2021-04-13 16:47:53 -05:00
Jason Madden eb542a8a75
Make Declaration.__add__ try harder to produce consistent resolution orders.
By moving things from the RHS to the front of the list if they already extend something from the LHS.

Fixes #193
2021-04-01 07:11:26 -05:00
Jason Madden ce8f66f8bf
Update repr() and str() of some common objects.
Only InterfaceClass got a str, so it now has a distinction. Other objects only got updated reprs.

Note: This may potentially break some doctests.

In many cases, the ``repr()`` is now something that can be evaluated
to produce an equal object. For example, what was previously printed
as ``<implementedBy builtins.list>`` is now shown as
``classImplements(list, IMutableSequence, IIterable)``.

Fixes #236

Here's a before with ZOPE_INTERFACE_LOG_CHANGED_IRO=1 in BTrees:
```
Object <implementedBy builtins.list> has different legacy and C3 MROs:
  Legacy RO (len=11)                                                        C3 RO (len=11; inconsistent=no)
  ==================================================================================================================================================
    <implementedBy builtins.list>                                             <implementedBy builtins.list>
    <ABCInterfaceClass zope.interface.common.collections.IMutableSequence>    <ABCInterfaceClass zope.interface.common.collections.IMutableSequence>
    <ABCInterfaceClass zope.interface.common.collections.ISequence>           <ABCInterfaceClass zope.interface.common.collections.ISequence>
    <ABCInterfaceClass zope.interface.common.collections.IReversible>         <ABCInterfaceClass zope.interface.common.collections.IReversible>
    <ABCInterfaceClass zope.interface.common.collections.ICollection>         <ABCInterfaceClass zope.interface.common.collections.ICollection>
    <ABCInterfaceClass zope.interface.common.collections.ISized>              <ABCInterfaceClass zope.interface.common.collections.ISized>
                                                                            + <ABCInterfaceClass zope.interface.common.collections.IIterable>
    <ABCInterfaceClass zope.interface.common.collections.IContainer>          <ABCInterfaceClass zope.interface.common.collections.IContainer>
  - <ABCInterfaceClass zope.interface.common.collections.IIterable>
    <ABCInterfaceClass zope.interface.common.ABCInterface>                    <ABCInterfaceClass zope.interface.common.ABCInterface>
                                                                            + <implementedBy builtins.object>
    <InterfaceClass zope.interface.Interface>                                 <InterfaceClass zope.interface.Interface>
  - <implementedBy builtins.object>
Object <ABCInterfaceClass zope.interface.common.mapping.IFullMapping> has different legacy and C3 MROs:
  Legacy RO (len=18)                                                       C3 RO (len=18; inconsistent=no)
  ================================================================================================================================================
    <ABCInterfaceClass zope.interface.common.mapping.IFullMapping>           <ABCInterfaceClass zope.interface.common.mapping.IFullMapping>
    <ABCInterfaceClass zope.interface.common.collections.IMutableMapping>    <ABCInterfaceClass zope.interface.common.collections.IMutableMapping>
    <ABCInterfaceClass zope.interface.common.collections.IMapping>           <ABCInterfaceClass zope.interface.common.collections.IMapping>
    <ABCInterfaceClass zope.interface.common.collections.ICollection>        <ABCInterfaceClass zope.interface.common.collections.ICollection>
  - <ABCInterfaceClass zope.interface.common.collections.IIterable>
    <InterfaceClass zope.interface.common.mapping.IExtendedReadMapping>      <InterfaceClass zope.interface.common.mapping.IExtendedReadMapping>
    <InterfaceClass zope.interface.common.mapping.IIterableMapping>          <InterfaceClass zope.interface.common.mapping.IIterableMapping>
    <InterfaceClass zope.interface.common.mapping.IExtendedWriteMapping>     <InterfaceClass zope.interface.common.mapping.IExtendedWriteMapping>
    <InterfaceClass zope.interface.common.mapping.IClonableMapping>          <InterfaceClass zope.interface.common.mapping.IClonableMapping>
    <InterfaceClass zope.interface.common.mapping.IMapping>                  <InterfaceClass zope.interface.common.mapping.IMapping>
    <InterfaceClass zope.interface.common.mapping.IWriteMapping>             <InterfaceClass zope.interface.common.mapping.IWriteMapping>
    <InterfaceClass zope.interface.common.mapping.IEnumerableMapping>        <InterfaceClass zope.interface.common.mapping.IEnumerableMapping>
    <ABCInterfaceClass zope.interface.common.collections.ISized>             <ABCInterfaceClass zope.interface.common.collections.ISized>
                                                                           + <ABCInterfaceClass zope.interface.common.collections.IIterable>
    <InterfaceClass zope.interface.common.mapping.IReadMapping>              <InterfaceClass zope.interface.common.mapping.IReadMapping>
    <ABCInterfaceClass zope.interface.common.collections.IContainer>         <ABCInterfaceClass zope.interface.common.collections.IContainer>
    <ABCInterfaceClass zope.interface.common.ABCInterface>                   <ABCInterfaceClass zope.interface.common.ABCInterface>
    <InterfaceClass zope.interface.common.mapping.IItemMapping>              <InterfaceClass zope.interface.common.mapping.IItemMapping>
    <InterfaceClass zope.interface.Interface>                                <InterfaceClass zope.interface.Interface>
Object <InterfaceClass BTrees.Interfaces.ISet> has different legacy and C3 MROs:
  Legacy RO (len=7)                                  C3 RO (len=7; inconsistent=no)
  ====================================================================================================
    <InterfaceClass BTrees.Interfaces.ISet>            <InterfaceClass BTrees.Interfaces.ISet>
    <InterfaceClass BTrees.Interfaces.IKeySequence>    <InterfaceClass BTrees.Interfaces.IKeySequence>
  - <InterfaceClass BTrees.Interfaces.ISized>
    <InterfaceClass BTrees.Interfaces.ISetMutable>     <InterfaceClass BTrees.Interfaces.ISetMutable>
    <InterfaceClass BTrees.Interfaces.IKeyed>          <InterfaceClass BTrees.Interfaces.IKeyed>
    <InterfaceClass BTrees.Interfaces.ICollection>     <InterfaceClass BTrees.Interfaces.ICollection>
                                                     + <InterfaceClass BTrees.Interfaces.ISized>
    <InterfaceClass zope.interface.Interface>          <InterfaceClass zope.interface.Interface>
```

And here's after:

```
Object classImplements(list, IMutableSequence, IIterable) has different legacy and C3 MROs:
  Legacy RO (len=11)                                    C3 RO (len=11; inconsistent=no)
  ==========================================================================================================
    classImplements(list, IMutableSequence, IIterable)    classImplements(list, IMutableSequence, IIterable)
    zope.interface.common.collections.IMutableSequence    zope.interface.common.collections.IMutableSequence
    zope.interface.common.collections.ISequence           zope.interface.common.collections.ISequence
    zope.interface.common.collections.IReversible         zope.interface.common.collections.IReversible
    zope.interface.common.collections.ICollection         zope.interface.common.collections.ICollection
    zope.interface.common.collections.ISized              zope.interface.common.collections.ISized
                                                        + zope.interface.common.collections.IIterable
    zope.interface.common.collections.IContainer          zope.interface.common.collections.IContainer
  - zope.interface.common.collections.IIterable
    zope.interface.common.ABCInterface                    zope.interface.common.ABCInterface
                                                        + classImplements(object)
    zope.interface.Interface                              zope.interface.Interface
  - classImplements(object)
Object <ABCInterfaceClass zope.interface.common.mapping.IFullMapping> has different legacy and C3 MROs:
  Legacy RO (len=18)                                     C3 RO (len=18; inconsistent=no)
  ============================================================================================================
    zope.interface.common.mapping.IFullMapping             zope.interface.common.mapping.IFullMapping
    zope.interface.common.collections.IMutableMapping      zope.interface.common.collections.IMutableMapping
    zope.interface.common.collections.IMapping             zope.interface.common.collections.IMapping
    zope.interface.common.collections.ICollection          zope.interface.common.collections.ICollection
  - zope.interface.common.collections.IIterable
    zope.interface.common.mapping.IExtendedReadMapping     zope.interface.common.mapping.IExtendedReadMapping
    zope.interface.common.mapping.IIterableMapping         zope.interface.common.mapping.IIterableMapping
    zope.interface.common.mapping.IExtendedWriteMapping    zope.interface.common.mapping.IExtendedWriteMapping
    zope.interface.common.mapping.IClonableMapping         zope.interface.common.mapping.IClonableMapping
    zope.interface.common.mapping.IMapping                 zope.interface.common.mapping.IMapping
    zope.interface.common.mapping.IWriteMapping            zope.interface.common.mapping.IWriteMapping
    zope.interface.common.mapping.IEnumerableMapping       zope.interface.common.mapping.IEnumerableMapping
    zope.interface.common.collections.ISized               zope.interface.common.collections.ISized
                                                         + zope.interface.common.collections.IIterable
    zope.interface.common.mapping.IReadMapping             zope.interface.common.mapping.IReadMapping
    zope.interface.common.collections.IContainer           zope.interface.common.collections.IContainer
    zope.interface.common.ABCInterface                     zope.interface.common.ABCInterface
    zope.interface.common.mapping.IItemMapping             zope.interface.common.mapping.IItemMapping
    zope.interface.Interface                               zope.interface.Interface
Object <InterfaceClass BTrees.Interfaces.ISet> has different legacy and C3 MROs:
  Legacy RO (len=7)                 C3 RO (len=7; inconsistent=no)
  ==================================================================
    BTrees.Interfaces.ISet            BTrees.Interfaces.ISet
    BTrees.Interfaces.IKeySequence    BTrees.Interfaces.IKeySequence
  - BTrees.Interfaces.ISized
    BTrees.Interfaces.ISetMutable     BTrees.Interfaces.ISetMutable
    BTrees.Interfaces.IKeyed          BTrees.Interfaces.IKeyed
    BTrees.Interfaces.ICollection     BTrees.Interfaces.ICollection
                                    + BTrees.Interfaces.ISized
    zope.interface.Interface          zope.interface.Interface
```
2021-03-25 10:30:47 -05:00
Jens Vagelpohl e6d3805c6e
- prepare release 5.3.0 2021-03-21 10:35:24 +01:00
Jason Madden dd0f7b9447
Back to development: 5.3.0a2 2021-03-18 09:11:38 -05:00
Jason Madden cec672fb3f
Preparing release 5.3.0a1 2021-03-18 09:11:13 -05:00
Jason Madden 45c97ab85d
Update documentation and Provides repr for better debugging.
Fixes #229.

Replaces #232
2021-03-18 05:17:52 -05:00
Jason Madden 45b9294e9d
Make Provides and ClassProvides ignore redundant interfaces like @implementer
cf #207
2021-03-17 11:11:19 -05:00
Jason Madden 50c73de0a8
Add IAdapterRegistry.subscribed and Components.rebuildUtilityRegistryFromLocalCache
Fixes #230
2021-03-15 09:43:24 -05:00
Jason Madden 8a8285133b
Let subclasses of BaseAdapterRegistry customize the data structures.
Add extensive tests for this. Fixes #224.

Also adds test for, and fixes #227

Add BAR.rebuild() to fix the refcount issue, and to change datatypes.

It works by using the new methods allRegistrations() and allSubscriptions() to re-create the data in new data structures.

This makes fresh calls to subscribe() and register(). I went this way instead of trying to manually walk the data structures and create them because the logic in those methods is fully tested.
2021-03-03 05:07:41 -06:00
Michael Howitz bf0de08af2 Back to development: 5.2.1 2020-11-05 13:31:51 +01:00
Michael Howitz c64c69b041 Preparing release 5.2.0 2020-11-05 13:31:41 +01:00
Michael Howitz 3efc9579ba
Add support for Python 3.9. (#222) 2020-11-05 13:30:11 +01:00
dieter 3b99e6d097 Document persistency and equality 2020-10-16 09:28:09 +02:00
Jason Madden 4d0e0cf8d1
Back to development: 5.1.3 2020-10-01 07:36:27 -05:00
Jason Madden 375f39b75f
Preparing release 5.1.2 2020-10-01 07:36:06 -05:00
Jan-Jaap Driessen ca5b7e0c8d Merge branch 'master' of github.com:zopefoundation/zope.interface into master 2020-10-01 13:05:12 +02:00
Jan-Jaap Driessen 856ee6086a Fix rst syntax/line folding. 2020-10-01 12:59:18 +02:00
Jason Madden 93efea7577
Back to development: 5.1.2 2020-09-30 11:56:29 -05:00
Jason Madden e01173b9dc
Preparing release 5.1.1 2020-09-30 11:55:54 -05:00
Jason Madden 8cf31ebd6b
Add info on the interaction of weakrefs and interface hashing. 2020-09-30 10:40:14 -05:00
Jan-Jaap Driessen 27e832a04c
Update CHANGES.rst
Co-authored-by: Jason Madden <jason+github@nextthought.com>
2020-09-28 14:34:38 +02:00
Jason Madden b749fc0f17
C optimizations: Spec_clear and Spec_traverse need to include Spec->_bases
Previously they did not, leading to a reference leak of a tuple.

Fixes #216
2020-09-28 06:09:42 -05:00
Jan-Jaap Driessen 1025519cb6 When an invariant is defined in an interface, it's found by
`validateInvariants` in all interfaces inheriting from that interface.
Make sure to call each invariant only once when validating invariants.
2020-09-25 11:29:29 +02:00
Jason Madden 44169e9ed2
Fix interface definitions of IAdapterRegistry.subscribe, subscribers and subscriptions.
They were defined to accept a name argument, but the actual implementation doesn't. Add tests for this. Fixes #208.

Also in test_adapter.py modernize idioms from assertTrue(x in y) and assertTrue(x is y) to assertIn and assertIs.
2020-04-23 06:14:29 -05:00
Jason Madden 10a951f9db
Back to development: 5.1.1 2020-04-08 07:23:59 -05:00
Jason Madden d28ef60bde
Preparing release 5.1.0 2020-04-08 07:23:38 -05:00
Jason Madden 76203ebcd3
Merge pull request #203 from zopefoundation/issue199
Make @implementer and classImplements not add redundant interfaces
2020-04-08 07:18:08 -05:00
Jason Madden c500360aab
The ImmutableDeclaration also has immutable _v_attrs.
Fixes #204
2020-04-07 07:56:48 -05:00
Jason Madden 46781f87cc
Make @implementer and classImplements not re-declare redundant interfaces.
classImplementsOnly and @implementer_only can still be used to do that.
2020-04-07 07:32:06 -05:00
Jason Madden 10eadd6305
Let interface 'subclasses' override __adapt__.
Cooperate with InterfaceClass to ensure there is no performance penalty for this. Fixes #3

+-------------------------------------------------------------+----------------+------------------------------+------------------------------+
| Benchmark                                                   | bench_master38 | bench_issue3                 | bench_issue3_opt             |
+=============================================================+================+==============================+==============================+
| call interface (provides; deep)                             | 369 ns         | 454 ns: 1.23x slower (+23%)  | not significant              |
+-------------------------------------------------------------+----------------+------------------------------+------------------------------+
| call interface (provides; wide)                             | 373 ns         | 457 ns: 1.22x slower (+22%)  | 365 ns: 1.02x faster (-2%)   |
+-------------------------------------------------------------+----------------+------------------------------+------------------------------+
| call interface (no alternate, no conform, not provided)     | 671 ns         | 760 ns: 1.13x slower (+13%)  | 636 ns: 1.06x faster (-5%)   |
+-------------------------------------------------------------+----------------+------------------------------+------------------------------+
| call interface (alternate, no conform, not provided)        | 395 ns         | 494 ns: 1.25x slower (+25%)  | not significant              |
+-------------------------------------------------------------+----------------+------------------------------+------------------------------+
| call interface (no alternate, valid conform, not provided)  | 250 ns         | not significant              | 227 ns: 1.10x faster (-9%)   |
+-------------------------------------------------------------+----------------+------------------------------+------------------------------+
| call interface (alternate, invalid conform, not provided)   | 348 ns         | 424 ns: 1.22x slower (+22%)  | not significant              |
+-------------------------------------------------------------+----------------+------------------------------+------------------------------+
2020-04-06 09:14:45 -05:00