Opened 3 years ago

Closed 3 years ago

#8431 enhancement closed duplicate (duplicate)

From zope.interface , change implements() to @implementer decorator in twisted/names

Reported by: Craig Rodrigues Owned by:
Priority: normal Milestone: Python-3.x
Component: names Keywords:
Cc: Branch:


zope.interface.implements() was deprecated in Python 2.x, and raises a hard error in Python 3.x. I am choosing this example at random, but here is an example error:

Traceback (most recent call last):
  File "/Users/crodrigues/twisted3/build/py36-tests-posix/lib/python3.6/site-packages/twisted/trial/", line 784, in loadByName
    return self.suiteFactory([self.findByName(name, recurse=recurse)])
  File "/Users/crodrigues/twisted3/build/py36-tests-posix/lib/python3.6/site-packages/twisted/trial/", line 682, in findByName
  File "/Users/crodrigues/twisted3/build/py36-tests-posix/lib/python3.6/site-packages/twisted/words/test/", line 7, in <module>
    from twisted.words.xish.domish import Element
  File "/Users/crodrigues/twisted3/build/py36-tests-posix/lib/python3.6/site-packages/twisted/words/xish/", line 287, in <module>
    class Element(object):
  File "/Users/crodrigues/twisted3/build/py36-tests-posix/lib/python3.6/site-packages/twisted/words/xish/", line 386, in Element
  File "/Users/crodrigues/twisted3/build/py36-tests-posix/lib/python3.6/site-packages/zope/interface/", line 412, in implements
    raise TypeError(_ADVICE_ERROR % 'implementer')
builtins.TypeError: Class advice impossible in Python3.  Use the @implementer class decorator instead.

In the zope.interface 3.6 documentation, it mentions that the @implementer decorator can be used in Python 2.6 and up:

Barry Warsaw also recommended using the @implementer decorator:

Change History (3)

comment:2 Changed 3 years ago by Craig Rodrigues

Keywords: review added

comment:3 Changed 3 years ago by Adi Roiban

Keywords: review removed
Resolution: duplicate
Status: newclosed

I think that this change was already made as part of the full port in #8262

Note: See TracTickets for help on using tickets.