[Checkins] SVN: zope.interface/branches/tseaver-no_2to3/ Merge Py3k w/o 2to3 work.

Tres Seaver cvs-admin at zope.org
Wed Apr 4 23:40:53 UTC 2012


Log message for revision 124956:
  Merge Py3k w/o 2to3 work.

Changed:
  U   zope.interface/branches/tseaver-no_2to3/.bzrignore
  U   zope.interface/branches/tseaver-no_2to3/bootstrap.py
  D   zope.interface/branches/tseaver-no_2to3/build_ext_2.py
  D   zope.interface/branches/tseaver-no_2to3/build_ext_3.py
  U   zope.interface/branches/tseaver-no_2to3/docs/conf.py
  U   zope.interface/branches/tseaver-no_2to3/setup.py
  A   zope.interface/branches/tseaver-no_2to3/src/zope/interface/_compat.py
  U   zope.interface/branches/tseaver-no_2to3/src/zope/interface/adapter.py
  U   zope.interface/branches/tseaver-no_2to3/src/zope/interface/declarations.py
  U   zope.interface/branches/tseaver-no_2to3/src/zope/interface/document.py
  U   zope.interface/branches/tseaver-no_2to3/src/zope/interface/interface.py
  U   zope.interface/branches/tseaver-no_2to3/src/zope/interface/interfaces.py
  U   zope.interface/branches/tseaver-no_2to3/src/zope/interface/registry.py
  U   zope.interface/branches/tseaver-no_2to3/src/zope/interface/tests/test_adapter.py
  U   zope.interface/branches/tseaver-no_2to3/src/zope/interface/tests/test_advice.py
  U   zope.interface/branches/tseaver-no_2to3/src/zope/interface/tests/test_declarations.py
  U   zope.interface/branches/tseaver-no_2to3/src/zope/interface/tests/test_interface.py
  U   zope.interface/branches/tseaver-no_2to3/src/zope/interface/tests/test_odd_declarations.py
  U   zope.interface/branches/tseaver-no_2to3/src/zope/interface/tests/test_registry.py
  U   zope.interface/branches/tseaver-no_2to3/src/zope/interface/tests/test_verify.py
  U   zope.interface/branches/tseaver-no_2to3/src/zope/interface/verify.py

-=-
Modified: zope.interface/branches/tseaver-no_2to3/.bzrignore
===================================================================
--- zope.interface/branches/tseaver-no_2to3/.bzrignore	2012-04-04 23:31:42 UTC (rev 124955)
+++ zope.interface/branches/tseaver-no_2to3/.bzrignore	2012-04-04 23:40:49 UTC (rev 124956)
@@ -10,3 +10,4 @@
 include
 lib
 docs/_build
+__pycache__

Modified: zope.interface/branches/tseaver-no_2to3/bootstrap.py
===================================================================
--- zope.interface/branches/tseaver-no_2to3/bootstrap.py	2012-04-04 23:31:42 UTC (rev 124955)
+++ zope.interface/branches/tseaver-no_2to3/bootstrap.py	2012-04-04 23:40:49 UTC (rev 124956)
@@ -23,8 +23,8 @@
 tmpeggs = tempfile.mkdtemp()
 
 ez = {}
-exec urllib2.urlopen('http://peak.telecommunity.com/dist/ez_setup.py'
-                     ).read() in ez
+exec(urllib2.urlopen('http://peak.telecommunity.com/dist/ez_setup.py'
+                     ).read(), ez)
 ez['use_setuptools'](to_dir=tmpeggs, download_delay=0)
 
 import pkg_resources

Deleted: zope.interface/branches/tseaver-no_2to3/build_ext_2.py
===================================================================
--- zope.interface/branches/tseaver-no_2to3/build_ext_2.py	2012-04-04 23:31:42 UTC (rev 124955)
+++ zope.interface/branches/tseaver-no_2to3/build_ext_2.py	2012-04-04 23:40:49 UTC (rev 124956)
@@ -1,38 +0,0 @@
-import sys
-from distutils.errors import (CCompilerError, DistutilsExecError, 
-                              DistutilsPlatformError)
-try:
-    from setuptools.command.build_ext import build_ext
-except ImportError:
-    from distutils.command.build_ext import build_ext
-    
-
-class optional_build_ext(build_ext):
-    """This class subclasses build_ext and allows
-       the building of C extensions to fail.
-    """
-    def run(self):
-        try:
-            build_ext.run(self)
-        
-        except DistutilsPlatformError, e:
-            self._unavailable(e)
-
-    def build_extension(self, ext):
-        try:
-            build_ext.build_extension(self, ext)
-        
-        except (CCompilerError, DistutilsExecError), e:
-            self._unavailable(e)
-
-    def _unavailable(self, e):
-        print >> sys.stderr, '*' * 80
-        print >> sys.stderr, """WARNING:
-
-        An optional code optimization (C extension) could not be compiled.
-
-        Optimizations for this package will not be available!"""
-        print >> sys.stderr
-        print >> sys.stderr, e
-        print >> sys.stderr, '*' * 80
-        
\ No newline at end of file

Deleted: zope.interface/branches/tseaver-no_2to3/build_ext_3.py
===================================================================
--- zope.interface/branches/tseaver-no_2to3/build_ext_3.py	2012-04-04 23:31:42 UTC (rev 124955)
+++ zope.interface/branches/tseaver-no_2to3/build_ext_3.py	2012-04-04 23:40:49 UTC (rev 124956)
@@ -1,40 +0,0 @@
-import os
-import sys
-from distutils.errors import (CCompilerError, DistutilsExecError, 
-                              DistutilsPlatformError)
-try:
-    from setuptools.command.build_ext import build_ext
-    from pkg_resources import (normalize_path, working_set, 
-                               add_activation_listener, require)
-except ImportError:
-    raise RuntimeError("zope.interface requires Distribute under Python 3. "
-                       "See http://packages.python.org/distribute")
-
-class optional_build_ext(build_ext):
-    """This class subclasses build_ext and allows
-       the building of C extensions to fail.
-    """
-    def run(self):
-        try:
-            build_ext.run(self)
-        
-        except DistutilsPlatformError as e:
-            self._unavailable(e)
-
-    def build_extension(self, ext):
-        try:
-            build_ext.build_extension(self, ext)
-        
-        except (CCompilerError, DistutilsExecError) as e:
-            self._unavailable(e)
-
-    def _unavailable(self, e):
-        print('*' * 80, file=sys.stderr)
-        print("""WARNING:
-
-        An optional code optimization (C extension) could not be compiled.
-
-        Optimizations for this package will not be available!""", file=sys.stderr)
-        print(file=sys.stderr)
-        print(e, file=sys.stderr)
-        print('*' * 80, file=sys.stderr)

Modified: zope.interface/branches/tseaver-no_2to3/docs/conf.py
===================================================================
--- zope.interface/branches/tseaver-no_2to3/docs/conf.py	2012-04-04 23:31:42 UTC (rev 124955)
+++ zope.interface/branches/tseaver-no_2to3/docs/conf.py	2012-04-04 23:40:49 UTC (rev 124956)
@@ -40,8 +40,8 @@
 master_doc = 'index'
 
 # General information about the project.
-project = u'zope.interface'
-copyright = u'2012, Zope Foundation contributors'
+project = 'zope.interface'
+copyright = '2012, Zope Foundation contributors'
 
 # The version info for the project you're documenting, acts as replacement for
 # |version| and |release|, also used in various other places throughout the
@@ -183,8 +183,8 @@
 # Grouping the document tree into LaTeX files. List of tuples
 # (source start file, target name, title, author, documentclass [howto/manual]).
 latex_documents = [
-  ('index', 'zopeinterface.tex', u'zope.interface Documentation',
-   u'Zope Foundation contributors', 'manual'),
+  ('index', 'zopeinterface.tex', 'zope.interface Documentation',
+   'Zope Foundation contributors', 'manual'),
 ]
 
 # The name of an image file (relative to this directory) to place at the top of
@@ -213,8 +213,8 @@
 # One entry per manual page. List of tuples
 # (source start file, name, description, authors, manual section).
 man_pages = [
-    ('index', 'zopeinterface', u'zope.interface Documentation',
-     [u'Zope Foundation contributors'], 1)
+    ('index', 'zopeinterface', 'zope.interface Documentation',
+     ['Zope Foundation contributors'], 1)
 ]
 
 # If true, show URL addresses after external links.
@@ -227,8 +227,8 @@
 # (source start file, target name, title, author,
 #  dir menu entry, description, category)
 texinfo_documents = [
-  ('index', 'zopeinterface', u'zope.interface Documentation',
-   u'Zope Foundation contributors', 'zopeinterface', 'One line description of project.',
+  ('index', 'zopeinterface', 'zope.interface Documentation',
+   'Zope Foundation contributors', 'zopeinterface', 'One line description of project.',
    'Miscellaneous'),
 ]
 

Modified: zope.interface/branches/tseaver-no_2to3/setup.py
===================================================================
--- zope.interface/branches/tseaver-no_2to3/setup.py	2012-04-04 23:31:42 UTC (rev 124955)
+++ zope.interface/branches/tseaver-no_2to3/setup.py	2012-04-04 23:40:49 UTC (rev 124956)
@@ -23,7 +23,43 @@
 import platform
 import sys
 
+from distutils.errors import CCompilerError
+from distutils.errors import DistutilsExecError
+from distutils.errors import DistutilsPlatformError
+
 try:
+    from setuptools.command.build_ext import build_ext
+except ImportError:
+    from distutils.command.build_ext import build_ext
+
+class optional_build_ext(build_ext):
+    """This class subclasses build_ext and allows
+       the building of C extensions to fail.
+    """
+    def run(self):
+        try:
+            build_ext.run(self)
+        except DistutilsPlatformError as e:
+            self._unavailable(e)
+
+    def build_extension(self, ext):
+        try:
+            build_ext.build_extension(self, ext)
+        except (CCompilerError, DistutilsExecError) as e:
+            self._unavailable(e)
+
+    def _unavailable(self, e):
+        print('*' * 80)
+        print("""WARNING:
+
+        An optional code optimization (C extension) could not be compiled.
+
+        Optimizations for this package will not be available!""")
+        print()
+        print(e)
+        print('*' * 80)
+
+try:
     from setuptools import setup, Extension, Feature
 except ImportError:
     # do we need to support plain distutils for building when even
@@ -74,17 +110,6 @@
         read('CHANGES.txt')
         )
 
