summaryrefslogtreecommitdiff
path: root/src/zope/interface/interface.py
Commit message (Collapse)AuthorAgeFilesLines
* Add __all__ to all modules.issue153Jason Madden2020-02-051-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* The _empty singleton has no-op subscribe/unsubscribe methods.issue162Jason Madden2020-01-281-1/+4
| | | | | | | | 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.
* Remove support for hashing uninitialized interfaces.issue157Jason Madden2020-01-271-7/+2
| | | | Fixes #157
* Avoid allocating space for tagged values unless they're used. This saves ↵Jason Madden2020-01-271-3/+9
| | | | another few percent.
* Specifications with no dependents are common (4700 out of 7000 in this ↵Jason Madden2020-01-271-9/+25
| | | | | | example), so avoid allocating a WeakKeyDictionary until needed. This saves another 2% or so.
* Move Declaration, Specification and ClassProvides to __slots__.Jason Madden2020-01-271-16/+42
| | | | In a test of 6000 modules that load 2245 InterfaceClass objects and produce 2233 ClassProvides instances, this saves about 1% total memory usage in Python 2.7.
* cache on volatile attribute in case class is persisted in ZODBhash_performanceJens W. Klein2020-01-251-3/+3
|
* Improve InterfaceClass __hash__ performanceJens W. Klein2020-01-241-5/+9
|
* Use tp_members in SpecificationBase and ClassProvidesBase.Jason Madden2020-01-231-1/+5
| | | | | | | | | | | | Instead of storing 1 and 2 attributes, respectively, in __dict__. This lets us eliminate inst_attr and its use of an undocumented API. It also helps reign in the size of these objects. Before, on CPython 8, a ClassProvides object that subclasses both SpecificationBase and ClassProvidesBase required 408 bytes: 48 for the object, 360 for the dict. Now it requires 72 + 232 = 304. With a bit of work on defining __slots__ in Python, that can be brought much lower still, I think. zope.security tests pass with this installed.
* Test PURE_PYTHON at runtime.Jason Madden2020-01-211-27/+18
| | | | | | | Turns out that the C extensions build and work fine with PyPy, but don't use them by default. Let them be forced, though. Tests needed some refactoring to account for the various permutations.
* fix 'dict_keys' object has no attribute 'extend'mauro2019-10-091-3/+5
|
* taggedvalue inheritancemauro2019-10-091-0/+25
|
* Formatting and cross refs for the 'Interface Specification' docJason Madden2018-07-191-2/+3
|
* Drop __annotations__ in interface declarationsMaxim Avanov2017-09-011-1/+2
|
* Enable combined coverage reports under tox and branch coveragecombined-coverageJason Madden2017-06-141-3/+3
| | | | | | | | Fixes #91 Remove many (or most) now-redundant 'pragma: no cover'. A few minor test changes to get full branch coverage.
* 100% coverage (#90)Jason Madden2017-06-121-7/+7
| | | | | | | | | | | | | | | | | | | | | * Get as close to 100% coverage as possible. Without conflicting with #86. This is almost entirely trivial changes: - Make dummy methods that should never be called either raise NotImplementedError or call self.fail() in tests. - Standardize the no-coverage pragma - Add a few pragmas where coverage varies across versions/implementations, mostly for the sake of tox (travis should hit them all). * Convert tox to run the coverage command, like travis. A follow up should have it produce coverage for all python versions/implementations. Fixes #87 * Adjust coverage config for py2 only tests; fix typo; finish replacing self with cls
* Fix C optimizations broken on Py3k.60-fix_c_optimizations-py3kTres Seaver2016-11-151-3/+3
| | | | | | | | | | - The bare import of '_zope_c_optimizations' prevented them from being used. - After enabling them via absolute imports, they would fail due to http://bugs.python.org/issue15657. Fixes #60.
* Make declarations.Implements sortable.comp-implementsJason Madden2016-08-031-1/+1
| | | | Fixes #42
* 100% branch coverage.Tres Seaver2014-12-091-1/+1
| | | | | | We exclude interfaces declared with the 'class' statement, because their methods typically have only a doctstring in the suite, which confuses the branch coverage machinery.
* Remove fossilized 'InterfaceClass.deferred()'.Tres Seaver2014-12-081-28/+1
|
* - Fixed a bug that was revealed by porting zope.traversing. During a loop, theStephan Richter2013-02-211-1/+1
| | | | loop body modified a weakref dict causing a ``RuntimeError`` error
* further simplify some attribute lookupsFred Drake2012-04-061-2/+2
|
* Drop unneeded compatibility shims for method / function attributes.Tres Seaver2012-04-061-6/+3
| | | | | '__code__', '__defaults__', '__func__', and '__self__' all work fine on Python 2.6+.
* Move commented-out doctest snippets into API docs as real snippets.Tres Seaver2012-04-061-140/+3
|
* Merge Py3k w/o 2to3 work.Tres Seaver2012-04-041-152/+153
|
* Merge from LP branch.Tres Seaver2012-03-261-24/+35
|
* Avoid exceptions due to tne new ``__qualname__`` attribute added in Python 3.3 Tres Seaver2012-02-161-3/+5
| | | | | | | See PEP 3155 for rationale. Thanks to Antoine Pitrou for the patch. Fixes LP #900906.
* Work around buggy behavior in some subclasses of `InterfaceClass``Tres Seaver2011-08-111-0/+5
| | | | | | | | | Some sublcasses invoke '__hash__' before initializing '__module__' and '__name__'. The workaround returns a fixed constant hash in such cases, and issues a UserWarning. Addresses LP #811792.
* Revert r122462 after updating zope.app.interface.Tres Seaver2011-08-111-2/+1
|
* Fix a regression introduced in 3.6.4, that made one zope.app.interface test failGediminas Paulauskas2011-08-041-1/+2
|
* LP 804951: InterfaceClass instances were unhashable under Python 3.x.Tres Seaver2011-07-051-0/+3
|
* Correct comparison of interfaces from different modules but with the same name.Tres Seaver2011-05-261-9/+19
| | | | | Fixes LP #570942.
* Clear the cache used by ``Specificaton.get`` inside ``Specification.changed``.Tres Seaver2010-04-131-0/+4
| | | | | | | Fixes LP #185974: Thanks to Jacob Holm for the patch.
* Merge of regebro-python3 branch, adding Python 3.1 compatibility\!Lennart Regebro2010-04-091-15/+13
|
* Comply with repository policy.Tres Seaver2010-04-061-1/+1
|
* Revert incorrect copyright header update.Christian Theune2009-12-171-1/+1
|
* Cleanups: make pyflakes happy.Tres Seaver2009-12-171-13/+20
|
* Updating copyright header after transfer of ownership to the Zope FoundationChristian Theune2009-11-021-1/+1
|
* reverted r81363 since it "breaks assigning to __class__, which the twisted ↵Andreas Zeidler2008-01-141-6/+6
| | | | folks depend on"
* using `__setattr__` instead of `property` speeds up zope start-up time ↵Andreas Zeidler2007-11-011-6/+6
| | | | again, since getting the value for `__bases__` through `__dict__` adds up with almost 200.000 calls; of course, there's some overhead, since `__setattr__` gets called for the other attributes as well, but overall start-up is still faster
* Moving code to satellite.Christian Theune2007-05-031-0/+811
|
* Removed interface copyJim Fulton2006-03-111-916/+0
|
* Correcting borked move.Nathan Yergler2006-02-271-0/+916