summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Move the one-base optimization down a level, and enable using pre-calculated ↵issue8Jason Madden2020-03-173-33/+84
| | | | | | | | __sro__ for caching. In my local 'load the world' test, this went from ~7800 full C3 merges to about ~1100. Also take steps to avoid triggering false positive warnings about changed ROs when it's *just* Interface that moved.
* Ensure Interface is the last item in the __sro__.Jason Madden2020-03-175-25/+154
| | | | | | None of the elegant solutions mentioned in the issue worked out, so I had to brute force it. Fixes #8
* Merge pull request #182 from zopefoundation/issue21Jason Madden2020-03-1722-103/+1236
|\ | | | | Use C3 (mostly) to compute IRO.
| * Use C3 (mostly) to compute IRO.issue21Jason Madden2020-03-1522-103/+1236
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | MacOS wheels for 3.8Michael Howitz2020-03-131-0/+4
|/ | | Copy-pasted from `persistent` as suggested by @mgedmin
* Merge pull request #181 from zopefoundation/issue11Jason Madden2020-03-1011-63/+735
|\ | | | | Make provided/implementedBy and adapter registries respect super().
| * Add additional low-level tests for super() unwrapping.Jason Madden2020-03-101-1/+38
| |
| * Remove unused str variablesJason Madden2020-03-101-15/+8
| | | | | | | | | | The DEFINE_STRING macro prevents the linter from seeing them as unused so I temporarily redefined it to find all such variables.
| * Make provided/implementedBy and adapter registries respect super().issue11Jason Madden2020-03-0910-55/+697
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | Print $TRAVIS_TAG in build logsMarius Gedminas2020-03-101-0/+2
| | | | | | | | | | | | | | This is intended to help us solve mysteries like https://github.com/zopefoundation/zope.interface/issues/185#issuecomment-596994265, where a 5.0.0.dev0 release was uploaded despite there being no git tags pointing to the relevant commit that anyone knows about.
* | Ask zest.releaser not to upload wheelsMarius Gedminas2020-03-101-0/+3
| | | | | | | | | | Because the wheel you get is not accepted by PyPI, so this makes the entire upload step fail.
* | Update changelogMarius Gedminas2020-03-101-0/+7
|/
* Merge pull request #175 from zopefoundation/issue138Jason Madden2020-02-2115-39/+1338
|\ | | | | Add more common interfaces
| * Cleanups per review.issue138Jason Madden2020-02-175-41/+34
| |
| * Update documentation and clarify the relationship of the older mapping and ↵Jason Madden2020-02-179-64/+193
| | | | | | | | sequence interfaces.
| * Do not test _WindowsConsoleIOJason Madden2020-02-171-1/+1
| |
| * Find more concrete classes that are registered.Jason Madden2020-02-175-15/+41
| |
| * Add interfaces for builtins and the io ABCs.Jason Madden2020-02-1710-64/+449
| |
| * Add numbers ABC interfaces.Jason Madden2020-02-176-39/+204
| |
| * Add collections.IByteString and refactor to avoid one-to-one assumption ↵Jason Madden2020-02-173-45/+161
| | | | | | | | | | | | about ABCs and builtins. bytearray turns out to violate that.
| * Add z.i.common.collections to parallel the collections.abc classes.Jason Madden2020-02-174-2/+487
|/ | | | | | | | Register implemented standard library types on import. Derive the interface methods and documentation from the ABC automatically. I hope to use this for numbers too. Part of #138
* Merge pull request #177 from zopefoundation/fix-signatureJens W. Klein2020-02-163-5/+6
|\ | | | | Fix repr of "Attribute" to look like before
| * Fix repr of "Attribute" to look like beforeJens W. Klein2020-02-163-5/+6
| | | | | | | | and as usual in Python.
* | Merge pull request #176 from zopefoundation/issue6Jason Madden2020-02-151-1/+50
|\ \ | |/ |/| Add test case for #6.
| * Add test case for #6.issue6Jason Madden2020-02-141-1/+50
|/ | | | It seems to be working now, so this fixes #6
* Merge pull request #174 from zopefoundation/issue171Jason Madden2020-02-107-159/+562
|\ | | | | Make verifyObject/Class collect and raise all errors instead of only the first
| * One more place needing python -mJason Madden2020-02-101-2/+2
| |
| * Attempt workaround for virtualenv 20.0 failures.Jason Madden2020-02-101-4/+9
| | | | | | | | See https://github.com/zopefoundation/zope.interface/pull/174#issuecomment-584154877
| * Simplify the string formatting rules for the Invalid exceptions.Jason Madden2020-02-104-116/+326
| | | | | | | | | | | | As per review. Also include the actual failing implementation object in the BrokenMethodImplementation to make it easier to track down what's going on when inheritance is involved.
| * Make verifyObject/Class collect and raise all errors instead of only the first.issue171Jason Madden2020-02-086-108/+296
|/ | | | Fixes #171.
* Merge pull request #173 from zopefoundation/issue170Jason Madden2020-02-089-103/+368
|\ | | | | Make verification errors more readable and useful.
| * Add warning to change note about string changes breaking doctests.Jason Madden2020-02-085-27/+69
| | | | | | | | Also tweak documentation to DRY for verifyObject/verifyClass.
| * Also document the not-a-method case.issue170Jason Madden2020-02-072-1/+9
| |
| * Make verification errors more readable and useful.Jason Madden2020-02-077-77/+292
|/ | | | | | | | | | | | | | Eliminate the trailing newlines and blank spaces (the code called them "a stupid artifact"). Include the name of the defining interface (so the user can easily look up any requirements on the attribute) and, for methods, the expected signature (no more guessing about how many arguments are required!). This is implemented by giving Attribute and Method useful reprs and strs. Previously, they just had the defaults. Fixes #170
* Merge pull request #172 from zopefoundation/issue118Jason Madden2020-02-077-46/+177
|\ | | | | Fix verification for methods of builtin types with pseudo-default args on PyPy
| * Fix verification for methods of builtin types with pseudo-default arguments ↵issue118Jason Madden2020-02-067-46/+177
|/ | | | | | | | | on Pypy On PyPy2, they are ignored (like on CPython), but on PyPy3 they can actually be validated. Fixes #118
* Merge pull request #169 from zopefoundation/issue153Jason Madden2020-02-0611-46/+130
|\ | | | | Add __all__ to all modules.
| * Correct extra underscore.Jason Madden2020-02-061-1/+1
| |
| * Add __all__ to all modules.issue153Jason Madden2020-02-0511-46/+130
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes #153 The items that went in each ``__all__`` are based on what is documented: $ rg --no-filename 'import' docs/ -trst | tr -s "[:blank:]" | sort | uniq | grep zope >>> from pprint import pprint >>> from zope.interface import * >>> from zope.interface import Interface >>> from zope.interface import Interface, Attribute, implementer >>> from zope.interface import alsoProvides >>> from zope.interface import classImplements >>> from zope.interface import classImplementsOnly >>> from zope.interface import directlyProvidedBy >>> from zope.interface import directlyProvides >>> from zope.interface import implementedBy >>> from zope.interface import implementer >>> from zope.interface import implementer_only >>> from zope.interface import noLongerProvides >>> from zope.interface import providedBy >>> from zope.interface import provider >>> from zope.interface.adapter import AdapterRegistry >>> from zope.interface.declarations import Declaration >>> from zope.interface.declarations import InstanceDeclarations >>> from zope.interface.declarations import ProvidesClass >>> from zope.interface.declarations import named >>> from zope.interface.exceptions import BrokenImplementation >>> from zope.interface.exceptions import Invalid >>> from zope.interface.interface import Specification >>> from zope.interface.interface import adapter_hooks >>> from zope.interface.verify import verifyObject >>> import gc >>> import zope.interface And also some personal judgement about what the public API is that I'm more than happy to have reviewed.
* Merge pull request #167 from zopefoundation/lookup-performanceJens W. Klein2020-02-042-6/+21
|\ | | | | Performance optimization in _lookup _lookupAll and _subscriptions
| * better namingJens W. Klein2020-02-041-9/+9
| |
| * iPerformace optimization in _lookup _lookupAll _subscriptionslookup-performanceJens W. Klein2020-02-042-6/+21
|/
* Merge pull request #164 from zopefoundation/issue162Jason Madden2020-02-044-15/+55
|\ | | | | The _empty singleton has no-op subscribe/unsubscribe methods.
| * The _empty singleton has no-op subscribe/unsubscribe methods.issue162Jason Madden2020-01-284-15/+55
|/ | | | | | | | Turns out they can be called in some very strange error cases. See #162 and #163 for details. This should fix #162 (at least the provided test case, five.intid, passes now). It also does enough work on #163 that (a) the test can be written and run in pure-python mode, which was needed to debug it and (b) five.intid runs in pure-python mode (well, with a bunch of other small hacks to Acquisition, ExtensionClass, DocumentTemplate and AccessControl), but I won't claim that it fully fixes #163. For one thing, there are no specific tests. For another, I see more such differences.
* Merge pull request #161 from zopefoundation/hash_performance_2Jens W. Klein2020-01-282-5/+9
|\ | | | | Remove unneeded overwrite and call to anyway inherited __hash__ method
| * apply suggestion by @jmadden to enhance commentJens W. Klein2020-01-281-2/+2
| |
| * Remove unneeded overwrite and call to anyway inherited __hash__ methodhash_performance_2Jens W. Klein2020-01-282-3/+7
|/
* Merge pull request #160 from zopefoundation/issue158Jason Madden2020-01-273-3/+114
|\ | | | | Make the singleton _empty immutable.
| * Add comment detailing why __bases__ can be set per review.issue158Jason Madden2020-01-271-1/+7
| |
| * Make the singleton _empty immutable.Jason Madden2020-01-273-3/+108
|/ | | | Fixes #158