diff options
| author | Jason Madden <jamadden@gmail.com> | 2020-01-28 16:04:31 -0600 |
|---|---|---|
| committer | Jason Madden <jamadden@gmail.com> | 2020-01-28 16:04:31 -0600 |
| commit | 97997956d1a17a0cfb064dfe0487291e8f8ee181 (patch) | |
| tree | a491a49d49388774f3b04ced86985578e6be4bac /src/zope/interface/interface.py | |
| parent | 489328a5afc1430a064db2dba7a7a408591789f9 (diff) | |
| download | zope-interface-issue162.tar.gz | |
The _empty singleton has no-op subscribe/unsubscribe methods.issue162
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.
Diffstat (limited to 'src/zope/interface/interface.py')
| -rw-r--r-- | src/zope/interface/interface.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/zope/interface/interface.py b/src/zope/interface/interface.py index 7fa56aa..57998e0 100644 --- a/src/zope/interface/interface.py +++ b/src/zope/interface/interface.py @@ -159,7 +159,10 @@ class InterfaceBase(object): def __call__(self, obj, alternate=_marker): """Adapt an object to the interface """ - conform = getattr(obj, '__conform__', None) + try: + conform = getattr(obj, '__conform__', None) + except: + conform = None if conform is not None: adapter = self._call_conform(conform) if adapter is not None: |