-try: # Zope setuptools versions
-    from build_ext_3 import optional_build_ext
-    # This is Python 3. Setuptools is now required, and so is zope.fixers.
-    extra['install_requires'] = ['setuptools']
-    extra['setup_requires'] = ['zope.fixers']
-    extra['use_2to3'] = True
-    extra['use_2to3_fixers'] = ['zope.fixers']
-
-except (ImportError, SyntaxError):
-    from build_ext_2 import optional_build_ext
-    
 setup(name='zope.interface',
       version='4.0.0dev',
       url='http://pypi.python.org/pypi/zope.interface',

Added: zope.interface/branches/tseaver-no_2to3/src/zope/interface/_compat.py
===================================================================
--- zope.interface/branches/tseaver-no_2to3/src/zope/interface/_compat.py	                        (rev 0)
+++ zope.interface/branches/tseaver-no_2to3/src/zope/interface/_compat.py	2012-04-04 23:40:49 UTC (rev 124956)
@@ -0,0 +1,64 @@
+##############################################################################
+#
+# Copyright (c) 2006 Zope Foundation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""Basic components support
+"""
+import sys
+import types
+
+if sys.version_info[0] < 3: #pragma NO COVER
+
+    def _u(s):
+        return unicode(s, 'unicode_escape')
+
+    def _normalize_name(name):
+        if isinstance(name, basestring):
+            return unicode(name)
+        raise TypeError("name must be a regular or unicode string")
+
+    class_types = (type, types.ClassType)
+    string_types = (basestring,)
+
+    _FUNC_DEFAULTS = 'func_defaults'
+    _FUNC_CODE = 'func_code'
+    _IM_SELF = 'im_self'
+    _IM_FUNC = 'im_func'
+    _BUILTINS = '__builtin__'
+
+else: #pragma NO COVER
+
+    def _u(s):
+        return s
+
+    def _normalize_name(name):
+        if isinstance(name, bytes):
+            name = str(name, 'ascii')
+        if isinstance(name, str):
+            return name
+        raise TypeError("name must be a string or ASCII-only bytes")
+
+    class_types = type
+    string_types = (str,)
+
+    _FUNC_DEFAULTS = '__defaults__'
+    _FUNC_CODE = '__code__'
+    _IM_SELF = '__self__'
+    _IM_FUNC = '__func__'
+    _BUILTINS = 'builtins'
+
+def _skip_under_py3k(test_method): #pragma NO COVER
+    if sys.version_info[0] < 3:
+        return test_method
+    def _dummy(*args):
+        pass
+    return _dummy

Modified: zope.interface/branches/tseaver-no_2to3/src/zope/interface/adapter.py
===================================================================
--- zope.interface/branches/tseaver-no_2to3/src/zope/interface/adapter.py	2012-04-04 23:31:42 UTC (rev 124955)
+++ zope.interface/branches/tseaver-no_2to3/src/zope/interface/adapter.py	2012-04-04 23:40:49 UTC (rev 124956)
@@ -18,7 +18,11 @@
 from zope.interface import providedBy
 from zope.interface import Interface
 from zope.interface import ro
+from zope.interface._compat import _u
+from zope.interface._compat import _normalize_name
 
+_BLANK = _u('')
+
 class BaseAdapterRegistry(object):
 
     # List of methods copied from lookup sub-objects:
@@ -128,7 +132,7 @@
 
         self.changed(self)
 
-    def registered(self, required, provided, name=u''):
+    def registered(self, required, provided, name=_BLANK):
         required = tuple(map(_convert_None_to_Interface, required))
         name = _normalize_name(name)
         order = len(required)
@@ -199,7 +203,7 @@
 
     def subscribe(self, required, provided, value):
         required = tuple(map(_convert_None_to_Interface, required))
-        name = u''
+        name = _BLANK
         order = len(required)
         byorder = self._subscribers
         while len(byorder) <= order:
@@ -244,7 +248,7 @@
             lookups.append((components, k))
             components = d
 
-        old = components.get(u'')
+        old = components.get(_BLANK)
         if not old:
             # this is belt-and-suspenders against the failure of cleanup below
             return  #pragma NO COVERAGE 
@@ -258,16 +262,16 @@
             return
 
         if new:
-            components[u''] = new
+            components[_BLANK] = new
         else:
-            # Instead of setting components[u''] = new, we clean out
+            # Instead of setting components[_BLANK] = new, we clean out
             # empty containers, since we don't want our keys to
             # reference global objects (interfaces) unnecessarily.  This
             # is often a problem when an interface is slated for
             # removal; a hold-over entry in the registry can make it
             # difficult to remove such interfaces.
-            if u'' in components:
-                del components[u'']
+            if _BLANK in components:
+                del components[_BLANK]
             for comp, k in reversed(lookups):
                 d = comp[k]
                 if d:
@@ -319,8 +323,9 @@
             cache = c
         return cache
 
-    def lookup(self, required, provided, name=u'', default=None):
+    def lookup(self, required, provided, name=_BLANK, default=None):
         cache = self._getcache(provided, name)
+        required = tuple(required)
         if len(required) == 1:
             result = cache.get(required[0], _not_in_mapping)
         else:
@@ -338,7 +343,7 @@
 
         return result
 
-    def lookup1(self, required, provided, name=u'', default=None):
+    def lookup1(self, required, provided, name=_BLANK, default=None):
         cache = self._getcache(provided, name)
         result = cache.get(required, _not_in_mapping)
         if result is _not_in_mapping:
@@ -349,10 +354,10 @@
 
         return result
 
-    def queryAdapter(self, object, provided, name=u'', default=None):
+    def queryAdapter(self, object, provided, name=_BLANK, default=None):
         return self.adapter_hook(provided, object, name, default)
 
-    def adapter_hook(self, provided, object, name=u'', default=None):
+    def adapter_hook(self, provided, object, name=_BLANK, default=None):
         required = providedBy(object)
         cache = self._getcache(provided, name)
         factory = cache.get(required, _not_in_mapping)
@@ -510,7 +515,8 @@
                 r.subscribe(self)
                 _refs[ref] = 1
 
-    def _uncached_lookup(self, required, provided, name=u''):
+    def _uncached_lookup(self, required, provided, name=_BLANK):
+        required = tuple(required)
         result = None
         order = len(required)
         for registry in self._registry.ro:
@@ -532,7 +538,7 @@
 
         return result
 
-    def queryMultiAdapter(self, objects, provided, name=u'', default=None):
+    def queryMultiAdapter(self, objects, provided, name=_BLANK, default=None):
         factory = self.lookup(map(providedBy, objects), provided, name)
         if factory is None:
             return default
@@ -544,6 +550,7 @@
         return result
 
     def _uncached_lookupAll(self, required, provided):
+        required = tuple(required)
         order = len(required)
         result = {}
         for registry in reversed(self._registry.ro):
@@ -558,12 +565,13 @@
 
         self._subscribe(*required)
 
-        return tuple(result.iteritems())
+        return tuple(result.items())
 
     def names(self, required, provided):
         return [c[0] for c in self.lookupAll(required, provided)]
 
     def _uncached_subscriptions(self, required, provided):
+        required = tuple(required)
         order = len(required)
         result = []
         for registry in reversed(self._registry.ro):
@@ -578,7 +586,7 @@
                 if extendors is None:
                     continue
 
-            _subscriptions(byorder[order], required, extendors, u'',
+            _subscriptions(byorder[order], required, extendors, _BLANK,
                            result, 0, order)
 
         self._subscribe(*required)
@@ -651,12 +659,6 @@
     else:
         return x
 
-def _normalize_name(name):
-    if isinstance(name, basestring):
-        return unicode(name)
-
-    raise TypeError("name must be a regular or unicode string")
-
 def _lookup(components, specs, provided, name, i, l):
     if i < l:
         for spec in specs[i].__sro__:

Modified: zope.interface/branches/tseaver-no_2to3/src/zope/interface/declarations.py
===================================================================
--- zope.interface/branches/tseaver-no_2to3/src/zope/interface/declarations.py	2012-04-04 23:31:42 UTC (rev 124955)
+++ zope.interface/branches/tseaver-no_2to3/src/zope/interface/declarations.py	2012-04-04 23:40:49 UTC (rev 124956)
@@ -55,115 +55,112 @@
 
     def __contains__(self, interface):
         """Test whether an interface is in the specification
-
-        for example:
-
-          >>> from zope.interface import Interface
-          >>> class I1(Interface): pass
-          ...
-          >>> class I2(I1): pass
-          ...
-          >>> class I3(Interface): pass
-          ...
-          >>> class I4(I3): pass
-          ...
-          >>> spec = Declaration(I2, I3)
-          >>> spec = Declaration(I4, spec)
-          >>> int(I1 in spec)
-          0
-          >>> int(I2 in spec)
-          1
-          >>> int(I3 in spec)
-          1
-          >>> int(I4 in spec)
-          1
         """
+        #for example:
+        #
+        #  >>> from zope.interface import Interface
+        #  >>> class I1(Interface): pass
+        #  ...
+        #  >>> class I2(I1): pass
+        #  ...
+        #  >>> class I3(Interface): pass
+        #  ...
+        #  >>> class I4(I3): pass
+        #  ...
+        #  >>> spec = Declaration(I2, I3)
+        #  >>> spec = Declaration(I4, spec)
+        #  >>> int(I1 in spec)
+        #  0
+        #  >>> int(I2 in spec)
+        #  1
+        #  >>> int(I3 in spec)
+        #  1
+        #  >>> int(I4 in spec)
+        #  1
+
         return self.extends(interface) and interface in self.interfaces()
 
     def __iter__(self):
         """Return an iterator for the interfaces in the specification
-
-        for example:
-
-          >>> from zope.interface import Interface
-          >>> class I1(Interface): pass
-          ...
-          >>> class I2(I1): pass
-          ...
-          >>> class I3(Interface): pass
-          ...
-          >>> class I4(I3): pass
-          ...
-          >>> spec = Declaration(I2, I3)
-          >>> spec = Declaration(I4, spec)
-          >>> i = iter(spec)
-          >>> [x.getName() for x in i]
-          ['I4', 'I2', 'I3']
-          >>> list(i)
-          []
         """
+        # for example:
+        #
+        #  >>> from zope.interface import Interface
+        #  >>> class I1(Interface): pass
+        #  ...
+        #  >>> class I2(I1): pass
+        #  ...
+        #  >>> class I3(Interface): pass
+        #  ...
+        #  >>> class I4(I3): pass
+        #  ...
+        #  >>> spec = Declaration(I2, I3)
+        #  >>> spec = Declaration(I4, spec)
+        #  >>> i = iter(spec)
+        #  >>> [x.getName() for x in i]
+        #  ['I4', 'I2', 'I3']
+        #  >>> list(i)
+        #  []
+
         return self.interfaces()
 
     def flattened(self):
         """Return an iterator of all included and extended interfaces
-
-        for example:
-
-          >>> from zope.interface import Interface
-          >>> class I1(Interface): pass
-          ...
-          >>> class I2(I1): pass
-          ...
-          >>> class I3(Interface): pass
-          ...
-          >>> class I4(I3): pass
-          ...
-          >>> spec = Declaration(I2, I3)
-          >>> spec = Declaration(I4, spec)
-          >>> i = spec.flattened()
-          >>> [x.getName() for x in i]
-          ['I4', 'I2', 'I1', 'I3', 'Interface']
-          >>> list(i)
-          []
-
         """
+        # for example:
+        #
+        #  >>> from zope.interface import Interface
+        #  >>> class I1(Interface): pass
+        #  ...
+        #  >>> class I2(I1): pass
+        #  ...
+        #  >>> class I3(Interface): pass
+        #  ...
+        #  >>> class I4(I3): pass
+        #  ...
+        #  >>> spec = Declaration(I2, I3)
+        #  >>> spec = Declaration(I4, spec)
+        #  >>> i = spec.flattened()
+        #  >>> [x.getName() for x in i]
+        #  ['I4', 'I2', 'I1', 'I3', 'Interface']
+        #  >>> list(i)
+        #  []
+
         return iter(self.__iro__)
 
     def __sub__(self, other):
         """Remove interfaces from a specification
-
-        Examples:
-
-          >>> from zope.interface import Interface
-          >>> class I1(Interface): pass
-          ...
-          >>> class I2(I1): pass
-          ...
-          >>> class I3(Interface): pass
-          ...
-          >>> class I4(I3): pass
-          ...
-          >>> spec = Declaration()
-          >>> [iface.getName() for iface in spec]
-          []
-          >>> spec -= I1
-          >>> [iface.getName() for iface in spec]
-          []
-          >>> spec -= Declaration(I1, I2)
-          >>> [iface.getName() for iface in spec]
-          []
-          >>> spec = Declaration(I2, I4)
-          >>> [iface.getName() for iface in spec]
-          ['I2', 'I4']
-          >>> [iface.getName() for iface in spec - I4]
-          ['I2']
-          >>> [iface.getName() for iface in spec - I1]
-          ['I4']
-          >>> [iface.getName() for iface
-          ...  in spec - Declaration(I3, I4)]
-          ['I2']
-
         """
+        # Examples:
+        #
+        #  >>> from zope.interface import Interface
+        #  >>> class I1(Interface): pass
+        #  ...
+        #  >>> class I2(I1): pass
+        #  ...
+        #  >>> class I3(Interface): pass
+        #  ...
+        #  >>> class I4(I3): pass
+        #  ...
+        #  >>> spec = Declaration()
+        #  >>> [iface.getName() for iface in spec]
+        #  []
+        #  >>> spec -= I1
+        #  >>> [iface.getName() for iface in spec]
+        #  []
+        #  >>> spec -= Declaration(I1, I2)
+        #  >>> [iface.getName() for iface in spec]
+        #  []
+        #  >>> spec = Declaration(I2, I4)
+        #  >>> [iface.getName() for iface in spec]
+        #  ['I2', 'I4']
+        #  >>> [iface.getName() for iface in spec - I4]
+        #  ['I2']
+        #  >>> [iface.getName() for iface in spec - I1]
+        #  ['I4']
+        #  >>> [iface.getName() for iface
+        #  ...  in spec - Declaration(I3, I4)]
+        #  ['I2']
 
         return Declaration(
             *[i for i in self.interfaces()
@@ -174,40 +171,38 @@
 
     def __add__(self, other):
         """Add two specifications or a specification and an interface
-
-        Examples:
-
-          >>> from zope.interface import Interface
-          >>> class I1(Interface): pass
-          ...
-          >>> class I2(I1): pass
-          ...
-          >>> class I3(Interface): pass
-          ...
-          >>> class I4(I3): pass
-          ...
-          >>> spec = Declaration()
-          >>> [iface.getName() for iface in spec]
-          []
-          >>> [iface.getName() for iface in spec+I1]
-          ['I1']
-          >>> [iface.getName() for iface in I1+spec]
-          ['I1']
-          >>> spec2 = spec
-          >>> spec += I1
-          >>> [iface.getName() for iface in spec]
-          ['I1']
-          >>> [iface.getName() for iface in spec2]
-          []
-          >>> spec2 += Declaration(I3, I4)
-          >>> [iface.getName() for iface in spec2]
-          ['I3', 'I4']
-          >>> [iface.getName() for iface in spec+spec2]
-          ['I1', 'I3', 'I4']
-          >>> [iface.getName() for iface in spec2+spec]
-          ['I3', 'I4', 'I1']
-
         """
+        # Examples:
+        #
+        #  >>> from zope.interface import Interface
+        #  >>> class I1(Interface): pass
+        #  ...
+        #  >>> class I2(I1): pass
+        #  ...
+        #  >>> class I3(Interface): pass
+        #  ...
+        #  >>> class I4(I3): pass
+        #  ...
+        #  >>> spec = Declaration()
+        #  >>> [iface.getName() for iface in spec]
+        #  []
+        #  >>> [iface.getName() for iface in spec+I1]
+        #  ['I1']
+        #  >>> [iface.getName() for iface in I1+spec]
+        #  ['I1']
+        #  >>> spec2 = spec
+        #  >>> spec += I1
+        #  >>> [iface.getName() for iface in spec]
+        #  ['I1']
+        #  >>> [iface.getName() for iface in spec2]
+        #  []
+        #  >>> spec2 += Declaration(I3, I4)
+        #  >>> [iface.getName() for iface in spec2]
+        #  ['I3', 'I4']
+        #  >>> [iface.getName() for iface in spec+spec2]
+        #  ['I1', 'I3', 'I4']
+        #  >>> [iface.getName() for iface in spec2+spec]
+        #  ['I3', 'I4', 'I1']
 
         seen = {}
         result = []
@@ -251,38 +246,38 @@
     """Return the interfaces implemented for a class' instances
 
       The value returned is an IDeclaration.
+    """
+    # For example:
+    #
+    #   >>> from zope.interface import Interface
+    #   >>> class I1(Interface): pass
+    #   ...
+    #   >>> class I2(I1): pass
+    #   ...
+    #   >>> class I3(Interface): pass
+    #   ...
+    #   >>> class I4(I3): pass
+    #   ...
+    #   >>> class C1(object):
+    #   ...   implements(I2)
+    #   >>> class C2(C1):
+    #   ...   implements(I3)
+    #   >>> [i.getName() for i in implementedBy(C2)]
+    #   ['I3', 'I2']
 
-      for example:
+    # Really, any object should be able to receive a successful answer, even
+    # an instance:
+    #
+    #   >>> class Callable(object):
+    #   ...     def __call__(self):
+    #   ...         return self
+    #
+    #   >>> implementedBy(Callable())
+    #   <implementedBy zope.interface.declarations.?>
+    #
+    # Note that the name of the spec ends with a '?', because the `Callable`
+    # instance does not have a `__name__` attribute.
 
-        >>> from zope.interface import Interface
-        >>> class I1(Interface): pass
-        ...
-        >>> class I2(I1): pass
-        ...
-        >>> class I3(Interface): pass
-        ...
-        >>> class I4(I3): pass
-        ...
-        >>> class C1(object):
-        ...   implements(I2)
-        >>> class C2(C1):
-        ...   implements(I3)
-        >>> [i.getName() for i in implementedBy(C2)]
-        ['I3', 'I2']
-
-      Really, any object should be able to receive a successful answer, even
-      an instance:
-
-        >>> class Callable(object):
-        ...     def __call__(self):
-        ...         return self
-
-        >>> implementedBy(Callable())
-        <implementedBy zope.interface.declarations.?>
-
-      Note that the name of the spec ends with a '?', because the `Callable`
-      instance does not have a `__name__` attribute.
-      """
     # This also manages storage of implementation specifications
 
     try:
@@ -377,31 +372,31 @@
 
       The interfaces given (including the interfaces in the specifications)
       replace any previous declarations.
+    """
+    # Consider the following example:
+    #
+    #   >>> from zope.interface import Interface
+    #   >>> class I1(Interface): pass
+    #   ...
+    #   >>> class I2(Interface): pass
+    #   ...
+    #   >>> class I3(Interface): pass
+    #   ...
+    #   >>> class I4(Interface): pass
+    #   ...
+    #   >>> class A(object):
+    #   ...   implements(I3)
+    #   >>> class B(object):
+    #   ...   implements(I4)
+    #   >>> class C(A, B):
+    #   ...   pass
+    #   >>> classImplementsOnly(C, I1, I2)
+    #   >>> [i.getName() for i in implementedBy(C)]
+    #   ['I1', 'I2']
+    #
+    # Instances of ``C`` provide only ``I1``, ``I2``, and regardless of
+    # whatever interfaces instances of ``A`` and ``B`` implement.
 
-      Consider the following example:
-
-        >>> from zope.interface import Interface
-        >>> class I1(Interface): pass
-        ...
-        >>> class I2(Interface): pass
-        ...
-        >>> class I3(Interface): pass
-        ...
-        >>> class I4(Interface): pass
-        ...
-        >>> class A(object):
-        ...   implements(I3)
-        >>> class B(object):
-        ...   implements(I4)
-        >>> class C(A, B):
-        ...   pass
-        >>> classImplementsOnly(C, I1, I2)
-        >>> [i.getName() for i in implementedBy(C)]
-        ['I1', 'I2']
-
-      Instances of ``C`` provide only ``I1``, ``I2``, and regardless of
-      whatever interfaces instances of ``A`` and ``B`` implement.
-      """
     spec = implementedBy(cls)
     spec.declared = ()
     spec.inherit = None
@@ -415,37 +410,36 @@
 
       The interfaces given (including the interfaces in the specifications)
       are added to any interfaces previously declared.
+    """
+    # Consider the following example:
+    #
+    #   >>> from zope.interface import Interface
+    #   >>> class I1(Interface): pass
+    #   ...
+    #   >>> class I2(Interface): pass
+    #   ...
+    #   >>> class I3(Interface): pass
+    #   ...
+    #   >>> class I4(Interface): pass
+    #   ...
+    #   >>> class I5(Interface): pass
+    #   ...
+    #   >>> class A(object):
+    #   ...   implements(I3)
+    #   >>> class B(object):
+    #   ...   implements(I4)
+    #   >>> class C(A, B):
+    #   ...   pass
+    #   >>> classImplements(C, I1, I2)
+    #   >>> [i.getName() for i in implementedBy(C)]
+    #   ['I1', 'I2', 'I3', 'I4']
+    #   >>> classImplements(C, I5)
+    #   >>> [i.getName() for i in implementedBy(C)]
+    #   ['I1', 'I2', 'I5', 'I3', 'I4']
 
-      Consider the following example:
+    # Instances of ``C`` provide ``I1``, ``I2``, ``I5``, and whatever
+    # interfaces instances of ``A`` and ``B`` provide.
 
-        >>> from zope.interface import Interface
-        >>> class I1(Interface): pass
-        ...
-        >>> class I2(Interface): pass
-        ...
-        >>> class I3(Interface): pass
-        ...
-        >>> class I4(Interface): pass
-        ...
-        >>> class I5(Interface): pass
-        ...
-        >>> class A(object):
-        ...   implements(I3)
-        >>> class B(object):
-        ...   implements(I4)
-        >>> class C(A, B):
-        ...   pass
-        >>> classImplements(C, I1, I2)
-        >>> [i.getName() for i in implementedBy(C)]
-        ['I1', 'I2', 'I3', 'I4']
-        >>> classImplements(C, I5)
-        >>> [i.getName() for i in implementedBy(C)]
-        ['I1', 'I2', 'I5', 'I3', 'I4']
-
-      Instances of ``C`` provide ``I1``, ``I2``, ``I5``, and whatever
-      interfaces instances of ``A`` and ``B`` provide.
-      """
-
     spec = implementedBy(cls)
     spec.declared += tuple(_normalizeargs(interfaces))
 
@@ -509,14 +503,15 @@
             return ob            
         
 def _implements(name, interfaces, classImplements):
+    if sys.version_info[0] >= 3: #pragma NO COVER
+        raise TypeError('Class advice impossible in Python3')
     frame = sys._getframe(2)
     locals = frame.f_locals
 
     # Try to make sure we were called from a class def. In 2.2.0 we can't
     # check for __module__ since it doesn't seem to be added to the locals
     # until later on.
-    if (locals is frame.f_globals) or (
-        ('__module__' not in locals) and sys.version_info[:3] > (2, 2, 0)):
+    if locals is frame.f_globals or '__module__' not in locals:
         raise TypeError(name+" can be used only from a class definition.")
 
     if '__implements_advice_data__' in locals:
@@ -550,40 +545,6 @@
         classImplements(C, I1)
 
       after the class has been created.
-
-      Consider the following example::
-
-
-        >>> from zope.interface import Interface
-        >>> class IA1(Interface): pass
-        ...
-        >>> class IA2(Interface): pass
-        ...
-        >>> class IB(Interface): pass
-        ...
-        >>> class IC(Interface): pass
-        ...
-        >>> class A(object):
-        ...     implements(IA1, IA2)
-        >>> class B(object):
-        ...     implements(IB)
-
-        >>> class C(A, B):
-        ...    implements(IC)
-
-        >>> ob = C()
-        >>> int(IA1 in providedBy(ob))
-        1
-        >>> int(IA2 in providedBy(ob))
-        1
-        >>> int(IB in providedBy(ob))
-        1
-        >>> int(IC in providedBy(ob))
-        1
-
-      Instances of ``C`` implement ``I1``, ``I2``, and whatever interfaces
-      instances of ``A`` and ``B`` implement.
-
       """
     _implements("implements", interfaces, classImplements)
 
@@ -608,40 +569,6 @@
         classImplementsOnly(I1)
 
       after the class has been created.
-
-      Consider the following example::
-
-        >>> from zope.interface import Interface
-        >>> class IA1(Interface): pass
-        ...
-        >>> class IA2(Interface): pass
-        ...
-        >>> class IB(Interface): pass
-        ...
-        >>> class IC(Interface): pass
-        ...
-        >>> class A(object):
-        ...     implements(IA1, IA2)
-        >>> class B(object):
-        ...     implements(IB)
-
-        >>> class C(A, B):
-        ...    implementsOnly(IC)
-
-        >>> ob = C()
-        >>> int(IA1 in providedBy(ob))
-        0
-        >>> int(IA2 in providedBy(ob))
-        0
-        >>> int(IB in providedBy(ob))
-        0
-        >>> int(IC in providedBy(ob))
-        1
-
-
-      Instances of ``C`` implement ``IC``, regardless of what
-      instances of ``A`` and ``B`` implement.
-
       """
     _implements("implementsOnly", interfaces, classImplementsOnly)
 
@@ -667,23 +594,22 @@
 
     def __get__(self, inst, cls):
         """Make sure that a class __provides__ doesn't leak to an instance
-
-        For example:
-
-          >>> from zope.interface import Interface
-          >>> class IFooFactory(Interface): pass
-          ...
-
-          >>> class C(object):
-          ...   pass
-
-          >>> C.__provides__ = ProvidesClass(C, IFooFactory)
-          >>> [i.getName() for i in C.__provides__]
-          ['IFooFactory']
-          >>> getattr(C(), '__provides__', 0)
-          0
-
         """
+        # For example:
+        #
+        #  >>> from zope.interface import Interface
+        #  >>> class IFooFactory(Interface): pass
+        #  ...
+        #
+        #  >>> class C(object):
+        #  ...   pass
+        #
+        #  >>> C.__provides__ = ProvidesClass(C, IFooFactory)
+        #  >>> [i.getName() for i in C.__provides__]
+        #  ['IFooFactory']
+        #  >>> getattr(C(), '__provides__', 0)
+        #  0
+
         if inst is None and cls is self._cls:
             # We were accessed through a class, so we are the class'
             # provides spec. Just return this object, but only if we are
@@ -703,56 +629,53 @@
 
       Instance declarations are shared among instances that have the same
       declaration. The declarations are cached in a weak value dictionary.
+    """
+    # (Note that, in the examples below, we are going to make assertions about
+    #  the size of the weakvalue dictionary.  For the assertions to be
+    #  meaningful, we need to force garbage collection to make sure garbage
+    #  objects are, indeed, removed from the system. Depending on how Python
+    #  is run, we may need to make multiple calls to be sure.  We provide a
+    #  collect function to help with this:
+    #
+    # >>> import gc
+    # >>> def collect():
+    # ...     for i in range(4):
+    # ...         gc.collect()
+    #
+    # >>> collect()
+    # >>> before = len(InstanceDeclarations)
+    #
+    # >>> class C(object):
+    # ...    pass
+    #
+    # >>> from zope.interface import Interface
+    # >>> class I(Interface):
+    # ...    pass
+    #
+    # >>> c1 = C()
+    # >>> c2 = C()
+    #
+    # >>> len(InstanceDeclarations) == before
+    # 1
+    #
+    # >>> directlyProvides(c1, I)
+    # >>> len(InstanceDeclarations) == before + 1
+    # 1
+    #
+    # >>> directlyProvides(c2, I)
+    # >>> len(InstanceDeclarations) == before + 1
+    # 1
+    #
+    # >>> del c1
+    # >>> collect()
+    # >>> len(InstanceDeclarations) == before + 1
+    # 1
+    #
+    # >>> del c2
+    # >>> collect()
+    # >>> len(InstanceDeclarations) == before
+    # 1
 
-      (Note that, in the examples below, we are going to make assertions about
-       the size of the weakvalue dictionary.  For the assertions to be
-       meaningful, we need to force garbage collection to make sure garbage
-       objects are, indeed, removed from the system. Depending on how Python
-       is run, we may need to make multiple calls to be sure.  We provide a
-       collect function to help with this:
-
-       >>> import gc
-       >>> def collect():
-       ...     for i in range(4):
-       ...         gc.collect()
-
-      )
-
-      >>> collect()
-      >>> before = len(InstanceDeclarations)
-
-      >>> class C(object):
-      ...    pass
-
-      >>> from zope.interface import Interface
-      >>> class I(Interface):
-      ...    pass
-
-      >>> c1 = C()
-      >>> c2 = C()
-
-      >>> len(InstanceDeclarations) == before
-      1
-
-      >>> directlyProvides(c1, I)
-      >>> len(InstanceDeclarations) == before + 1
-      1
-
-      >>> directlyProvides(c2, I)
-      >>> len(InstanceDeclarations) == before + 1
-      1
-
-      >>> del c1
-      >>> collect()
-      >>> len(InstanceDeclarations) == before + 1
-      1
-
-      >>> del c2
-      >>> collect()
-      >>> len(InstanceDeclarations) == before
-      1
-      """
-
     spec = InstanceDeclarations.get(interfaces)
     if spec is None:
         spec = ProvidesClass(*interfaces)
@@ -775,81 +698,82 @@
 
       The interfaces given (including the interfaces in the specifications)
       replace interfaces previously declared for the object.
+    """
+    # Consider the following example:
 
-      Consider the following example:
+    #   >>> from zope.interface import Interface
+    #   >>> class I1(Interface): pass
+    #   ...
+    #   >>> class I2(Interface): pass
+    #   ...
+    #   >>> class IA1(Interface): pass
+    #   ...
+    #   >>> class IA2(Interface): pass
+    #   ...
+    #   >>> class IB(Interface): pass
+    #   ...
+    #   >>> class IC(Interface): pass
+    #   ...
+    #   >>> class A(object):
+    #   ...     implements(IA1, IA2)
+    #   >>> class B(object):
+    #   ...     implements(IB)
 
-        >>> from zope.interface import Interface
-        >>> class I1(Interface): pass
-        ...
-        >>> class I2(Interface): pass
-        ...
-        >>> class IA1(Interface): pass
-        ...
-        >>> class IA2(Interface): pass
-        ...
-        >>> class IB(Interface): pass
-        ...
-        >>> class IC(Interface): pass
-        ...
-        >>> class A(object):
-        ...     implements(IA1, IA2)
-        >>> class B(object):
-        ...     implements(IB)
+    #   >>> class C(A, B):
+    #   ...    implements(IC)
 
-        >>> class C(A, B):
-        ...    implements(IC)
-
-        >>> ob = C()
-        >>> directlyProvides(ob, I1, I2)
-        >>> int(I1 in providedBy(ob))
-        1
-        >>> int(I2 in providedBy(ob))
-        1
-        >>> int(IA1 in providedBy(ob))
-        1
-        >>> int(IA2 in providedBy(ob))
-        1
-        >>> int(IB in providedBy(ob))
-        1
-        >>> int(IC in providedBy(ob))
-        1
-
-      The object, ``ob`` provides ``I1``, ``I2``, and whatever interfaces
-      instances have been declared for instances of ``C``.
-
-      To remove directly provided interfaces, use ``directlyProvidedBy`` and
-      subtract the unwanted interfaces. For example:
-
-        >>> directlyProvides(ob, directlyProvidedBy(ob)-I2)
-        >>> int(I1 in providedBy(ob))
-        1
-        >>> int(I2 in providedBy(ob))
-        0
-
-      removes I2 from the interfaces directly provided by ``ob``. The object,
-      ``ob`` no longer directly provides ``I2``, although it might still
-      provide ``I2`` if it's class implements ``I2``.
-
-      To add directly provided interfaces, use ``directlyProvidedBy`` and
-      include additional interfaces.  For example:
-
-        >>> int(I2 in providedBy(ob))
-        0
-        >>> directlyProvides(ob, directlyProvidedBy(ob), I2)
-
-      adds ``I2`` to the interfaces directly provided by ob::
-
-        >>> int(I2 in providedBy(ob))
-        1
-
-      """
-
+    #   >>> ob = C()
+    #   >>> directlyProvides(ob, I1, I2)
+    #   >>> int(I1 in providedBy(ob))
+    #   1
+    #   >>> int(I2 in providedBy(ob))
+    #   1
+    #   >>> int(IA1 in providedBy(ob))
+    #   1
+    #   >>> int(IA2 in providedBy(ob))
+    #   1
+    #   >>> int(IB in providedBy(ob))
+    #   1
+    #   >>> int(IC in providedBy(ob))
+    #   1
+    #
+    # The object, ``ob`` provides ``I1``, ``I2``, and whatever interfaces
+    # instances have been declared for instances of ``C``.
+    #
+    # To remove directly provided interfaces, use ``directlyProvidedBy`` and
+    # subtract the unwanted interfaces. For example:
+    #
+    #   >>> directlyProvides(ob, directlyProvidedBy(ob)-I2)
+    #   >>> int(I1 in providedBy(ob))
+    #   1
+    #   >>> int(I2 in providedBy(ob))
+    #   0
+    #
+    # removes I2 from the interfaces directly provided by ``ob``. The object,
+    # ``ob`` no longer directly provides ``I2``, although it might still
+    # provide ``I2`` if it's class implements ``I2``.
+    #
+    # To add directly provided interfaces, use ``directlyProvidedBy`` and
+    # include additional interfaces.  For example:
+    #
+    #   >>> int(I2 in providedBy(ob))
+    #   0
+    #   >>> directlyProvides(ob, directlyProvidedBy(ob), I2)
+    #
+    # adds ``I2`` to the interfaces directly provided by ob::
+    #
+    #   >>> int(I2 in providedBy(ob))
+    #   1
+    #
     # We need to avoid setting this attribute on meta classes that
     # don't support descriptors.
+    #
     # We can do away with this check when we get rid of the old EC
     cls = getattr(object, '__class__', None)
     if cls is not None and getattr(cls,  '__class__', None) is cls:
         # It's a meta class (well, at least it it could be an extension class)
+        # Note that we can't get here from Py3k tests:  there is no normal
+        # class which isn't descriptor aware.
         if not isinstance(object, DescriptorAwareMetaClasses):
             raise TypeError("Attempt to make an interface declaration on a "
                             "non-descriptor-aware class")
@@ -879,100 +803,99 @@
 
     The interfaces given (including the interfaces in the specifications) are
     added to the interfaces previously declared for the object.
-
-    Consider the following example:
-
-      >>> from zope.interface import Interface
-      >>> class I1(Interface): pass
-      ...
-      >>> class I2(Interface): pass
-      ...
-      >>> class IA1(Interface): pass
-      ...
-      >>> class IA2(Interface): pass
-      ...
-      >>> class IB(Interface): pass
-      ...
-      >>> class IC(Interface): pass
-      ...
-      >>> class A(object):
-      ...     implements(IA1, IA2)
-      >>> class B(object):
-      ...     implements(IB)
-
-      >>> class C(A, B):
-      ...    implements(IC)
-
-      >>> ob = C()
-      >>> directlyProvides(ob, I1)
-      >>> int(I1 in providedBy(ob))
-      1
-      >>> int(I2 in providedBy(ob))
-      0
-      >>> int(IA1 in providedBy(ob))
-      1
-      >>> int(IA2 in providedBy(ob))
-      1
-      >>> int(IB in providedBy(ob))
-      1
-      >>> int(IC in providedBy(ob))
-      1
-
-      >>> alsoProvides(ob, I2)
-      >>> int(I1 in providedBy(ob))
-      1
-      >>> int(I2 in providedBy(ob))
-      1
-      >>> int(IA1 in providedBy(ob))
-      1
-      >>> int(IA2 in providedBy(ob))
-      1
-      >>> int(IB in providedBy(ob))
-      1
-      >>> int(IC in providedBy(ob))
-      1
-
-    The object, ``ob`` provides ``I1``, ``I2``, and whatever interfaces
-    instances have been declared for instances of ``C``. Notice that the
-    alsoProvides just extends the provided interfaces.
     """
+    # Consider the following example:
+    #
+    # >>> from zope.interface import Interface
+    # >>> class I1(Interface): pass
+    # ...
+    # >>> class I2(Interface): pass
+    # ...
+    # >>> class IA1(Interface): pass
+    # ...
+    # >>> class IA2(Interface): pass
+    # ...
+    # >>> class IB(Interface): pass
+    # ...
+    # >>> class IC(Interface): pass
+    # ...
+    # >>> class A(object):
+    # ...     implements(IA1, IA2)
+    # >>> class B(object):
+    # ...     implements(IB)
+    #
+    # >>> class C(A, B):
+    # ...    implements(IC)
+    #
+    # >>> ob = C()
+    # >>> directlyProvides(ob, I1)
+    # >>> int(I1 in providedBy(ob))
+    # 1
+    # >>> int(I2 in providedBy(ob))
+    # 0
+    # >>> int(IA1 in providedBy(ob))
+    # 1
+    # >>> int(IA2 in providedBy(ob))
+    # 1
+    # >>> int(IB in providedBy(ob))
+    # 1
+    # >>> int(IC in providedBy(ob))
+    # 1
+    #
+    # >>> alsoProvides(ob, I2)
+    # >>> int(I1 in providedBy(ob))
+    # 1
+    # >>> int(I2 in providedBy(ob))
+    # 1
+    # >>> int(IA1 in providedBy(ob))
+    # 1
+    # >>> int(IA2 in providedBy(ob))
+    # 1
+    # >>> int(IB in providedBy(ob))
+    # 1
+    # >>> int(IC in providedBy(ob))
+    # 1
+    #
+    # The object, ``ob`` provides ``I1``, ``I2``, and whatever interfaces
+    # instances have been declared for instances of ``C``. Notice that the
+    # alsoProvides just extends the provided interfaces.
+
     directlyProvides(object, directlyProvidedBy(object), *interfaces)
 
 def noLongerProvides(object, interface):
+    """ Removes a directly provided interface from an object.
     """
-    This removes a directly provided interface from an object.
-    Consider the following two interfaces:
+    # Consider the following two interfaces:
+    #
+    # >>> from zope.interface import Interface
+    # >>> class I1(Interface): pass
+    # ...
+    # >>> class I2(Interface): pass
+    # ...
+    #
+    # ``I1`` is provided through the class, ``I2`` is directly provided
+    # by the object:
+    #
+    # >>> class C(object):
+    # ...    implements(I1)
+    # >>> c = C()
+    # >>> alsoProvides(c, I2)
+    # >>> I2.providedBy(c)
+    # True
+    #
+    # Remove I2 from c again:
+    # 
+    # >>> noLongerProvides(c, I2)
+    # >>> I2.providedBy(c)
+    # False
+    #
+    # Removing an interface that is provided through the class is not possible:
+    #
+    # >>> noLongerProvides(c, I1)
+    # Traceback (most recent call last):
+    # ...
+    # ValueError: Can only remove directly provided interfaces.
 
-      >>> from zope.interface import Interface
-      >>> class I1(Interface): pass
-      ...
-      >>> class I2(Interface): pass
-      ...
-
-    ``I1`` is provided through the class, ``I2`` is directly provided
-    by the object:
-    
-      >>> class C(object):
-      ...    implements(I1)
-      >>> c = C()
-      >>> alsoProvides(c, I2)
-      >>> I2.providedBy(c)
-      True
-
-    Remove I2 from c again:
-      
-      >>> noLongerProvides(c, I2)
-      >>> I2.providedBy(c)
-      False
-
-    Removing an interface that is provided through the class is not possible:
-
-      >>> noLongerProvides(c, I1)
-      Traceback (most recent call last):
-      ...
-      ValueError: Can only remove directly provided interfaces.
-
-    """
     directlyProvides(object, directlyProvidedBy(object)-interface)
     if interface.providedBy(object):
         raise ValueError("Can only remove directly provided interfaces.")
@@ -1010,23 +933,22 @@
     The descriptor caches the implementedBy info, so that
     we can get declarations for objects without instance-specific
     interfaces a bit quicker.
-
-    For example:
-
-      >>> from zope.interface import Interface
-      >>> class IFooFactory(Interface):
-      ...     pass
-      >>> class IFoo(Interface):
-      ...     pass
-      >>> class C(object):
-      ...     implements(IFoo)
-      ...     classProvides(IFooFactory)
-      >>> [i.getName() for i in C.__provides__]
-      ['IFooFactory']
-
-      >>> [i.getName() for i in C().__provides__]
-      ['IFoo']
     """
+    # For example:
+    #
+    # >>> from zope.interface import Interface
+    # >>> class IFooFactory(Interface):
+    # ...     pass
+    # >>> class IFoo(Interface):
+    # ...     pass
+    # >>> class C(object):
+    # ...     implements(IFoo)
+    # ...     classProvides(IFooFactory)
+    # >>> [i.getName() for i in C.__provides__]
+    # ['IFooFactory']
+    #
+    # >>> [i.getName() for i in C().__provides__]
+    # ['IFoo']
 
     def __init__(self, cls, metacls, *interfaces):
         self._cls = cls
@@ -1085,44 +1007,46 @@
         directlyProvides(theclass, I1)
 
       after the class has been created.
+    """
+    # For example:
+    #
+    #   >>> from zope.interface import Interface
+    #   >>> class IFoo(Interface): pass
+    #   ...
+    #   >>> class IFooFactory(Interface): pass
+    #   ...
+    #   >>> class C(object):
+    #   ...   implements(IFoo)
+    #   ...   classProvides(IFooFactory)
+    #   >>> [i.getName() for i in C.__providedBy__]
+    #   ['IFooFactory']
+    #   >>> [i.getName() for i in C().__providedBy__]
+    #   ['IFoo']
+    #
+    # if equivalent to:
+    #
+    #   >>> from zope.interface import Interface
+    #   >>> class IFoo(Interface): pass
+    #   ...
+    #   >>> class IFooFactory(Interface): pass
+    #   ...
+    #   >>> class C(object):
+    #   ...   implements(IFoo)
+    #   >>> directlyProvides(C, IFooFactory)
+    #   >>> [i.getName() for i in C.__providedBy__]
+    #   ['IFooFactory']
+    #   >>> [i.getName() for i in C().__providedBy__]
+    #   ['IFoo']
+    if sys.version_info[0] >= 3: #pragma NO COVER
+        raise TypeError('Class advice impossible in Python3')
 
-      For example:
-
-        >>> from zope.interface import Interface
-        >>> class IFoo(Interface): pass
-        ...
-        >>> class IFooFactory(Interface): pass
-        ...
-        >>> class C(object):
-        ...   implements(IFoo)
-        ...   classProvides(IFooFactory)
-        >>> [i.getName() for i in C.__providedBy__]
-        ['IFooFactory']
-        >>> [i.getName() for i in C().__providedBy__]
-        ['IFoo']
-
-      if equivalent to:
-
-        >>> from zope.interface import Interface
-        >>> class IFoo(Interface): pass
-        ...
-        >>> class IFooFactory(Interface): pass
-        ...
-        >>> class C(object):
-        ...   implements(IFoo)
-        >>> directlyProvides(C, IFooFactory)
-        >>> [i.getName() for i in C.__providedBy__]
-        ['IFooFactory']
-        >>> [i.getName() for i in C().__providedBy__]
-        ['IFoo']
-
-      """
     frame = sys._getframe(1)
     locals = frame.f_locals
 
     # Try to make sure we were called from a class def
     if (locals is frame.f_globals) or ('__module__' not in locals):
-        raise TypeError("classProvides can be used only from a class definition.")
+        raise TypeError("classProvides can be used only from a "
+                        "class definition.")
 
     if '__provides__' in locals:
         raise TypeError(
@@ -1196,67 +1120,66 @@
     """Provide object specifications
 
     These combine information for the object and for it's classes.
-
-    For example:
-
-      >>> from zope.interface import Interface
-      >>> class I1(Interface): pass
-      ...
-      >>> class I2(Interface): pass
-      ...
-      >>> class I3(Interface): pass
-      ...
-      >>> class I31(I3): pass
-      ...
-      >>> class I4(Interface): pass
-      ...
-      >>> class I5(Interface): pass
-      ...
-      >>> class A(object):
-      ...     implements(I1)
-      >>> class B(object): __implemented__ = I2
-      ...
-      >>> class C(A, B):
-      ...     implements(I31)
-      >>> c = C()
-      >>> directlyProvides(c, I4)
-      >>> [i.getName() for i in providedBy(c)]
-      ['I4', 'I31', 'I1', 'I2']
-      >>> [i.getName() for i in providedBy(c).flattened()]
-      ['I4', 'I31', 'I3', 'I1', 'I2', 'Interface']
-      >>> int(I1 in providedBy(c))
-      1
-      >>> int(I3 in providedBy(c))
-      0
-      >>> int(providedBy(c).extends(I3))
-      1
-      >>> int(providedBy(c).extends(I31))
-      1
-      >>> int(providedBy(c).extends(I5))
-      0
-      >>> class COnly(A, B):
-      ...     implementsOnly(I31)
-      >>> class D(COnly):
-      ...     implements(I5)
-      >>> c = D()
-      >>> directlyProvides(c, I4)
-      >>> [i.getName() for i in providedBy(c)]
-      ['I4', 'I5', 'I31']
-      >>> [i.getName() for i in providedBy(c).flattened()]
-      ['I4', 'I5', 'I31', 'I3', 'Interface']
-      >>> int(I1 in providedBy(c))
-      0
-      >>> int(I3 in providedBy(c))
-      0
-      >>> int(providedBy(c).extends(I3))
-      1
-      >>> int(providedBy(c).extends(I1))
-      0
-      >>> int(providedBy(c).extends(I31))
-      1
-      >>> int(providedBy(c).extends(I5))
-      1
     """
+    # For example:
+    #
+    # >>> from zope.interface import Interface
+    # >>> class I1(Interface): pass
+    # ...
+    # >>> class I2(Interface): pass
+    # ...
+    # >>> class I3(Interface): pass
+    # ...
+    # >>> class I31(I3): pass
+    # ...
+    # >>> class I4(Interface): pass
+    # ...
+    # >>> class I5(Interface): pass
+    # ...
+    # >>> class A(object):
+    # ...     implements(I1)
+    # >>> class B(object): __implemented__ = I2
+    # ...
+    # >>> class C(A, B):
+    # ...     implements(I31)
+    # >>> c = C()
+    # >>> directlyProvides(c, I4)
+    # >>> [i.getName() for i in providedBy(c)]
+    # ['I4', 'I31', 'I1', 'I2']
+    # >>> [i.getName() for i in providedBy(c).flattened()]
+    # ['I4', 'I31', 'I3', 'I1', 'I2', 'Interface']
+    # >>> int(I1 in providedBy(c))
+    # 1
+    # >>> int(I3 in providedBy(c))
+    # 0
+    # >>> int(providedBy(c).extends(I3))
+    # 1
+    # >>> int(providedBy(c).extends(I31))
+    # 1
+    # >>> int(providedBy(c).extends(I5))
+    # 0
+    # >>> class COnly(A, B):
+    # ...     implementsOnly(I31)
+    # >>> class D(COnly):
+    # ...     implements(I5)
+    # >>> c = D()
+    # >>> directlyProvides(c, I4)
+    # >>> [i.getName() for i in providedBy(c)]
+    # ['I4', 'I5', 'I31']
+    # >>> [i.getName() for i in providedBy(c).flattened()]
+    # ['I4', 'I5', 'I31', 'I3', 'Interface']
+    # >>> int(I1 in providedBy(c))
+    # 0
+    # >>> int(I3 in providedBy(c))
+    # 0
+    # >>> int(providedBy(c).extends(I3))
+    # 1
+    # >>> int(providedBy(c).extends(I1))
+    # 0
+    # >>> int(providedBy(c).extends(I31))
+    # 1
+    # >>> int(providedBy(c).extends(I5))
+    # 1
 
     return Provides(cls, direct) #pragma NO COVER fossil
 
@@ -1337,23 +1260,21 @@
 
     def __get__(self, inst, cls):
         """Get an object specification for an object
-
-        For example:
-
-          >>> from zope.interface import Interface
-          >>> class IFoo(Interface): pass
-          ...
-          >>> class IFooFactory(Interface): pass
-          ...
-          >>> class C(object):
-          ...   implements(IFoo)
-          ...   classProvides(IFooFactory)
-          >>> [i.getName() for i in C.__providedBy__]
-          ['IFooFactory']
-          >>> [i.getName() for i in C().__providedBy__]
-          ['IFoo']
-
         """
+        # For example:
+        #
+        # >>> from zope.interface import Interface
+        # >>> class IFoo(Interface): pass
+        # ...
+        # >>> class IFooFactory(Interface): pass
+        # ...
+        # >>> class C(object):
+        # ...   implements(IFoo)
+        # ...   classProvides(IFooFactory)
+        # >>> [i.getName() for i in C.__providedBy__]
+        # ['IFooFactory']
+        # >>> [i.getName() for i in C().__providedBy__]
+        # ['IFoo']
 
         # Get an ObjectSpecification bound to either an instance or a class,
         # depending on how we were accessed.

Modified: zope.interface/branches/tseaver-no_2to3/src/zope/interface/document.py
===================================================================
--- zope.interface/branches/tseaver-no_2to3/src/zope/interface/document.py	2012-04-04 23:31:42 UTC (rev 124955)
+++ zope.interface/branches/tseaver-no_2to3/src/zope/interface/document.py	2012-04-04 23:40:49 UTC (rev 124956)
@@ -41,8 +41,7 @@
             outp(_justify_and_indent(_trim_doc_string(item), level, munge))
         level -= 1
 
-    namesAndDescriptions = I.namesAndDescriptions()
-    namesAndDescriptions.sort()
+    namesAndDescriptions = sorted(I.namesAndDescriptions())
 
     outp(_justify_and_indent("Attributes:", level, munge))
     level += 1

Modified: zope.interface/branches/tseaver-no_2to3/src/zope/interface/interface.py
===================================================================
--- zope.interface/branches/tseaver-no_2to3/src/zope/interface/interface.py	2012-04-04 23:31:42 UTC (rev 124955)
+++ zope.interface/branches/tseaver-no_2to3/src/zope/interface/interface.py	2012-04-04 23:40:49 UTC (rev 124956)
@@ -16,12 +16,16 @@
 from __future__ import generators
 
 import sys
+from types import MethodType
 from types import FunctionType
 import warnings
 import weakref
 
 from zope.interface.exceptions import Invalid
 from zope.interface.ro import ro
+from zope.interface._compat import _FUNC_CODE
+from zope.interface._compat import _FUNC_DEFAULTS
+from zope.interface._compat import _IM_FUNC
 
 
 CO_VARARGS = 4
@@ -92,30 +96,29 @@
 
     def providedBy(self, ob):
         """Is the interface implemented by an object
+        """
+        # >>> from zope.interface import *
+        # >>> class I1(Interface):
+        # ...     pass
+        # >>> class C(object):
+        # ...     implements(I1)
+        # >>> c = C()
+        # >>> class X(object):
+        # ...     pass
+        # >>> x = X()
+        # >>> I1.providedBy(x)
+        # False
+        # >>> I1.providedBy(C)
+        # False
+        # >>> I1.providedBy(c)
+        # True
+        # >>> directlyProvides(x, I1)
+        # >>> I1.providedBy(x)
+        # True
+        # >>> directlyProvides(C, I1)
+        # >>> I1.providedBy(C)
+        # True
 
-          >>> from zope.interface import *
-          >>> class I1(Interface):
-          ...     pass
-          >>> class C(object):
-          ...     implements(I1)
-          >>> c = C()
-          >>> class X(object):
-          ...     pass
-          >>> x = X()
-          >>> I1.providedBy(x)
-          False
-          >>> I1.providedBy(C)
-          False
-          >>> I1.providedBy(c)
-          True
-          >>> directlyProvides(x, I1)
-          >>> I1.providedBy(x)
-          True
-          >>> directlyProvides(C, I1)
-          >>> I1.providedBy(C)
-          True
-
-        """
         spec = providedBy(ob)
         return self in spec._implied
 
@@ -127,35 +130,34 @@
 
     def isOrExtends(self, interface):
         """Is the interface the same as or extend the given interface
+        """
+        # Examples::
+        #
+        # >>> from zope.interface import Interface
+        # >>> from zope.interface.declarations import Declaration
+        # >>> class I1(Interface): pass
+        # ...
+        # >>> class I2(I1): pass
+        # ...
+        # >>> class I3(Interface): pass
+        # ...
+        # >>> class I4(I3): pass
+        # ...
+        # >>> spec = Declaration()
+        # >>> int(spec.extends(Interface))
+        # 1
+        # >>> spec = Declaration(I2)
+        # >>> int(spec.extends(Interface))
+        # 1
+        # >>> int(spec.extends(I1))
+        # 1
+        # >>> int(spec.extends(I2))
+        # 1
+        # >>> int(spec.extends(I3))
+        # 0
+        # >>> int(spec.extends(I4))
+        # 0
 
-        Examples::
-
-          >>> from zope.interface import Interface
-          >>> from zope.interface.declarations import Declaration
-          >>> class I1(Interface): pass
-          ...
-          >>> class I2(I1): pass
-          ...
-          >>> class I3(Interface): pass
-          ...
-          >>> class I4(I3): pass
-          ...
-          >>> spec = Declaration()
-          >>> int(spec.extends(Interface))
-          1
-          >>> spec = Declaration(I2)
-          >>> int(spec.extends(Interface))
-          1
-          >>> int(spec.extends(I1))
-          1
-          >>> int(spec.extends(I2))
-          1
-          >>> int(spec.extends(I3))
-          0
-          >>> int(spec.extends(I4))
-          0
-
-        """
         return interface in self._implied
 
     __call__ = isOrExtends
@@ -226,35 +228,33 @@
 
     Specifications are mutable.  If you reassign their bases, their
     relations with other specifications are adjusted accordingly.
-
-    For example:
-
-    >>> from zope.interface import Interface
-    >>> class I1(Interface):
-    ...     pass
-    >>> class I2(I1):
-    ...     pass
-    >>> class I3(I2):
-    ...     pass
-
-    >>> [i.__name__ for i in I1.__bases__]
-    ['Interface']
-
-    >>> [i.__name__ for i in I2.__bases__]
-    ['I1']
-
-    >>> I3.extends(I1)
-    1
-
-    >>> I2.__bases__ = (Interface, )
-
-    >>> [i.__name__ for i in I2.__bases__]
-    ['Interface']
-
-    >>> I3.extends(I1)
-    0
-
     """
+    # For example:
+    #
+    # >>> from zope.interface import Interface
+    # >>> class I1(Interface):
+    # ...     pass
+    # >>> class I2(I1):
+    # ...     pass
+    # >>> class I3(I2):
+    # ...     pass
+    #
+    # >>> [i.__name__ for i in I1.__bases__]
+    # ['Interface']
+    #
+    # >>> [i.__name__ for i in I2.__bases__]
+    # ['I1']
+    #
+    # >>> I3.extends(I1)
+    # 1
+    #
+    # >>> I2.__bases__ = (Interface, )
+    #
+    # >>> [i.__name__ for i in I2.__bases__]
+    # ['Interface']
+    #
+    # >>> I3.extends(I1)
+    # 0
 
     # Copy some base class methods for speed
     isOrExtends = SpecificationBase.isOrExtends
@@ -329,27 +329,27 @@
 
 
     def interfaces(self):
-        """Return an iterator for the interfaces in the specification
+        """Return an iterator for the interfaces in the specification.
+        """
+        # For example::
+        #
+        # >>> from zope.interface import Interface
+        # >>> class I1(Interface): pass
+        # ...
+        # >>> class I2(I1): pass
+        # ...
+        # >>> class I3(Interface): pass
+        # ...
+        # >>> class I4(I3): pass
+        # ...
+        # >>> spec = Specification((I2, I3))
+        # >>> spec = Specification((I4, spec))
+        # >>> i = spec.interfaces()
+        # >>> [x.getName() for x in i]
+        # ['I4', 'I2', 'I3']
+        # >>> list(i)
+        # []
 
-        for example::
-
-          >>> from zope.interface import Interface
-          >>> class I1(Interface): pass
-          ...
-          >>> class I2(I1): pass
-          ...
-          >>> class I3(Interface): pass
-          ...
-          >>> class I4(I3): pass
-          ...
-          >>> spec = Specification((I2, I3))
-          >>> spec = Specification((I4, spec))
-          >>> i = spec.interfaces()
-          >>> [x.getName() for x in i]
-          ['I4', 'I2', 'I3']
-          >>> list(i)
-          []
-        """
         seen = {}
         for base in self.__bases__:
             for interface in base.interfaces():
@@ -363,41 +363,40 @@
 
         Test whether an interface in the specification extends the
         given interface
+        """
+        # Examples::
+        #
+        # >>> from zope.interface import Interface
+        # >>> from zope.interface.declarations import Declaration
+        # >>> class I1(Interface): pass
+        # ...
+        # >>> class I2(I1): pass
+        # ...
+        # >>> class I3(Interface): pass
+        # ...
+        # >>> class I4(I3): pass
+        # ...
+        # >>> spec = Declaration()
+        # >>> int(spec.extends(Interface))
+        # 1
+        # >>> spec = Declaration(I2)
+        # >>> int(spec.extends(Interface))
+        # 1
+        # >>> int(spec.extends(I1))
+        # 1
+        # >>> int(spec.extends(I2))
+        # 1
+        # >>> int(spec.extends(I3))
+        # 0
+        # >>> int(spec.extends(I4))
+        # 0
+        # >>> I2.extends(I2)
+        # 0
+        # >>> I2.extends(I2, False)
+        # 1
+        # >>> I2.extends(I2, strict=False)
+        # 1
 
-        Examples::
-
-          >>> from zope.interface import Interface
-          >>> from zope.interface.declarations import Declaration
-          >>> class I1(Interface): pass
-          ...
-          >>> class I2(I1): pass
-          ...
-          >>> class I3(Interface): pass
-          ...
-          >>> class I4(I3): pass
-          ...
-          >>> spec = Declaration()
-          >>> int(spec.extends(Interface))
-          1
-          >>> spec = Declaration(I2)
-          >>> int(spec.extends(Interface))
-          1
-          >>> int(spec.extends(I1))
-          1
-          >>> int(spec.extends(I2))
-          1
-          >>> int(spec.extends(I3))
-          0
-          >>> int(spec.extends(I4))
-          0
-          >>> I2.extends(I2)
-          0
-          >>> I2.extends(I2, False)
-          1
-          >>> I2.extends(I2, strict=False)
-          1
-
-        """
         return ((interface in self._implied)
                 and
                 ((not strict) or (self != interface))
@@ -502,20 +501,20 @@
         self.__identifier__ = "%s.%s" % (self.__module__, self.__name__)
 
     def interfaces(self):
-        """Return an iterator for the interfaces in the specification
+        """Return an iterator for the interfaces in the specification.
+        """
+        # For example::
+        #
+        # >>> from zope.interface import Interface
+        # >>> class I1(Interface): pass
+        # ...
+        # >>>
+        # >>> i = I1.interfaces()
+        # >>> [x.getName() for x in i]
+        # ['I1']
+        # >>> list(i)
+        # []
 
-        for example::
-
-          >>> from zope.interface import Interface
-          >>> class I1(Interface): pass
-          ...
-          >>>
-          >>> i = I1.interfaces()
-          >>> [x.getName() for x in i]
-          ['I1']
-          >>> list(i)
-          []
-        """
         yield self
 
     def getBases(self):
@@ -577,7 +576,7 @@
         if hasattr(self, "_deferred"): return self._deferred
 
         klass={}
-        exec "class %s: pass" % self.__name__ in klass
+        exec("class %s: pass" % self.__name__, klass)
         klass=klass[self.__name__]
 
         self.__d(klass)
@@ -591,7 +590,7 @@
         for call in self.queryTaggedValue('invariants', []):
             try:
                 call(obj)
-            except Invalid, e:
+            except Invalid as e:
                 if errors is None:
                     raise
                 else:
@@ -777,12 +776,11 @@
 
         return "(%s)" % ", ".join(sig)
 
-
 def fromFunction(func, interface=None, imlevel=0, name=None):
     name = name or func.__name__
     method = Method(name, func.__doc__)
-    defaults = func.func_defaults or ()
-    code = func.func_code
+    defaults = getattr(func, _FUNC_DEFAULTS, None) or ()
+    code = getattr(func, _FUNC_CODE)
     # Number of positional arguments
     na = code.co_argcount-imlevel
     names = code.co_varnames[imlevel:]
@@ -824,7 +822,10 @@
 
 
 def fromMethod(meth, interface=None, name=None):
-    func = meth.im_func
+    if isinstance(meth, MethodType):
+        func = getattr(meth, _IM_FUNC)
+    else:
+        func = meth
     return fromFunction(func, interface, imlevel=1, name=name)
 
 

Modified: zope.interface/branches/tseaver-no_2to3/src/zope/interface/interfaces.py
===================================================================
--- zope.interface/branches/tseaver-no_2to3/src/zope/interface/interfaces.py	2012-04-04 23:31:42 UTC (rev 124955)
+++ zope.interface/branches/tseaver-no_2to3/src/zope/interface/interfaces.py	2012-04-04 23:40:49 UTC (rev 124956)
@@ -17,9 +17,11 @@
 
 from zope.interface.interface import Attribute
 from zope.interface.interface import Interface
-from zope.interface.declarations import implements
-from zope.interface.declarations import implementer # required by py3k fixers
+from zope.interface.declarations import implementer
+from zope.interface._compat import _u
 
+_BLANK = _u('')
+
 class IElement(Interface):
     """Objects that have basic documentation and tagged values.
     """
@@ -526,7 +528,7 @@
     def implements(*interfaces):
         """Declare interfaces implemented by instances of a class
 
-        This function is called in a class definition.
+        This function is called in a class definition (Python 2.x only).
 
         The arguments are one or more interfaces or interface
         specifications (IDeclaration objects).
@@ -549,7 +551,7 @@
 
         after the class has been created.
 
-        Consider the following example::
+        Consider the following example (Python 2.x only)::
 
           class C(A, B):
             implements(I1, I2)
@@ -562,7 +564,7 @@
     def implementsOnly(*interfaces):
         """Declare the only interfaces implemented by instances of a class
 
-        This function is called in a class definition.
+        This function is called in a class definition (Python 2.x only).
 
         The arguments are one or more interfaces or interface
         specifications (IDeclaration objects).
@@ -581,7 +583,7 @@
 
         after the class has been created.
 
-        Consider the following example::
+        Consider the following example (Python 2.x only)::
 
           class C(A, B):
             implementsOnly(I1, I2)
@@ -677,7 +679,7 @@
         provided interface, and a name.
         """
 
-    def registered(required, provided, name=u''):
+    def registered(required, provided, name=_BLANK):
         """Return the component registered for the given interfaces and name
 
         Unlike the lookup method, this methods won't retrieve
@@ -696,22 +698,22 @@
         specifications, a provided interface, and a name.
         """
 
-    def queryMultiAdapter(objects, provided, name=u'', default=None):
+    def queryMultiAdapter(objects, provided, name=_BLANK, default=None):
         """Adapt a sequence of objects to a named, provided, interface
         """
 
-    def lookup1(required, provided, name=u'', default=None):
+    def lookup1(required, provided, name=_BLANK, default=None):
         """Lookup a value using a single required interface
 
         A value is looked up based on a single required
         specifications, a provided interface, and a name.
         """
 
-    def queryAdapter(object, provided, name=u'', default=None):
+    def queryAdapter(object, provided, name=_BLANK, default=None):
         """Adapt an object using a registered adapter factory.
         """
 
-    def adapter_hook(provided, object, name=u'', default=None):
+    def adapter_hook(provided, object, name=_BLANK, default=None):
         """Adapt an object using a registered adapter factory.
         """
 
@@ -725,7 +727,7 @@
         """Return the names for which there are registered objects
         """
 
-    def subscribe(required, provided, subscriber, name=u''):
+    def subscribe(required, provided, subscriber, name=_BLANK):
         """Register a subscriber
 
         A subscriber is registered for a *sequence* of required
@@ -735,14 +737,14 @@
         equivalent) interfaces.
         """
 
-    def subscriptions(required, provided, name=u''):
+    def subscriptions(required, provided, name=_BLANK):
         """Get a sequence of subscribers
 
         Subscribers for a *sequence* of required interfaces, and a provided
         interface are returned.
         """
 
-    def subscribers(objects, provided, name=u''):
+    def subscribers(objects, provided, name=_BLANK):
         """Get a sequence of subscription adapters
         """
 
@@ -764,8 +766,8 @@
     object = Attribute("The subject of the event.")
 
 
+ at implementer(IObjectEvent)
 class ObjectEvent(object):
-    implements(IObjectEvent)
 
     def __init__(self, object):
         self.object = object
@@ -783,26 +785,26 @@
     utilities = Attribute(
         "Adapter Registry to manage all registered utilities.")
 
-    def queryAdapter(object, interface, name=u'', default=None):
+    def queryAdapter(object, interface, name=_BLANK, default=None):
         """Look for a named adapter to an interface for an object
 
         If a matching adapter cannot be found, returns the default.
         """
 
-    def getAdapter(object, interface, name=u''):
+    def getAdapter(object, interface, name=_BLANK):
         """Look for a named adapter to an interface for an object
 
         If a matching adapter cannot be found, a ComponentLookupError
         is raised.
         """
 
-    def queryMultiAdapter(objects, interface, name=u'', default=None):
+    def queryMultiAdapter(objects, interface, name=_BLANK, default=None):
         """Look for a multi-adapter to an interface for multiple objects
 
         If a matching adapter cannot be found, returns the default.
         """
 
-    def getMultiAdapter(objects, interface, name=u''):
+    def getMultiAdapter(objects, interface, name=_BLANK):
         """Look for a multi-adapter to an interface for multiple objects
 
         If a matching adapter cannot be found, a ComponentLookupError
@@ -914,11 +916,11 @@
 class IRegistrationEvent(IObjectEvent):
     """An event that involves a registration"""
 
+
+ at implementer(IRegistrationEvent)
 class RegistrationEvent(ObjectEvent):
     """There has been a change in a registration
     """
-    implements(IRegistrationEvent)
-
     def __repr__(self):
         return "%s event:\n%r" % (self.__class__.__name__, self.object)
 
@@ -926,24 +928,26 @@
     """A component or factory was registered
     """
 
+ at implementer(IRegistered)
 class Registered(RegistrationEvent):
-    implements(IRegistered)
+    pass
 
 class IUnregistered(IRegistrationEvent):
     """A component or factory was unregistered
     """
 
+ at implementer(IUnregistered)
 class Unregistered(RegistrationEvent):
     """A component or factory was unregistered
     """
-    implements(IUnregistered)
+    pass
 
 class IComponentRegistry(Interface):
     """Register components
     """
 
-    def registerUtility(component=None, provided=None, name=u'',
-                        info=u'', factory=None):
+    def registerUtility(component=None, provided=None, name=_BLANK,
+                        info=_BLANK, factory=None):
         """Register a utility
 
         factory
@@ -969,7 +973,7 @@
         A Registered event is generated with an IUtilityRegistration.
         """
 
-    def unregisterUtility(component=None, provided=None, name=u'',
+    def unregisterUtility(component=None, provided=None, name=_BLANK,
                           factory=None):
         """Unregister a utility
 
@@ -1008,8 +1012,8 @@
         in the object.
         """
 
-    def registerAdapter(factory, required=None, provided=None, name=u'',
-                       info=u''):
+    def registerAdapter(factory, required=None, provided=None, name=_BLANK,
+                       info=_BLANK):
         """Register an adapter factory
 
         Parameters:
@@ -1046,7 +1050,7 @@
         """
 
     def unregisterAdapter(factory=None, required=None,
-                          provided=None, name=u''):
+                          provided=None, name=_BLANK):
         """Register an adapter factory
 
         A boolean is returned indicating whether the registry was
@@ -1096,7 +1100,7 @@
         """
 
     def registerSubscriptionAdapter(factory, required=None, provides=None,
-                                    name=u'', info=''):
+                                    name=_BLANK, info=''):
         """Register a subscriber factory
 
         Parameters:
@@ -1137,7 +1141,7 @@
         """
 
     def unregisterSubscriptionAdapter(factory=None, required=None,
-                                      provides=None, name=u''):
+                                      provides=None, name=_BLANK):
         """Unregister a subscriber factory.
 
         A boolean is returned indicating whether the registry was
@@ -1191,7 +1195,7 @@
         registrations in the object.
         """
 
-    def registerHandler(handler, required=None, name=u'', info=''):
+    def registerHandler(handler, required=None, name=_BLANK, info=''):
         """Register a handler.
 
         A handler is a subscriber that doesn't compute an adapter
@@ -1229,7 +1233,7 @@
         A Registered event is generated with an IHandlerRegistration.
         """
 
-    def unregisterHandler(handler=None, required=None, name=u''):
+    def unregisterHandler(handler=None, required=None, name=_BLANK):
         """Unregister a handler.
 
         A handler is a subscriber that doesn't compute an adapter

Modified: zope.interface/branches/tseaver-no_2to3/src/zope/interface/registry.py
===================================================================
--- zope.interface/branches/tseaver-no_2to3/src/zope/interface/registry.py	2012-04-04 23:31:42 UTC (rev 124955)
+++ zope.interface/branches/tseaver-no_2to3/src/zope/interface/registry.py	2012-04-04 23:40:49 UTC (rev 124956)
@@ -13,9 +13,6 @@
 ##############################################################################
 """Basic components support
 """
-import sys
-import types
-
 try:
     from zope.event import notify
 except ImportError: #pragma NO COVER
@@ -33,28 +30,18 @@
 
 from zope.interface.interface import Interface
 from zope.interface.declarations import implementedBy
-from zope.interface.declarations import implements
-from zope.interface.declarations import implementsOnly
+from zope.interface.declarations import implementer
+from zope.interface.declarations import implementer_only
 from zope.interface.declarations import providedBy
-from zope.interface.declarations import implementer # required by py3k fixers
-from zope.interface.declarations import implementer_only # req by py3k fixers
 from zope.interface.adapter import AdapterRegistry
+from zope.interface._compat import _u
+from zope.interface._compat import class_types
+from zope.interface._compat import string_types
 
-if sys.version_info[0] == 3: #pragma NO COVER
-    def _u(s):
-        return s
-    class_types = type
-    string_types = (str,)
-else:
-    def _u(s):
-        return unicode(s, 'unicode_escape')
-    class_types = (type, types.ClassType)
-    string_types = (basestring,)
 
+ at implementer(IComponents)
 class Components(object):
 
-    implements(IComponents)
-
     def __init__(self, name='', bases=()):
         assert isinstance(name, string_types)
         self.__name__ = name
@@ -438,10 +425,9 @@
     return tuple(result)
 
 
+ at implementer(IUtilityRegistration)
 class UtilityRegistration(object):
 
-    implements(IUtilityRegistration)
-
     def __init__(self, registry, provided, name, component, doc, factory=None):
         (self.registry, self.provided, self.name, self.component, self.info,
          self.factory
@@ -477,10 +463,9 @@
     def __ge__(self, other):
         return repr(self) >= repr(other)
 
+ at implementer(IAdapterRegistration)
 class AdapterRegistration(object):
 
-    implements(IAdapterRegistration)
-
     def __init__(self, registry, required, provided, name, component, doc):
         (self.registry, self.required, self.provided, self.name,
          self.factory, self.info
@@ -516,14 +501,14 @@
     def __ge__(self, other):
         return repr(self) >= repr(other)
 
+ at implementer_only(ISubscriptionAdapterRegistration)
 class SubscriptionRegistration(AdapterRegistration):
+    pass
 
-    implementsOnly(ISubscriptionAdapterRegistration)
 
+ at implementer_only(IHandlerRegistration)
 class HandlerRegistration(AdapterRegistration):
 
-    implementsOnly(IHandlerRegistration)
-
     def __init__(self, registry, required, name, handler, doc):
         (self.registry, self.required, self.name, self.handler, self.info
          ) = registry, required, name, handler, doc

Modified: zope.interface/branches/tseaver-no_2to3/src/zope/interface/tests/test_adapter.py
===================================================================
--- zope.interface/branches/tseaver-no_2to3/src/zope/interface/tests/test_adapter.py	2012-04-04 23:31:42 UTC (rev 124955)
+++ zope.interface/branches/tseaver-no_2to3/src/zope/interface/tests/test_adapter.py	2012-04-04 23:40:49 UTC (rev 124956)
@@ -893,12 +893,13 @@
         self.failUnless(result is _expected)
 
     def test_queryMultiAdaptor_lookup_miss(self):
-        from zope.interface.declarations import implements
+        from zope.interface.declarations import implementer
         from zope.interface.interface import InterfaceClass
         IFoo = InterfaceClass('IFoo')
         IBar = InterfaceClass('IBar', IFoo)
+        @implementer(IFoo)
         class Foo(object):
-            implements(IFoo)
+            pass
         foo = Foo()
         registry = self._makeRegistry()
         subr = self._makeSubregistry()
@@ -915,12 +916,13 @@
         self.failUnless(result is _default)
 
     def test_queryMultiAdaptor_factory_miss(self):
-        from zope.interface.declarations import implements
+        from zope.interface.declarations import implementer
         from zope.interface.interface import InterfaceClass
         IFoo = InterfaceClass('IFoo')
         IBar = InterfaceClass('IBar', IFoo)
+        @implementer(IFoo)
         class Foo(object):
-            implements(IFoo)
+            pass
         foo = Foo()
         registry = self._makeRegistry(IFoo, IBar)
         subr = self._makeSubregistry()
@@ -943,12 +945,13 @@
         self.assertEqual(_called_with, [foo])
 
     def test_queryMultiAdaptor_factory_hit(self):
-        from zope.interface.declarations import implements
+        from zope.interface.declarations import implementer
         from zope.interface.interface import InterfaceClass
         IFoo = InterfaceClass('IFoo')
         IBar = InterfaceClass('IBar', IFoo)
+        @implementer(IFoo)
         class Foo(object):
-            implements(IFoo)
+            pass
         foo = Foo()
         registry = self._makeRegistry(IFoo, IBar)
         subr = self._makeSubregistry()
@@ -1111,7 +1114,10 @@
         IBar = InterfaceClass('IBar', IFoo)
         registry = self._makeRegistry(IFoo, IBar)
         subr = self._makeSubregistry()
-        _exp1, _exp2 = object(), object()
+        class Foo(object):
+            def __lt__(self, other):
+                return True
+        _exp1, _exp2 = Foo(), Foo()
         subr._subscribers = [ #utilities, single adapters
             {},
             {IFoo: {IBar: {'': (_exp1, _exp2)}}},
@@ -1123,12 +1129,13 @@
         self.assertEqual(sorted(result), sorted([_exp1, _exp2]))
 
     def test_subscribers_wo_provided(self):
-        from zope.interface.declarations import implements
+        from zope.interface.declarations import implementer
         from zope.interface.interface import InterfaceClass
         IFoo = InterfaceClass('IFoo')
         IBar = InterfaceClass('IBar', IFoo)
+        @implementer(IFoo)
         class Foo(object):
-            implements(IFoo)
+            pass
         foo = Foo()
         registry = self._makeRegistry(IFoo, IBar)
         registry = self._makeRegistry(IFoo, IBar)
@@ -1151,12 +1158,13 @@
         self.assertEqual(_called, {'_factory1': [foo], '_factory2': [foo]})
 
     def test_subscribers_w_provided(self):
-        from zope.interface.declarations import implements
+        from zope.interface.declarations import implementer
         from zope.interface.interface import InterfaceClass
         IFoo = InterfaceClass('IFoo')
         IBar = InterfaceClass('IBar', IFoo)
+        @implementer(IFoo)
         class Foo(object):
-            implements(IFoo)
+            pass
         foo = Foo()
         registry = self._makeRegistry(IFoo, IBar)
         registry = self._makeRegistry(IFoo, IBar)
@@ -1241,13 +1249,18 @@
         self.failUnless(_convert_None_to_Interface(other) is other)
 
     def test__normalize_name_str(self):
+        import sys
         from zope.interface.adapter import _normalize_name
-        STR = 'str'
-        self.assertEqual(_normalize_name(STR), unicode(STR))
+        STR = b'str'
+        if sys.version_info[0] < 3:
+            self.assertEqual(_normalize_name(STR), unicode(STR))
+        else:
+            self.assertEqual(_normalize_name(STR), str(STR, 'ascii'))
 
     def test__normalize_name_unicode(self):
         from zope.interface.adapter import _normalize_name
-        USTR = u'ustr'
+        from zope.interface._compat import _u
+        USTR = _u('ustr')
         self.assertEqual(_normalize_name(USTR), USTR)
 
     def test__normalize_name_other(self):

Modified: zope.interface/branches/tseaver-no_2to3/src/zope/interface/tests/test_advice.py
===================================================================
--- zope.interface/branches/tseaver-no_2to3/src/zope/interface/tests/test_advice.py	2012-04-04 23:31:42 UTC (rev 124955)
+++ zope.interface/branches/tseaver-no_2to3/src/zope/interface/tests/test_advice.py	2012-04-04 23:40:49 UTC (rev 124956)
@@ -28,8 +28,12 @@
 import unittest
 import sys
 
+from zope.interface._compat import _skip_under_py3k
+
+
 class FrameInfoTest(unittest.TestCase):
 
+    @_skip_under_py3k
     def test_w_module(self):
         from zope.interface.tests import advisory_testing
         (kind, module,
@@ -38,6 +42,7 @@
         for d in module.__dict__, f_locals, f_globals:
             self.assert_(d is advisory_testing.my_globals)
 
+    @_skip_under_py3k
     def test_w_ClassicClass(self):
         from zope.interface.tests import advisory_testing
         if advisory_testing.ClassicClass is None:
@@ -52,6 +57,7 @@
         for d in module.__dict__, f_globals:
             self.assert_(d is advisory_testing.my_globals)
 
+    @_skip_under_py3k
     def test_w_NewStyleClass(self):
         from zope.interface.tests import advisory_testing
         (kind,
@@ -63,6 +69,7 @@
         for d in module.__dict__, f_globals:
             self.assert_(d is advisory_testing.my_globals)
 
+    @_skip_under_py3k
     def test_inside_function_call(self):
         from zope.interface.advice import getFrameInfo
         kind, module, f_locals, f_globals = getFrameInfo(sys._getframe())
@@ -71,11 +78,12 @@
         for d in module.__dict__, f_globals:
             self.assert_(d is globals())
 
+    @_skip_under_py3k
     def test_inside_exec(self):
         from zope.interface.advice import getFrameInfo
         _globals = {'getFrameInfo': getFrameInfo}
         _locals = {}
-        exec _FUNKY_EXEC in _globals, _locals
+        exec(_FUNKY_EXEC, _globals, _locals)
         self.assertEquals(_locals['kind'], "exec")
         self.assert_(_locals['f_locals'] is _locals)
         self.assert_(_locals['module'] is None)
@@ -89,6 +97,7 @@
 
 class AdviceTests(unittest.TestCase):
 
+    @_skip_under_py3k
     def test_order(self):
         from zope.interface.tests.advisory_testing import ping
         log = []
@@ -116,6 +125,7 @@
                 "Should have detected advice outside class body"
             )
 
+    @_skip_under_py3k
     def test_single_explicit_meta(self):
         from zope.interface.tests.advisory_testing import ping
 
@@ -130,6 +140,7 @@
         self.assert_(Concrete.__class__ is Metaclass)
 
 
+    @_skip_under_py3k
     def test_mixed_metas(self):
         from zope.interface.tests.advisory_testing import ping
 
@@ -165,6 +176,7 @@
         Derived, = Derived
         self.assert_(isinstance(Derived, Metaclass3))
 
+    @_skip_under_py3k
     def test_meta_of_class(self):
         from zope.interface.advice import determineMetaclass
 
@@ -185,4 +197,4 @@
         ))
     else:
         # Advise metaclasses doesn't work in Python 3
-        return TestSuite([])
+        return unittest.TestSuite([])

Modified: zope.interface/branches/tseaver-no_2to3/src/zope/interface/tests/test_declarations.py
===================================================================
--- zope.interface/branches/tseaver-no_2to3/src/zope/interface/tests/test_declarations.py	2012-04-04 23:31:42 UTC (rev 124955)
+++ zope.interface/branches/tseaver-no_2to3/src/zope/interface/tests/test_declarations.py	2012-04-04 23:40:49 UTC (rev 124956)
@@ -15,7 +15,9 @@
 """
 import unittest
 
