| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
| |
Co-authored-by: Jens Vagelpohl <jens@plyp.com>
|
| |
|
|
|
|
|
|
|
|
|
| |
Python 3.11 warns:
DeprecationWarning: It is deprecated to return a value that is not
None from a test case (<bound method Test_c3_ro.test_complex_diamond
of <zope.interface.tests.test_ro.Test_c3_ro
testMethod=test_complex_diamond>>)
Rearrange slightly to avoid this.
|
| |
|
|
|
|
|
|
|
|
|
| |
Add a regression test for CFLAGS not having -Ofast, which is known to
break things. See https://github.com/zopefoundation/meta/pull/155 for
reference.
This reverts commit dc2e4b9841185889bdf8b77ee5c28f5b7295578a, which
itself was reverting commit 22a761cc9e6fcfa840582d55a15abda31a9dd2e1,
which was accidentally pushed to git master and is otherwise identical
to this commit.
|
| |
|
|
|
|
| |
This reverts commit 22a761cc9e6fcfa840582d55a15abda31a9dd2e1.
This was not supposed to have been pushed directly to master :/
|
| |
|
|
|
|
| |
Add a regression test for CFLAGS not having -Ofast, which is known to
break things. See https://github.com/zopefoundation/meta/pull/155 for
reference.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
On PyPy3 the following `registered_classes` for `IMutableMapping` are
found:
```
{<class 'dict'>,
<class 'pkg_resources._vendor.pyparsing.ParseResults'>,
<class 'setuptools._vendor.pyparsing.ParseResults'>,
<class 'collections.UserDict'>}
```
So collecting the tests fails because of a duplicate name which is
prevented by this commit.
|
| |
|
| |
Co-authored-by: Michael Howitz <mh@gocept.com>
|
| |
|
|
|
| |
* 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.
|
| |
|
|
|
|
|
|
|
| |
`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.
|
| |
|
|
| |
* Add support for Python 3.9.
* Improve coverage.
|
| |\
| |
| | |
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.
|
| |/
|
|
|
|
| |
By moving things from the RHS to the front of the list if they already extend something from the LHS.
Fixes #193
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
```
|
| | |
|
| |
|
|
|
|
| |
Fixes #229.
Replaces #232
|
| |\
| |
| | |
Make Provides and ClassProvides ignore redundant interfaces like @implementer
|
| | |
| |
| |
| | |
cf #207
|
| |\ \
| |/
|/| |
Update the Adaptation docs to be more concrete.
|
| | |
| |
| |
| |
| |
| | |
This should help provide better motivating use cases. Examples inspired by https://glyph.twistedmatrix.com/2021/03/interfaces-and-protocols.html
Also some minor typo fixes and updates to comments.
|
| | | |
|
| | |
| |
| | |
Co-authored-by: Marius Gedminas <marius@gedmin.as>
|
| | | |
|
| |/
|
|
|
|
| |
Components.rebuildUtilityRegistryFromLocalCache
Fixes #230
|
| | |
|
| |
|
|
| |
Also tweak docs.
|
| |
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |\ |
|
| | |
| |
| |
| |
| |
| | |
Previously they did not, leading to a reference leak of a tuple.
Fixes #216
|
| | |
| |
| |
| | |
of invariants we have already seen.
|
| | |
| |
| |
| | |
public interface/signature.
|
| |/
|
|
|
| |
`validateInvariants` in all interfaces inheriting from that interface.
Make sure to call each invariant only once when validating invariants.
|
| |
|
|
|
|
|
|
| |
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.
|
| |\
| |
| | |
Make @implementer and classImplements not add redundant interfaces
|
| | |
| |
| |
| |
| |
| | |
Seen in plone.app.testing as a problem in Products.GenericSetup.
Added tests for that.
|
| | |
| |
| |
| | |
redundancy detection for the sake of plone.app.caching.
|
| | |
| |
| |
| | |
classImplementsOnly and @implementer_only can still be used to do that.
|
| |\ \
| | |
| | | |
The ImmutableDeclaration also has immutable _v_attrs.
|
| | |/
| |
| |
| | |
Fixes #204
|
| |/
|
|
| |
See https://github.com/zopefoundation/zope.interface/pull/202#pullrequestreview-389126705
|
| |
|
|
| |
the precedence of __conform__ vs __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 |
+-------------------------------------------------------------+----------------+------------------------------+------------------------------+
|
| | |
|
| |
|
|
| |
duplicates in the index.
|
| | |
|
| |
|
|
|
|
|
|
| |
Only catch AttributeError instead of everything.
Fixes #200
Note that this does break a doctest in five.intid (it's expecting a TypeError but it now gets Acquisition's RuntimeError).
|
| |
|
|
|
|
| |
their iro and sro.
Fixes #197.
|
| |
|
|
|
|
|
|
| |
env variable.
Fixes #192 and fixes #194.
Also fix the IRO for OrderedDict on CPython 2
|
| | |
|