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 | |
| 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.
| -rw-r--r-- | CHANGES.txt | 4 | ||||
| -rw-r--r-- | src/zope/interface/interface.py | 8 |
2 files changed, 8 insertions, 4 deletions
diff --git a/CHANGES.txt b/CHANGES.txt index 9efc8e9..9027837 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -4,7 +4,9 @@ 3.8.1 (unreleased) ------------------ -- No changes yet. +- LP #900906: 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. 3.8.0 (2011-09-22) ------------------ 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 |