+from zope.interface._compat import _skip_under_py3k
 
+
 class _SilencePy3Deprecations(unittest.TestCase):
     # silence deprecation warnings under py3
 
@@ -26,6 +28,23 @@
     def failIf(self, expr):
         # St00pid speling.
         return self.assertFalse(expr)
+
+
+class _Py3ClassAdvice(object):
+
+    def _run_generated_code(self, code, globs, locs, fails_under_py3k=True):
+        import sys
+        if sys.version_info[0] < 3:
+            exec(code, globs, locs)
+            return True
+        else:
+            try:
+                exec(code, globs, locs)
+            except TypeError:
+                return False
+            else:
+                if fails_under_py3k:
+                    self.fail("Didn't raise TypeError")
  
 
 class DeclarationTests(_SilencePy3Deprecations):
@@ -282,6 +301,7 @@
     def test_builtins_added_to_cache(self):
         from zope.interface import declarations
         from zope.interface.declarations import Implements
+        from zope.interface._compat import _BUILTINS
         specs = {}
         with _Monkey(declarations, BuiltinImplementationSpecifications=specs):
             self.assertEqual(list(self._callFUT(tuple)), [])
@@ -291,7 +311,8 @@
             spec = specs[typ]
             self.failUnless(isinstance(spec, Implements))
             self.assertEqual(repr(spec),
-                             '<implementedBy __builtin__.%s>' % typ.__name__)
+                             '<implementedBy %s.%s>'
+                                % (_BUILTINS, typ.__name__))
 
     def test_builtins_w_existing_cache(self):
         from zope.interface import declarations
