import fails with Python 3.3 because of __qualname__

Bug #900906 reported by Catalin Iacob on 2011-12-06
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
zope.interface
Fix Released
Undecided
Tres Seaver

Bug Description

This happens with the pre-alpha Python 3.3 default branch, zope.interface 3.8.0 installed with pip from PyPI.

Since 25 Nov 2011 Python got a __qualname__ attribute for functions and classes because support for PEP 3155 [1] got merged. When I import zope.interface I get:

Python 3.3.0a0 (default:e2959a6a1440, Dec 5 2011, 21:25:47)
[GCC 4.6.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import zope.interface
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/catalin/pyramid-scaffolds/lib/python3.3/site-packages/zope/interface/__init__.py", line 56, in <module>
    _wire()
  File "/home/catalin/pyramid-scaffolds/lib/python3.3/site-packages/zope/interface/interface.py", line 823, in _wire
    from zope.interface.interfaces import IAttribute
  File "/home/catalin/pyramid-scaffolds/lib/python3.3/site-packages/zope/interface/interfaces.py", line 23, in <module>
    class IElement(Interface):
  File "/home/catalin/pyramid-scaffolds/lib/python3.3/site-packages/zope/interface/interface.py", line 497, in __init__
    raise InvalidInterface("Concrete attribute, " + name)
zope.interface.exceptions.InvalidInterface: Concrete attribute, __qualname__

I should mention that I know almost nothing about zope.interface, I got the import error by trying out Pyramid on Python 3.3. I can see from the traceback that __qualname__ gets into attrs in the __init__ of InterfaceClass and adding an if name == '__qualname__': continue just like for '__locals__' makes the error go away, however I have no idea if that's the proper fix.

[1] http://www.python.org/dev/peps/pep-3155/

Antoine Pitrou (pitrou) wrote :

Attaching patch.

Tres Seaver (tseaver) wrote :

Thanks for the patch. Committed for 3.8.1.

  http://svn.zope.org/zope.interface/trunk/?rev=124423&view=rev

Changed in zope.interface:
assignee: nobody → Tres Seaver (tseaver)
status: New → Fix Committed
Tres Seaver (tseaver) on 2015-01-12
Changed in zope.interface:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers