diff options
| author | Tres Seaver <tseaver@palladion.com> | 2012-02-16 21:50:25 +0000 |
|---|---|---|
| committer | Tres Seaver <tseaver@palladion.com> | 2012-02-16 21:50:25 +0000 |
| commit | 1722b56edbca94adaa2e461215e940d785b07d3c (patch) | |
| tree | 1e00682f8755ed72f07981ebd22282d53b9cbc01 /src/zope/interface/interface.py | |
| parent | 921318bc4bf0955cffab94f4f80fe3a9d13953e4 (diff) | |
| download | zope-interface-1722b56edbca94adaa2e461215e940d785b07d3c.tar.gz | |
Avoid exceptions due to tne new ``__qualname__`` attribute added in Python 3.3
See PEP 3155 for rationale. Thanks to Antoine Pitrou for the patch.
Fixes LP #900906.
Diffstat (limited to 'src/zope/interface/interface.py')
| -rw-r--r-- | src/zope/interface/interface.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/zope/interface/interface.py b/src/zope/interface/interface.py index af76f12..aec7d85 100644 --- a/src/zope/interface/interface.py +++ b/src/zope/interface/interface.py @@ -480,9 +480,11 @@ class InterfaceClass(Element, InterfaceBase, Specification): # Make sure that all recorded attributes (and methods) are of type # `Attribute` and `Method` - for name, attr in attrs.items(): - if name == '__locals__': - # This happens under Python 3 sometimes, not sure why. /regebro + for name, attr in list(attrs.items()): + if name in ('__locals__', '__qualname__'): + # __locals__: Python 3 sometimes adds this. + # __qualname__: PEP 3155 (Python 3.3+) + del attrs[name] continue if isinstance(attr, Attribute): attr.interface = self |