@@ -610,7 +631,7 @@
 
 # Test '_implements' by way of 'implements{,Only}', its only callers.
 
-class Test_implementsOnly(_SilencePy3Deprecations):
+class Test_implementsOnly(_SilencePy3Deprecations, _Py3ClassAdvice):
 
     def _getFUT(self):
         from zope.interface.declarations import implementsOnly
@@ -634,14 +655,14 @@
             'class Bar(Foo):'
             '    implementsOnly(IBar)',
             ])
-        # XXX need six-ish majyk here :(
-        exec CODE in globs, locs
-        Bar = locs['Bar']
-        spec = Bar.__implemented__
-        self.assertEqual(list(spec), [IBar])
+        if self._run_generated_code(CODE, globs, locs):
+            Bar = locs['Bar']
+            spec = Bar.__implemented__
+            self.assertEqual(list(spec), [IBar])
 
-class Test_implements(_SilencePy3Deprecations):
 
+class Test_implements(_SilencePy3Deprecations, _Py3ClassAdvice):
+
     def _getFUT(self):
         from zope.interface.declarations import implements
         return implements
@@ -656,10 +677,9 @@
             'def foo():',
             '    implements(IFoo)'
             ])
-        # XXX need six-ish majyk here :(
-        exec CODE in globs, locs
-        foo = locs['foo']
-        self.assertRaises(TypeError, foo)
+        if self._run_generated_code(CODE, globs, locs, False):
+            foo = locs['foo']
+            self.assertRaises(TypeError, foo)
 
     def test_called_twice_from_class(self):
         from zope.interface.declarations import implements
@@ -673,9 +693,8 @@
             '    implements(IFoo)',
             '    implements(IBar)',
             ])
-        # XXX need six-ish majyk here :(
         try:
-            exec CODE in globs, locs
+            exec(CODE, globs, locs)
         except TypeError:
             pass
         else:
@@ -691,11 +710,10 @@
             'class Foo(object):',
             '    implements(IFoo)',
             ])
-        # XXX need six-ish majyk here :(
-        exec CODE in globs, locs
-        Foo = locs['Foo']
-        spec = Foo.__implemented__
-        self.assertEqual(list(spec), [IFoo])
+        if self._run_generated_code(CODE, globs, locs):
+            Foo = locs['Foo']
+            spec = Foo.__implemented__
+            self.assertEqual(list(spec), [IFoo])
 
 
 class ProvidesClassTests(_SilencePy3Deprecations):
@@ -806,7 +824,9 @@
         self.failUnless(isinstance(Foo.__provides__, ClassProvides))
         self.assertEqual(list(Foo.__provides__), [IFoo])
 
+    @_skip_under_py3k
     def test_w_non_descriptor_aware_metaclass(self):
+        # There are no non-descriptor-aware types in Py3k
         from zope.interface.interface import InterfaceClass
         IFoo = InterfaceClass("IFoo")
         class MetaClass(type):
@@ -913,11 +933,12 @@
         self.assertEqual(list(obj.__provides__), [IFoo])
 
     def test_w_iface_implemented_by_class(self):
-        from zope.interface.declarations import implements
+        from zope.interface.declarations import implementer
         from zope.interface.interface import InterfaceClass
         IFoo = InterfaceClass("IFoo")
+        @implementer(IFoo)
         class Foo(object):
-            implements(IFoo)
+            pass
         obj = Foo()
         self.assertRaises(ValueError, self._callFUT, obj, IFoo)
 
@@ -985,23 +1006,25 @@
         return self._getTargetClass()(*args, **kw)
 
     def test_w_simple_metaclass(self):
-        from zope.interface.declarations import implements
+        from zope.interface.declarations import implementer
         from zope.interface.interface import InterfaceClass
         IFoo = InterfaceClass("IFoo")
         IBar = InterfaceClass("IBar")
+        @implementer(IFoo)
         class Foo(object):
-            implements(IFoo)
+            pass
         cp = Foo.__provides__ = self._makeOne(Foo, type(Foo), IBar)
         self.failUnless(Foo.__provides__ is cp)
         self.assertEqual(list(Foo().__provides__), [IFoo])
 
     def test___reduce__(self):
-        from zope.interface.declarations import implements
+        from zope.interface.declarations import implementer
         from zope.interface.interface import InterfaceClass
         IFoo = InterfaceClass("IFoo")
         IBar = InterfaceClass("IBar")
+        @implementer(IFoo)
         class Foo(object):
-            implements(IFoo)
+            pass
         cp = Foo.__provides__ = self._makeOne(Foo, type(Foo), IBar)
         self.assertEqual(cp.__reduce__(),
                          (self._getTargetClass(), (Foo, type(Foo), IBar)))
@@ -1020,11 +1043,12 @@
         self.assertEqual(list(self._callFUT(foo)), [])
 
     def test_w_declarations_in_class_but_not_instance(self):
-        from zope.interface.declarations import implements
+        from zope.interface.declarations import implementer
         from zope.interface.interface import InterfaceClass
         IFoo = InterfaceClass("IFoo")
+        @implementer(IFoo)
         class Foo(object):
-            implements(IFoo)
+            pass
         foo = Foo()
         self.assertEqual(list(self._callFUT(foo)), [])
 
@@ -1040,18 +1064,19 @@
 
     def test_w_declarations_in_instance_and_class(self):
         from zope.interface.declarations import directlyProvides
-        from zope.interface.declarations import implements
+        from zope.interface.declarations import implementer
         from zope.interface.interface import InterfaceClass
         IFoo = InterfaceClass("IFoo")
         IBar = InterfaceClass("IBar")
+        @implementer(IFoo)
         class Foo(object):
-            implements(IFoo)
+            pass
         foo = Foo()
         directlyProvides(foo, IBar)
         self.assertEqual(list(self._callFUT(foo)), [IBar])
 
 
-class Test_classProvides(_SilencePy3Deprecations):
+class Test_classProvides(_SilencePy3Deprecations, _Py3ClassAdvice):
 
     def _getFUT(self):
         from zope.interface.declarations import classProvides
@@ -1067,8 +1092,7 @@
             'def foo():',
             '    classProvides(IFoo)'
             ])
-        # XXX need six-ish majyk here :(
-        exec CODE in globs, locs
+        exec(CODE, globs, locs)
         foo = locs['foo']
         self.assertRaises(TypeError, foo)
 
@@ -1084,9 +1108,8 @@
             '    classProvides(IFoo)',
             '    classProvides(IBar)',
             ])
-        # XXX need six-ish majyk here :(
         try:
-            exec CODE in globs, locs
+            exec(CODE, globs, locs)
         except TypeError:
             pass
         else:
@@ -1102,13 +1125,11 @@
             'class Foo(object):',
             '    classProvides(IFoo)',
             ])
-        # XXX need six-ish majyk here :(
-        exec CODE in globs, locs
-        Foo = locs['Foo']
-        spec = Foo.__providedBy__
-        self.assertEqual(list(spec), [IFoo])
+        if self._run_generated_code(CODE, globs, locs):
+            Foo = locs['Foo']
+            spec = Foo.__providedBy__
+            self.assertEqual(list(spec), [IFoo])
 
-
 # Test _classProvides_advice through classProvides, its only caller.
 
 
@@ -1149,8 +1170,7 @@
             'def foo():',
             '    moduleProvides(IFoo)'
             ])
-        # XXX need six-ish majyk here :(
-        exec CODE in globs, locs
+        exec(CODE, globs, locs)
         foo = locs['foo']
         self.assertRaises(TypeError, foo)
 
@@ -1160,13 +1180,13 @@
         IFoo = InterfaceClass("IFoo")
         globs = {'__name__': 'zope.interface.tests.foo',
                  'moduleProvides': moduleProvides, 'IFoo': IFoo}
+        locs = {}
         CODE = "\n".join([
             'class Foo(object):',
             '    moduleProvides(IFoo)',
             ])
         try:
-            # XXX need six-ish majyk here :(
-            exec CODE in globs
+            exec(CODE, globs, locs)
         except TypeError:
             pass
         else:
@@ -1181,8 +1201,7 @@
         CODE = "\n".join([
             'moduleProvides(IFoo)',
             ])
-        # XXX need six-ish majyk here :(
-        exec CODE in globs
+        exec(CODE, globs)
         spec = globs['__provides__']
         self.assertEqual(list(spec), [IFoo])
 
@@ -1192,13 +1211,13 @@
         IFoo = InterfaceClass("IFoo")
         globs = {'__name__': 'zope.interface.tests.foo',
                  'moduleProvides': moduleProvides, 'IFoo': IFoo}
+        locs = {}
         CODE = "\n".join([
             'moduleProvides(IFoo)',
             'moduleProvides(IFoo)',
             ])
         try:
-            # XXX need six-ish majyk here :(
-            exec CODE in globs
+            exec(CODE, globs)
         except TypeError:
             pass
         else:
@@ -1257,11 +1276,12 @@
         self.assertEqual(list(spec), [IFoo])
 
     def test_wo_provides_on_class_w_implements(self):
-        from zope.interface.declarations import implements
+        from zope.interface.declarations import implementer
         from zope.interface.interface import InterfaceClass
         IFoo = InterfaceClass("IFoo")
+        @implementer(IFoo)
         class Foo(object):
-            implements(IFoo)
+            pass
         foo = Foo()
         spec = self._callFUT(foo)
         self.assertEqual(list(spec), [IFoo])
@@ -1315,11 +1335,12 @@
         self.assertEqual(list(spec), [])
 
     def test_w_providedBy_invalid_spec_class_w_implements(self):
-        from zope.interface.declarations import implements
+        from zope.interface.declarations import implementer
         from zope.interface.interface import InterfaceClass
         IFoo = InterfaceClass("IFoo")
+        @implementer(IFoo)
         class Foo(object):
-            implements(IFoo)
+            pass
         foo = Foo()
         foo.__providedBy__ = object()
         spec = self._callFUT(foo)
@@ -1345,11 +1366,12 @@
         self.failUnless(spec is expected)
 
     def test_w_providedBy_invalid_spec_w_provides_same_provides_on_class(self):
-        from zope.interface.declarations import implements
+        from zope.interface.declarations import implementer
         from zope.interface.interface import InterfaceClass
         IFoo = InterfaceClass("IFoo")
+        @implementer(IFoo)
         class Foo(object):
-            implements(IFoo)
+            pass
         foo = Foo()
         foo.__providedBy__ = object()
         foo.__provides__ = Foo.__provides__ = object()
@@ -1386,13 +1408,14 @@
         self.assertEqual(list(Foo.__providedBy__), [IFoo])
 
     def test_accessed_via_inst_wo_provides(self):
-        from zope.interface.declarations import implements
+        from zope.interface.declarations import implementer
         from zope.interface.declarations import Provides
         from zope.interface.interface import InterfaceClass
         IFoo = InterfaceClass("IFoo")
         IBar = InterfaceClass("IBar")
+        @implementer(IFoo)
         class Foo(object):
-            implements(IFoo)
+            pass
         Foo.__provides__ = Provides(Foo, IBar)
         Foo.__providedBy__ = self._makeOne()
         foo = Foo()
@@ -1400,14 +1423,15 @@
 
     def test_accessed_via_inst_w_provides(self):
         from zope.interface.declarations import directlyProvides
-        from zope.interface.declarations import implements
+        from zope.interface.declarations import implementer
         from zope.interface.declarations import Provides
         from zope.interface.interface import InterfaceClass
         IFoo = InterfaceClass("IFoo")
         IBar = InterfaceClass("IBar")
         IBaz = InterfaceClass("IBaz")
+        @implementer(IFoo)
         class Foo(object):
-            implements(IFoo)
+            pass
         Foo.__provides__ = Provides(Foo, IBar)
         Foo.__providedBy__ = self._makeOne()
         foo = Foo()

Modified: zope.interface/branches/tseaver-no_2to3/src/zope/interface/tests/test_interface.py
===================================================================
--- zope.interface/branches/tseaver-no_2to3/src/zope/interface/tests/test_interface.py	2012-04-04 23:31:42 UTC (rev 124955)
+++ zope.interface/branches/tseaver-no_2to3/src/zope/interface/tests/test_interface.py	2012-04-04 23:40:49 UTC (rev 124956)
@@ -119,7 +119,7 @@
         self.assertEqual(element.getName(), self.DEFAULT_NAME)
         self.assertEqual(element.__doc__, '')
         self.assertEqual(element.getDoc(), '')
-        self.assertEqual(element.getTaggedValueTags(), [])
+        self.assertEqual(list(element.getTaggedValueTags()), [])
 
     def test_ctor_no_doc_space_in_name(self):
         element = self._makeOne('An Element')
@@ -141,7 +141,7 @@
     def test_setTaggedValue(self):
         element = self._makeOne()
         element.setTaggedValue('foo', 'bar')
-        self.assertEqual(element.getTaggedValueTags(), ['foo'])
+        self.assertEqual(list(element.getTaggedValueTags()), ['foo'])
         self.assertEqual(element.getTaggedValue('foo'), 'bar')
         self.assertEqual(element.queryTaggedValue('foo'), 'bar')
 
@@ -408,7 +408,7 @@
         self.assertEqual(inst.__name__, 'ITesting')
         self.assertEqual(inst.__doc__, '')
         self.assertEqual(inst.__bases__, ())
-        self.assertEqual(inst.names(), [])
+        self.assertEqual(list(inst.names()), [])
 
     def test_ctor_attrs_w_invalide_attr_type(self):
         from zope.interface.exceptions import InvalidInterface
@@ -1043,9 +1043,10 @@
         from zope.interface import Attribute
         from zope.interface import Interface
         from zope.interface.verify import verifyClass
+        from zope.interface._compat import _u
 
         class ICheckMe(Interface):
-            attr = Attribute(u'My attr')
+            attr = Attribute(_u('My attr'))
 
             def method():
                 pass
@@ -1063,9 +1064,10 @@
         from zope.interface import Attribute
         from zope.interface import Interface
         from zope.interface.verify import verifyObject
+        from zope.interface._compat import _u
 
         class ICheckMe(Interface):
-            attr = Attribute(u'My attr')
+            attr = Attribute(_u('My attr'))
 
             def method():
                 pass
@@ -1092,9 +1094,10 @@
     def test_names_simple(self):
         from zope.interface import Attribute
         from zope.interface import Interface
+        from zope.interface._compat import _u
 
         class ISimple(Interface):
-            attr = Attribute(u'My attr')
+            attr = Attribute(_u('My attr'))
 
             def method():
                 pass
@@ -1104,15 +1107,16 @@
     def test_names_derived(self):
         from zope.interface import Attribute
         from zope.interface import Interface
+        from zope.interface._compat import _u
 
         class IBase(Interface):
-            attr = Attribute(u'My attr')
+            attr = Attribute(_u('My attr'))
 
             def method():
                 pass
 
         class IDerived(IBase):
-            attr2 = Attribute(u'My attr')
+            attr2 = Attribute(_u('My attr2'))
 
             def method():
                 pass
@@ -1129,9 +1133,10 @@
         from zope.interface import Attribute
         from zope.interface.interface import Method
         from zope.interface import Interface
+        from zope.interface._compat import _u
 
         class ISimple(Interface):
-            attr = Attribute(u'My attr')
+            attr = Attribute(_u('My attr'))
 
             def method():
                 "My method"
@@ -1152,15 +1157,16 @@
         from zope.interface import Attribute
         from zope.interface import Interface
         from zope.interface.interface import Method
+        from zope.interface._compat import _u
 
         class IBase(Interface):
-            attr = Attribute(u'My attr')
+            attr = Attribute(_u('My attr'))
 
             def method():
                 "My method"
 
         class IDerived(IBase):
-            attr2 = Attribute(u'My attr2')
+            attr2 = Attribute(_u('My attr2'))
 
             def method():
                 "My method, overridden"
@@ -1216,9 +1222,10 @@
         from zope.interface import Attribute
         from zope.interface.interface import Method
         from zope.interface import Interface
+        from zope.interface._compat import _u
 
         class ISimple(Interface):
-            attr = Attribute(u'My attr')
+            attr = Attribute(_u('My attr'))
 
             def method():
                 "My method"
@@ -1237,15 +1244,16 @@
         from zope.interface import Attribute
         from zope.interface.interface import Method
         from zope.interface import Interface
+        from zope.interface._compat import _u
 
         class IBase(Interface):
-            attr = Attribute(u'My attr')
+            attr = Attribute(_u('My attr'))
 
             def method():
                 "My method"
 
         class IDerived(IBase):
-            attr2 = Attribute(u'My attr2')
+            attr2 = Attribute(_u('My attr2'))
 
             def method():
                 "My method, overridden"
@@ -1285,9 +1293,10 @@
         from zope.interface import Attribute
         from zope.interface.interface import Method
         from zope.interface import Interface
+        from zope.interface._compat import _u
 
         class ISimple(Interface):
-            attr = Attribute(u'My attr')
+            attr = Attribute(_u('My attr'))
 
             def method():
                 "My method"
@@ -1306,15 +1315,16 @@
         from zope.interface import Attribute
         from zope.interface.interface import Method
         from zope.interface import Interface
+        from zope.interface._compat import _u
 
         class IBase(Interface):
-            attr = Attribute(u'My attr')
+            attr = Attribute(_u('My attr'))
 
             def method():
                 "My method"
 
         class IDerived(IBase):
-            attr2 = Attribute(u'My attr2')
+            attr2 = Attribute(_u('My attr2'))
 
             def method():
                 "My method, overridden"
@@ -1353,9 +1363,10 @@
     def test___contains__simple(self):
         from zope.interface import Attribute
         from zope.interface import Interface
+        from zope.interface._compat import _u
 
         class ISimple(Interface):
-            attr = Attribute(u'My attr')
+            attr = Attribute(_u('My attr'))
 
             def method():
                 "My method"
@@ -1366,15 +1377,16 @@
     def test___contains__derived(self):
         from zope.interface import Attribute
         from zope.interface import Interface
+        from zope.interface._compat import _u
 
         class IBase(Interface):
-            attr = Attribute(u'My attr')
+            attr = Attribute(_u('My attr'))
 
             def method():
                 "My method"
 
         class IDerived(IBase):
-            attr2 = Attribute(u'My attr2')
+            attr2 = Attribute(_u('My attr2'))
 
             def method():
                 "My method, overridden"
@@ -1398,9 +1410,10 @@
     def test___iter__simple(self):
         from zope.interface import Attribute
         from zope.interface import Interface
+        from zope.interface._compat import _u
 
         class ISimple(Interface):
-            attr = Attribute(u'My attr')
+            attr = Attribute(_u('My attr'))
 
             def method():
                 "My method"
@@ -1410,15 +1423,16 @@
     def test___iter__derived(self):
         from zope.interface import Attribute
         from zope.interface import Interface
+        from zope.interface._compat import _u
 
         class IBase(Interface):
-            attr = Attribute(u'My attr')
+            attr = Attribute(_u('My attr'))
 
             def method():
                 "My method"
 
         class IDerived(IBase):
-            attr2 = Attribute(u'My attr2')
+            attr2 = Attribute(_u('My attr2'))
 
             def method():
                 "My method, overridden"
