THRIFT-4012 Python Twisted implementation uses implements, not compatible with Py3
Client: Python
Patch: Palmer Cox <palmer@fiscalnote.com>
This closes #1144
Zope implements doesn't work with Python 3; @implementer does. Replace uses of implements with @implementer since the former does not work with Python 3, while the latter works with both Python 2 and 3.
diff --git a/compiler/cpp/src/thrift/generate/t_py_generator.cc b/compiler/cpp/src/thrift/generate/t_py_generator.cc
index 1d11144..fa4b1e4 100644
--- a/compiler/cpp/src/thrift/generate/t_py_generator.cc
+++ b/compiler/cpp/src/thrift/generate/t_py_generator.cc
@@ -1051,7 +1051,7 @@
<< import_dynbase_;
if (gen_twisted_) {
- f_service_ << "from zope.interface import Interface, implements" << endl
+ f_service_ << "from zope.interface import Interface, implementer" << endl
<< "from twisted.internet import defer" << endl
<< "from thrift.transport import TTwisted" << endl;
} else if (gen_tornado_) {
@@ -1180,8 +1180,8 @@
f_service_ << endl << endl;
if (gen_twisted_) {
- f_service_ << "class Client" << extends_client << ":" << endl
- << indent_str() << "implements(Iface)" << endl
+ f_service_ << "@implementer(Iface)" << endl
+ << "class Client" << extends_client << ":" << endl
<< endl;
} else {
f_service_ << "class Client(" << extends_client << "Iface):" << endl;
@@ -1720,8 +1720,8 @@
// Generate the header portion
if (gen_twisted_) {
- f_service_ << "class Processor(" << extends_processor << "TProcessor):" << endl
- << indent_str() << "implements(Iface)" << endl << endl;
+ f_service_ << "@implementer(Iface)" << endl
+ << "class Processor(" << extends_processor << "TProcessor):" << endl;
} else {
f_service_ << "class Processor(" << extends_processor << "Iface, TProcessor):" << endl;
}