@@ -1466,7 +1480,7 @@
         e = []
         try:
             iface.validateInvariants(has_invariant, e)
-        except Invalid, error:
+        except Invalid as error:
             self.assertEquals(error.args[0], e)
         else:
             self._assert(0) # validateInvariants should always raise
@@ -1643,7 +1657,7 @@
     def test_invariant_as_decorator(self):
         from zope.interface import Interface
         from zope.interface import Attribute
-        from zope.interface import implements
+        from zope.interface import implementer
         from zope.interface import invariant
         from zope.interface.exceptions import Invalid
 
@@ -1656,8 +1670,8 @@
                 if ob.max < ob.min:
                     raise Invalid('max < min')
 
+        @implementer(IRange)
         class Range(object):
-            implements(IRange)
 
             def __init__(self, min, max):
                 self.min, self.max = min, max
@@ -1666,7 +1680,7 @@
         IRange.validateInvariants(Range(1,1))
         try:
             IRange.validateInvariants(Range(2,1))
-        except Invalid, e:
+        except Invalid as e:
             self.assertEqual(str(e), 'max < min')
 
     def test_taggedValue(self):
@@ -1708,13 +1722,13 @@
 
     def test___call___defers_to___conform___(self):
         from zope.interface import Interface
-        from zope.interface import implements
+        from zope.interface import implementer
 
         class I(Interface):
             pass
 
+        @implementer(I)
         class C(object):
-            implements(I)
             def __conform__(self, proto):
                 return 0
 
@@ -1722,13 +1736,14 @@
 
     def test___call___object_implements(self):
         from zope.interface import Interface
-        from zope.interface import implements
+        from zope.interface import implementer
 
         class I(Interface):
             pass
 
+        @implementer(I)
         class C(object):
-            implements(I)
+            pass
 
         c = C()
         self.assert_(I(c) is c)
@@ -1810,7 +1825,7 @@
         method = self._makeOne()
         try:
             method()
-        except BrokenImplementation, e:
+        except BrokenImplementation as e:
             self.assertEqual(e.interface, None)
             self.assertEqual(e.name, self.DEFAULT_NAME)
         else:
@@ -1864,7 +1879,7 @@
         self.assertEqual(method.getName(), '_func')
         self.assertEqual(method.getDoc(), 'DOCSTRING')
         self.assertEqual(method.interface, None)
-        self.assertEqual(method.getTaggedValueTags(), [])
+        self.assertEqual(list(method.getTaggedValueTags()), [])
         info = method.getSignatureInfo()
         self.assertEqual(list(info['positional']), [])
         self.assertEqual(list(info['required']), [])
@@ -1975,7 +1990,7 @@
         self.assertEqual(method.getName(), 'bar')
         self.assertEqual(method.getDoc(), 'DOCSTRING')
         self.assertEqual(method.interface, None)
-        self.assertEqual(method.getTaggedValueTags(), [])
+        self.assertEqual(list(method.getTaggedValueTags()), [])
         info = method.getSignatureInfo()
         self.assertEqual(list(info['positional']), [])
         self.assertEqual(list(info['required']), [])
@@ -1995,6 +2010,21 @@
         self.assertEqual(info['varargs'], 'args')
         self.assertEqual(info['kwargs'], 'kw')
 
+    def test_w_non_method(self):
+        def foo():
+            "DOCSTRING"
+        method = self._callFUT(foo)
+        self.assertEqual(method.getName(), 'foo')
+        self.assertEqual(method.getDoc(), 'DOCSTRING')
+        self.assertEqual(method.interface, None)
+        self.assertEqual(list(method.getTaggedValueTags()), [])
+        info = method.getSignatureInfo()
+        self.assertEqual(list(info['positional']), [])
+        self.assertEqual(list(info['required']), [])
+        self.assertEqual(info['optional'], {})
+        self.assertEqual(info['varargs'], None)
+        self.assertEqual(info['kwargs'], None)
+
 class DummyDependent(object):
 
     def __init__(self):

Modified: zope.interface/branches/tseaver-no_2to3/src/zope/interface/tests/test_odd_declarations.py
===================================================================
--- zope.interface/branches/tseaver-no_2to3/src/zope/interface/tests/test_odd_declarations.py	2012-04-04 23:31:42 UTC (rev 124955)
+++ zope.interface/branches/tseaver-no_2to3/src/zope/interface/tests/test_odd_declarations.py	2012-04-04 23:40:49 UTC (rev 124956)
@@ -20,13 +20,14 @@
 
 from zope.interface.tests import odd
 from zope.interface import Interface
-from zope.interface import implements
+from zope.interface import implementer
 from zope.interface import directlyProvides
 from zope.interface import providedBy
 from zope.interface import directlyProvidedBy
 from zope.interface import classImplements
 from zope.interface import classImplementsOnly
 from zope.interface import implementedBy
+from zope.interface._compat import _skip_under_py3k
 
 class I1(Interface): pass
 class I2(Interface): pass
@@ -121,11 +122,14 @@
         self.failUnless(providedBy(c).extends(I5))
 
     def test_classImplements(self):
+
+        @implementer(I3)
         class A(Odd):
-            implements(I3)
+            pass
 
+        @implementer(I4)
         class B(Odd):
-            implements(I4)
+            pass
 
         class C(A, B):
             pass
@@ -137,11 +141,13 @@
                          ['I1', 'I2', 'I5', 'I3', 'I4'])
 
     def test_classImplementsOnly(self):
+        @implementer(I3)
         class A(Odd):
-            implements(I3)
+            pass
 
+        @implementer(I4)
         class B(Odd):
-            implements(I4)
+            pass
 
         class C(A, B):
             pass
@@ -184,6 +190,7 @@
         directlyProvides(ob, directlyProvidedBy(ob), I2)
         self.failUnless(I2 in providedBy(ob))
 
+    @_skip_under_py3k
     def test_directlyProvides_fails_for_odd_class(self):
         self.assertRaises(TypeError, directlyProvides, C, I5)
 

Modified: zope.interface/branches/tseaver-no_2to3/src/zope/interface/tests/test_registry.py
===================================================================
--- zope.interface/branches/tseaver-no_2to3/src/zope/interface/tests/test_registry.py	2012-04-04 23:31:42 UTC (rev 124955)
+++ zope.interface/branches/tseaver-no_2to3/src/zope/interface/tests/test_registry.py	2012-04-04 23:40:49 UTC (rev 124956)
@@ -93,7 +93,7 @@
         from zope.interface.declarations import InterfaceClass
         from zope.interface.interfaces import Registered
         from zope.interface.registry import UtilityRegistration
-        from zope.interface.registry import _u
+        from zope.interface._compat import _u
         class IFoo(InterfaceClass):
             pass
         ifoo = IFoo('IFoo')
@@ -125,7 +125,7 @@
         from zope.interface.declarations import InterfaceClass
         from zope.interface.interfaces import Registered
         from zope.interface.registry import UtilityRegistration
-        from zope.interface.registry import _u
+        from zope.interface._compat import _u
         class IFoo(InterfaceClass):
             pass
         ifoo = IFoo('IFoo')
@@ -153,7 +153,7 @@
 
     def test_registerUtility_no_provided_available(self):
         from zope.interface.declarations import InterfaceClass
-        from zope.interface.registry import _u
+        from zope.interface._compat import _u
         class IFoo(InterfaceClass):
             pass
         class Foo(object):
@@ -171,7 +171,7 @@
         from zope.interface.declarations import InterfaceClass
         from zope.interface.interfaces import Registered
         from zope.interface.registry import UtilityRegistration
-        from zope.interface.registry import _u
+        from zope.interface._compat import _u
         class IFoo(InterfaceClass):
             pass
         class Foo(object):
@@ -200,7 +200,7 @@
 
     def test_registerUtility_duplicates_existing_reg(self):
         from zope.interface.declarations import InterfaceClass
-        from zope.interface.registry import _u
+        from zope.interface._compat import _u
         class IFoo(InterfaceClass):
             pass
         ifoo = IFoo('IFoo')
@@ -219,7 +219,7 @@
         from zope.interface.interfaces import Unregistered
         from zope.interface.interfaces import Registered
         from zope.interface.registry import UtilityRegistration
-        from zope.interface.registry import _u
+        from zope.interface._compat import _u
         class IFoo(InterfaceClass):
             pass
         ifoo = IFoo('IFoo')
@@ -257,7 +257,7 @@
 
     def test_registerUtility_w_existing_subscr(self):
         from zope.interface.declarations import InterfaceClass
-        from zope.interface.registry import _u
+        from zope.interface._compat import _u
         class IFoo(InterfaceClass):
             pass
         ifoo = IFoo('IFoo')
@@ -274,7 +274,7 @@
 
     def test_registerUtility_wo_event(self):
         from zope.interface.declarations import InterfaceClass
-        from zope.interface.registry import _u
+        from zope.interface._compat import _u
         class IFoo(InterfaceClass):
             pass
         ifoo = IFoo('IFoo')
@@ -302,7 +302,7 @@
 
     def test_unregisterUtility_w_component_miss(self):
         from zope.interface.declarations import InterfaceClass
-        from zope.interface.registry import _u
+        from zope.interface._compat import _u
         class IFoo(InterfaceClass):
             pass
         ifoo = IFoo('IFoo')
@@ -319,7 +319,7 @@
         from zope.interface.declarations import InterfaceClass
         from zope.interface.interfaces import Unregistered
         from zope.interface.registry import UtilityRegistration
-        from zope.interface.registry import _u
+        from zope.interface._compat import _u
         class IFoo(InterfaceClass):
             pass
         ifoo = IFoo('IFoo')
@@ -350,7 +350,7 @@
         from zope.interface.declarations import InterfaceClass
         from zope.interface.interfaces import Unregistered
         from zope.interface.registry import UtilityRegistration
-        from zope.interface.registry import _u
+        from zope.interface._compat import _u
         class IFoo(InterfaceClass):
             pass
         ifoo = IFoo('IFoo')
@@ -382,7 +382,7 @@
         from zope.interface.declarations import InterfaceClass
         from zope.interface.interfaces import Unregistered
         from zope.interface.registry import UtilityRegistration
-        from zope.interface.registry import _u
+        from zope.interface._compat import _u
         class IFoo(InterfaceClass):
             pass
         class Foo(object):
@@ -416,7 +416,7 @@
         from zope.interface.declarations import InterfaceClass
         from zope.interface.interfaces import Unregistered
         from zope.interface.registry import UtilityRegistration
-        from zope.interface.registry import _u
+        from zope.interface._compat import _u
         class IFoo(InterfaceClass):
             pass
         class Foo(object):
@@ -448,7 +448,7 @@
 
     def test_unregisterUtility_w_existing_subscr(self):
         from zope.interface.declarations import InterfaceClass
-        from zope.interface.registry import _u
+        from zope.interface._compat import _u
         class IFoo(InterfaceClass):
             pass
         ifoo = IFoo('IFoo')
@@ -470,7 +470,7 @@
 
     def test_registeredUtilities_notempty(self):
         from zope.interface.declarations import InterfaceClass
-        from zope.interface.registry import _u
+        from zope.interface._compat import _u
         from zope.interface.registry import UtilityRegistration
         class IFoo(InterfaceClass):
             pass
@@ -555,7 +555,7 @@
 
     def test_getUtilitiesFor_hit(self):
         from zope.interface.declarations import InterfaceClass
-        from zope.interface.registry import _u
+        from zope.interface._compat import _u
         class IFoo(InterfaceClass):
             pass
         ifoo = IFoo('IFoo')
@@ -578,7 +578,7 @@
 
     def test_getAllUtilitiesRegisteredFor_hit(self):
         from zope.interface.declarations import InterfaceClass
-        from zope.interface.registry import _u
+        from zope.interface._compat import _u
         class IFoo(InterfaceClass):
             pass
         ifoo = IFoo('IFoo')
@@ -595,7 +595,7 @@
         from zope.interface.declarations import InterfaceClass
         from zope.interface.interfaces import Registered
         from zope.interface.registry import AdapterRegistration
-        from zope.interface.registry import _u
+        from zope.interface._compat import _u
         class IFoo(InterfaceClass):
             pass
         ifoo = IFoo('IFoo')
@@ -628,7 +628,7 @@
 
     def test_registerAdapter_no_provided_available(self):
         from zope.interface.declarations import InterfaceClass
-        from zope.interface.registry import _u
+        from zope.interface._compat import _u
         class IFoo(InterfaceClass):
             pass
         ifoo = IFoo('IFoo')
@@ -648,7 +648,7 @@
         from zope.interface.declarations import implementer
         from zope.interface.interfaces import Registered
         from zope.interface.registry import AdapterRegistration
-        from zope.interface.registry import _u
+        from zope.interface._compat import _u
         class IFoo(InterfaceClass):
             pass
         ifoo = IFoo('IFoo')
@@ -683,7 +683,7 @@
 
     def test_registerAdapter_no_required_available(self):
         from zope.interface.declarations import InterfaceClass
-        from zope.interface.registry import _u
+        from zope.interface._compat import _u
         class IFoo(InterfaceClass):
             pass
         ifoo = IFoo('IFoo')
@@ -699,7 +699,7 @@
 
     def test_registerAdapter_w_invalid_required(self):
         from zope.interface.declarations import InterfaceClass
-        from zope.interface.registry import _u
+        from zope.interface._compat import _u
         class IFoo(InterfaceClass):
             pass
         ifoo = IFoo('IFoo')
@@ -718,7 +718,7 @@
         from zope.interface.interface import Interface
         from zope.interface.interfaces import Registered
         from zope.interface.registry import AdapterRegistration
-        from zope.interface.registry import _u
+        from zope.interface._compat import _u
         class IFoo(InterfaceClass):
             pass
         ifoo = IFoo('IFoo')
@@ -751,11 +751,11 @@
 
     def test_registerAdapter_w_required_containing_class(self):
         from zope.interface.declarations import InterfaceClass
-        from zope.interface.declarations import implements
+        from zope.interface.declarations import implementer
         from zope.interface.declarations import implementedBy
         from zope.interface.interfaces import Registered
         from zope.interface.registry import AdapterRegistration
-        from zope.interface.registry import _u
+        from zope.interface._compat import _u
         class IFoo(InterfaceClass):
             pass
         ifoo = IFoo('IFoo')
@@ -765,8 +765,9 @@
         class _Factory(object):
             def __init__(self, context):
                 self._context = context
+        @implementer(ibar)
         class _Context(object):
-            implements(ibar)
+            pass
         _ctx_impl = implementedBy(_Context)
         comp = self._makeOne()
         _monkey, _events = self._wrapEvents()
@@ -792,7 +793,7 @@
 
     def test_registerAdapter_w_required_containing_junk(self):
         from zope.interface.declarations import InterfaceClass
-        from zope.interface.registry import _u
+        from zope.interface._compat import _u
         class IFoo(InterfaceClass):
             pass
         ifoo = IFoo('IFoo')
@@ -810,7 +811,7 @@
         from zope.interface.declarations import InterfaceClass
         from zope.interface.interfaces import Registered
         from zope.interface.registry import AdapterRegistration
-        from zope.interface.registry import _u
+        from zope.interface._compat import _u
         class IFoo(InterfaceClass):
             pass
         ifoo = IFoo('IFoo')
@@ -845,7 +846,7 @@
 
     def test_registerAdapter_wo_event(self):
         from zope.interface.declarations import InterfaceClass
-        from zope.interface.registry import _u
+        from zope.interface._compat import _u
         class IFoo(InterfaceClass):
             pass
         ifoo = IFoo('IFoo')
@@ -992,7 +993,7 @@
 
     def test_registeredAdapters_notempty(self):
         from zope.interface.declarations import InterfaceClass
-        from zope.interface.registry import _u
+        from zope.interface._compat import _u
         from zope.interface.registry import AdapterRegistration
         class IFoo(InterfaceClass):
             pass
@@ -1236,7 +1237,7 @@
     def test_getAdapters_non_empty(self):
         from zope.interface.declarations import InterfaceClass
         from zope.interface.declarations import implementer
-        from zope.interface.registry import _u
+        from zope.interface._compat import _u
         class IFoo(InterfaceClass):
             pass
         ifoo = IFoo('IFoo')
@@ -1270,7 +1271,7 @@
 
     def test_registerSubscriptionAdapter_w_nonblank_name(self):
         from zope.interface.declarations import InterfaceClass
-        from zope.interface.registry import _u
+        from zope.interface._compat import _u
         class IFoo(InterfaceClass):
             pass
         ifoo = IFoo('IFoo')
@@ -1288,7 +1289,7 @@
         from zope.interface.declarations import InterfaceClass
         from zope.interface.interfaces import Registered
         from zope.interface.registry import SubscriptionRegistration
-        from zope.interface.registry import _u
+        from zope.interface._compat import _u
         class IFoo(InterfaceClass):
             pass
         ifoo = IFoo('IFoo')
@@ -1326,7 +1327,7 @@
         from zope.interface.declarations import implementer
         from zope.interface.interfaces import Registered
         from zope.interface.registry import SubscriptionRegistration
-        from zope.interface.registry import _u
+        from zope.interface._compat import _u
         class IFoo(InterfaceClass):
             pass
         ifoo = IFoo('IFoo')
@@ -1364,7 +1365,7 @@
         from zope.interface.declarations import InterfaceClass
         from zope.interface.interfaces import Registered
         from zope.interface.registry import SubscriptionRegistration
-        from zope.interface.registry import _u
+        from zope.interface._compat import _u
         class IFoo(InterfaceClass):
             pass
         ifoo = IFoo('IFoo')
@@ -1400,7 +1401,7 @@
 
     def test_registerSubscriptionAdapter_wo_event(self):
         from zope.interface.declarations import InterfaceClass
-        from zope.interface.registry import _u
+        from zope.interface._compat import _u
         class IFoo(InterfaceClass):
             pass
         ifoo = IFoo('IFoo')
@@ -1423,7 +1424,7 @@
 
     def test_registeredSubscriptionAdapters_notempty(self):
         from zope.interface.declarations import InterfaceClass
-        from zope.interface.registry import _u
+        from zope.interface._compat import _u
         from zope.interface.registry import SubscriptionRegistration
         class IFoo(InterfaceClass):
             pass
@@ -1456,7 +1457,7 @@
 
     def test_unregisterSubscriptionAdapter_w_nonblank_name(self):
         from zope.interface.declarations import InterfaceClass
-        from zope.interface.registry import _u
+        from zope.interface._compat import _u
         class IFoo(InterfaceClass):
             pass
         ifoo = IFoo('IFoo')
@@ -1625,20 +1626,21 @@
 
     def test_subscribers_empty(self):
         from zope.interface.declarations import InterfaceClass
-        from zope.interface.declarations import implements
+        from zope.interface.declarations import implementer
         class IFoo(InterfaceClass):
             pass
         ifoo = IFoo('IFoo')
         ibar = IFoo('IBar')
         comp = self._makeOne()
+        @implementer(ibar)
         class Bar(object):
-            implements(ibar)
+            pass
         bar = Bar()
         self.assertEqual(list(comp.subscribers((bar,), ifoo)), [])
 
     def test_subscribers_non_empty(self):
         from zope.interface.declarations import InterfaceClass
-        from zope.interface.declarations import implements
+        from zope.interface.declarations import implementer
         class IFoo(InterfaceClass):
             pass
         ifoo = IFoo('IFoo')
@@ -1652,8 +1654,9 @@
         comp = self._makeOne()
         comp.registerSubscriptionAdapter(_Factory, (ibar,), ifoo)
         comp.registerSubscriptionAdapter(_Derived, (ibar,), ifoo)
+        @implementer(ibar)
         class Bar(object):
-            implements(ibar)
+            pass
         bar = Bar()
         subscribers = comp.subscribers((bar,), ifoo)
         def _klassname(x):
@@ -1665,7 +1668,7 @@
 
     def test_registerHandler_w_nonblank_name(self):
         from zope.interface.declarations import InterfaceClass
-        from zope.interface.registry import _u
+        from zope.interface._compat import _u
         class IFoo(InterfaceClass):
             pass
         ifoo = IFoo('IFoo')
@@ -1680,7 +1683,7 @@
         from zope.interface.declarations import InterfaceClass
         from zope.interface.interfaces import Registered
         from zope.interface.registry import HandlerRegistration
-        from zope.interface.registry import _u
+        from zope.interface._compat import _u
         class IFoo(InterfaceClass):
             pass
         ifoo = IFoo('IFoo')
@@ -1714,7 +1717,7 @@
         from zope.interface.declarations import InterfaceClass
         from zope.interface.interfaces import Registered
         from zope.interface.registry import HandlerRegistration
-        from zope.interface.registry import _u
+        from zope.interface._compat import _u
         class IFoo(InterfaceClass):
             pass
         ifoo = IFoo('IFoo')
@@ -1755,6 +1758,7 @@
     def test_registeredHandlers_non_empty(self):
         from zope.interface.declarations import InterfaceClass
         from zope.interface.registry import HandlerRegistration
+        from zope.interface._compat import _FUNC_CODE
         class IFoo(InterfaceClass):
             pass
         ifoo = IFoo('IFoo')
@@ -1766,7 +1770,7 @@
         comp.registerHandler(_factory1, (ifoo,))
         comp.registerHandler(_factory2, (ifoo,))
         def _factory_name(x):
-            return x.factory.func_code.co_name
+            return getattr(x.factory, _FUNC_CODE).co_name
         subscribers = sorted(comp.registeredHandlers(), key=_factory_name)
         self.assertEqual(len(subscribers), 2)
         self.failUnless(isinstance(subscribers[0], HandlerRegistration))
@@ -1782,7 +1786,7 @@
  
     def test_unregisterHandler_w_nonblank_name(self):
         from zope.interface.declarations import InterfaceClass
-        from zope.interface.registry import _u
+        from zope.interface._compat import _u
         class IFoo(InterfaceClass):
             pass
         ifoo = IFoo('IFoo')
@@ -1895,19 +1899,20 @@
 
     def test_handle_empty(self):
         from zope.interface.declarations import InterfaceClass
-        from zope.interface.declarations import implements
+        from zope.interface.declarations import implementer
         class IFoo(InterfaceClass):
             pass
         ifoo = IFoo('IFoo')
         comp = self._makeOne()
+        @implementer(ifoo)
         class Bar(object):
-            implements(ifoo)
+            pass
         bar = Bar()
         comp.handle((bar,)) # doesn't raise
 
     def test_handle_non_empty(self):
         from zope.interface.declarations import InterfaceClass
-        from zope.interface.declarations import implements
+        from zope.interface.declarations import implementer
         class IFoo(InterfaceClass):
             pass
         ifoo = IFoo('IFoo')
@@ -1920,8 +1925,9 @@
         comp = self._makeOne()
         comp.registerHandler(_factory_1, (ifoo,))
         comp.registerHandler(_factory_2, (ifoo,))
+        @implementer(ifoo)
         class Bar(object):
-            implements(ifoo)
+            pass
         bar = Bar()
         comp.handle(bar)
         self.assertEqual(_called_1, [bar])
@@ -1940,7 +1946,7 @@
 
     def _makeOne(self, component=None, factory=None):
         from zope.interface.declarations import InterfaceClass
-        from zope.interface.registry import _u
+        from zope.interface._compat import _u
         class IFoo(InterfaceClass):
             pass
         ifoo = IFoo('IFoo')
@@ -2125,7 +2131,7 @@
 
     def _makeOne(self, component=None):
         from zope.interface.declarations import InterfaceClass
-        from zope.interface.registry import _u
+        from zope.interface._compat import _u
         class IFoo(InterfaceClass):
             pass
         ifoo = IFoo('IFoo')
@@ -2334,7 +2340,7 @@
 
     def _makeOne(self, component=None):
         from zope.interface.declarations import InterfaceClass
-        from zope.interface.registry import _u
+        from zope.interface._compat import _u
         class IFoo(InterfaceClass):
             pass
         ifoo = IFoo('IFoo')
@@ -2371,7 +2377,7 @@
 
     def _makeOne(self, component=None):
         from zope.interface.declarations import InterfaceClass
-        from zope.interface.registry import _u
+        from zope.interface._compat import _u
         class IFoo(InterfaceClass):
             pass
         ifoo = IFoo('IFoo')

Modified: zope.interface/branches/tseaver-no_2to3/src/zope/interface/tests/test_verify.py
===================================================================
--- zope.interface/branches/tseaver-no_2to3/src/zope/interface/tests/test_verify.py	2012-04-04 23:31:42 UTC (rev 124955)
+++ zope.interface/branches/tseaver-no_2to3/src/zope/interface/tests/test_verify.py	2012-04-04 23:40:49 UTC (rev 124956)
@@ -50,27 +50,28 @@
 
     def test_class_doesnt_have_required_method_simple(self):
         from zope.interface import Interface
-        from zope.interface import implements
+        from zope.interface import implementer
         from zope.interface.exceptions import BrokenImplementation
 
         class ICurrent(Interface):
             def method(): pass
 
+        @implementer(ICurrent)
         class Current(object):
-            implements(ICurrent)
+            pass
 
         self.assertRaises(BrokenImplementation,
                           self._callFUT, ICurrent, Current)
 
     def test_class_has_required_method_simple(self):
         from zope.interface import Interface
-        from zope.interface import implements
+        from zope.interface import implementer
 
         class ICurrent(Interface):
             def method(): pass
 
+        @implementer(ICurrent)
         class Current(object):
-            implements(ICurrent)
 
             def method(self):
                 pass
@@ -79,7 +80,7 @@
 
     def test_class_doesnt_have_required_method_derived(self):
         from zope.interface import Interface
-        from zope.interface import implements
+        from zope.interface import implementer
         from zope.interface.exceptions import BrokenImplementation
 
         class IBase(Interface):
@@ -89,15 +90,16 @@
         class IDerived(IBase):
             pass
 
+        @implementer(IDerived)
         class Current(object):
-            implements(IDerived)
+            pass
 
         self.assertRaises(BrokenImplementation,
                           self._callFUT, IDerived, Current)
 
     def test_class_has_required_method_derived(self):
         from zope.interface import Interface
-        from zope.interface import implements
+        from zope.interface import implementer
 
         class IBase(Interface):
             def method():
@@ -106,8 +108,8 @@
         class IDerived(IBase):
             pass
 
+        @implementer(IDerived)
         class Current(object):
-            implements(IDerived)
 
             def method(self):
                 pass
@@ -117,15 +119,15 @@
     def test_method_takes_wrong_arg_names_but_OK(self):
         # We no longer require names to match.
         from zope.interface import Interface
-        from zope.interface import implements
+        from zope.interface import implementer
 
         class ICurrent(Interface):
 
             def method(a):
                 pass
 
+        @implementer(ICurrent)
         class Current(object):
-            implements(ICurrent)
 
             def method(self, b):
                 pass
@@ -134,7 +136,7 @@
 
     def test_method_takes_not_enough_args(self):
         from zope.interface import Interface
-        from zope.interface import implements
+        from zope.interface import implementer
         from zope.interface.exceptions import BrokenMethodImplementation
 
         class ICurrent(Interface):
@@ -142,8 +144,8 @@
             def method(a):
                 pass
 
+        @implementer(ICurrent)
         class Current(object):
-            implements(ICurrent)
 
             def method(self):
                 pass
@@ -153,7 +155,7 @@
 
     def test_method_doesnt_take_required_starargs(self):
         from zope.interface import Interface
-        from zope.interface import implements
+        from zope.interface import implementer
         from zope.interface.exceptions import BrokenMethodImplementation
 
         class ICurrent(Interface):
@@ -161,8 +163,8 @@
             def method(*args):
                 pass
 
+        @implementer(ICurrent)
         class Current(object):
-            implements(ICurrent)
 
             def method(self):
                 pass
@@ -172,7 +174,7 @@
 
     def test_method_doesnt_take_required_only_kwargs(self):
         from zope.interface import Interface
-        from zope.interface import implements
+        from zope.interface import implementer
         from zope.interface.exceptions import BrokenMethodImplementation
 
         class ICurrent(Interface):
@@ -180,8 +182,8 @@
             def method(**kw):
                 pass
 
+        @implementer(ICurrent)
         class Current(object):
-            implements(ICurrent)
 
             def method(self):
                 pass
@@ -191,7 +193,7 @@
 
     def test_method_takes_extra_arg(self):
         from zope.interface import Interface
-        from zope.interface import implements
+        from zope.interface import implementer
         from zope.interface.exceptions import BrokenMethodImplementation
 
         class ICurrent(Interface):
@@ -199,8 +201,8 @@
             def method(a):
                 pass
 
+        @implementer(ICurrent)
         class Current(object):
-            implements(ICurrent)
 
             def method(self, a, b):
                 pass
@@ -210,15 +212,15 @@
 
     def test_method_takes_extra_arg_with_default(self):
         from zope.interface import Interface
-        from zope.interface import implements
+        from zope.interface import implementer
 
         class ICurrent(Interface):
 
             def method(a):
                 pass
 
+        @implementer(ICurrent)
         class Current(object):
-            implements(ICurrent)
 
             def method(self, a, b=None):
                 pass
@@ -227,15 +229,15 @@
 
     def test_method_takes_only_positional_args(self):
         from zope.interface import Interface
-        from zope.interface import implements
+        from zope.interface import implementer
 
         class ICurrent(Interface):
 
             def method(a):
                 pass
 
+        @implementer(ICurrent)
         class Current(object):
-            implements(ICurrent)
 
             def method(self, *args):
                 pass
@@ -244,7 +246,7 @@
 
     def test_method_takes_only_kwargs(self):
         from zope.interface import Interface
-        from zope.interface import implements
+        from zope.interface import implementer
         from zope.interface.exceptions import BrokenMethodImplementation
 
         class ICurrent(Interface):
@@ -252,8 +254,8 @@
             def method(a):
                 pass
 
+        @implementer(ICurrent)
         class Current(object):
-            implements(ICurrent)
 
             def method(self, **kw):
                 pass
@@ -263,15 +265,15 @@
 
     def test_method_takes_extra_starargs(self):
         from zope.interface import Interface
-        from zope.interface import implements
+        from zope.interface import implementer
 
         class ICurrent(Interface):
 
             def method(a):
                 pass
 
+        @implementer(ICurrent)
         class Current(object):
-            implements(ICurrent)
 
             def method(self, a, *args):
                 pass
@@ -280,15 +282,15 @@
 
     def test_method_takes_extra_starargs_and_kwargs(self):
         from zope.interface import Interface
-        from zope.interface import implements
+        from zope.interface import implementer
 
         class ICurrent(Interface):
 
             def method(a):
                 pass
 
+        @implementer(ICurrent)
         class Current(object):
-            implements(ICurrent)
 
             def method(self, a, *args, **kw):
                 pass
@@ -297,7 +299,7 @@
 
     def test_method_doesnt_take_required_positional_and_starargs(self):
         from zope.interface import Interface
-        from zope.interface import implements
+        from zope.interface import implementer
         from zope.interface.exceptions import BrokenMethodImplementation
 
         class ICurrent(Interface):
@@ -305,8 +307,8 @@
             def method(a, *args):
                 pass
 
+        @implementer(ICurrent)
         class Current(object):
-            implements(ICurrent)
 
             def method(self, a):
                 pass
@@ -316,15 +318,15 @@
 
     def test_method_takes_required_positional_and_starargs(self):
         from zope.interface import Interface
-        from zope.interface import implements
+        from zope.interface import implementer
 
         class ICurrent(Interface):
 
             def method(a, *args):
                 pass
 
+        @implementer(ICurrent)
         class Current(object):
-            implements(ICurrent)
 
             def method(self, a, *args):
                 pass
@@ -333,15 +335,15 @@
 
     def test_method_takes_only_starargs(self):
         from zope.interface import Interface
-        from zope.interface import implements
+        from zope.interface import implementer
 
         class ICurrent(Interface):
 
             def method(a, *args):
                 pass
 
+        @implementer(ICurrent)
         class Current(object):
-            implements(ICurrent)
 
             def method(self, *args):
                 pass
@@ -350,15 +352,15 @@
 
     def test_method_takes_required_kwargs(self):
         from zope.interface import Interface
-        from zope.interface import implements
+        from zope.interface import implementer
 
         class ICurrent(Interface):
 
             def method(**kwargs):
                 pass
 
+        @implementer(ICurrent)
         class Current(object):
-            implements(ICurrent)
 
             def method(self, **kw):
                 pass
@@ -367,7 +369,7 @@
 
     def test_method_takes_positional_plus_required_starargs(self):
         from zope.interface import Interface
-        from zope.interface import implements
+        from zope.interface import implementer
         from zope.interface.exceptions import BrokenMethodImplementation
 
         class ICurrent(Interface):
@@ -375,8 +377,8 @@
             def method(*args):
                 pass
 
+        @implementer(ICurrent)
         class Current(object):
-            implements(ICurrent)
 
             def method(self, a, *args):
                 pass
@@ -387,7 +389,7 @@
 
     def test_method_doesnt_take_required_kwargs(self):
         from zope.interface import Interface
-        from zope.interface import implements
+        from zope.interface import implementer
         from zope.interface.exceptions import BrokenMethodImplementation
 
         class ICurrent(Interface):
@@ -395,8 +397,8 @@
             def method(**kwargs):
                 pass
 
+        @implementer(ICurrent)
         class Current(object):
-            implements(ICurrent)
 
             def method(self, a):
                 pass
@@ -408,13 +410,13 @@
     def test_class_has_method_for_iface_attr(self):
         from zope.interface import Attribute
         from zope.interface import Interface
-        from zope.interface import implements
+        from zope.interface import implementer
 
         class ICurrent(Interface):
             attr = Attribute("The foo Attribute")
 
+        @implementer(ICurrent)
         class Current:
-            implements(ICurrent)
 
             def attr(self):
                 pass
@@ -423,15 +425,15 @@
 
     def test_class_has_nonmethod_for_method(self):
         from zope.interface import Interface
-        from zope.interface import implements
+        from zope.interface import implementer
         from zope.interface.exceptions import BrokenMethodImplementation
 
         class ICurrent(Interface):
             def method():
                 pass
 
+        @implementer(ICurrent)
         class Current:
-            implements(ICurrent)
             method = 1
 
         self.assertRaises(BrokenMethodImplementation,
@@ -440,13 +442,13 @@
     def test_class_has_attribute_for_attribute(self):
         from zope.interface import Attribute
         from zope.interface import Interface
-        from zope.interface import implements
+        from zope.interface import implementer
 
         class ICurrent(Interface):
             attr = Attribute("The foo Attribute")
 
+        @implementer(ICurrent)
         class Current:
-            implements(ICurrent)
 
             attr = 1
 
@@ -456,20 +458,21 @@
         # This check *passes* for verifyClass
         from zope.interface import Attribute
         from zope.interface import Interface
-        from zope.interface import implements
+        from zope.interface import implementer
 
         class ICurrent(Interface):
             attr = Attribute("The foo Attribute")
 
+        @implementer(ICurrent)
         class Current:
-            implements(ICurrent)
+            pass
 
         self._callFUT(ICurrent, Current)
 
     def test_w_callable_non_func_method(self):
         from zope.interface.interface import Method
         from zope.interface import Interface
-        from zope.interface import implements
+        from zope.interface import implementer
 
         class QuasiMethod(Method):
             def __call__(self, *args, **kw):
@@ -482,8 +485,8 @@
         class ICurrent(Interface):
             attr = QuasiMethod('This is callable')
 
+        @implementer(ICurrent)
         class Current:
-            implements(ICurrent)
             attr = QuasiCallable()
 
         self._callFUT(ICurrent, Current)
@@ -500,14 +503,15 @@
         # This check *fails* for verifyObject
         from zope.interface import Attribute
         from zope.interface import Interface
-        from zope.interface import implements
+        from zope.interface import implementer
         from zope.interface.exceptions import BrokenImplementation
 
         class ICurrent(Interface):
             attr = Attribute("The foo Attribute")
 
+        @implementer(ICurrent)
         class Current:
-            implements(ICurrent)
+            pass
 
         self.assertRaises(BrokenImplementation,
                           self._callFUT, ICurrent, Current)

Modified: zope.interface/branches/tseaver-no_2to3/src/zope/interface/verify.py
===================================================================
--- zope.interface/branches/tseaver-no_2to3/src/zope/interface/verify.py	2012-04-04 23:31:42 UTC (rev 124955)
+++ zope.interface/branches/tseaver-no_2to3/src/zope/interface/verify.py	2012-04-04 23:40:49 UTC (rev 124956)
@@ -17,6 +17,7 @@
 from zope.interface.exceptions import BrokenMethodImplementation
 from types import FunctionType, MethodType
 from zope.interface.interface import fromMethod, fromFunction, Method
+from zope.interface._compat import _IM_FUNC
 import sys
 
 # This will be monkey-patched when running under Zope 2, so leave this
@@ -74,7 +75,7 @@
                 # Nope, just a normal function
                 meth = fromFunction(attr, iface, name=name)
         elif (isinstance(attr, MethodTypes)
-              and type(attr.im_func) is FunctionType):
+              and type(getattr(attr, _IM_FUNC)) is FunctionType):
             meth = fromMethod(attr, iface, name)
         else:
             if not callable(attr):



More information about the checkins mailing list