fishy commented on code in PR #2825:
URL: https://github.com/apache/thrift/pull/2825#discussion_r1248032564
##########
compiler/cpp/src/thrift/generate/t_py_generator.cc:
##########
@@ -905,6 +905,32 @@ void
t_py_generator::generate_py_struct_definition(ostream& out,
}
out << "))" << endl;
+ } else if (gen_enum_) {
+ bool has_enum = false;
+ for (m_iter = members.begin(); m_iter != members.end(); ++m_iter) {
+ t_type* type = (*m_iter)->get_type();
+ if (type->is_enum()) {
+ has_enum = true;
+ break;
+ }
+ }
+
+ if (has_enum) {
+ out << endl;
+ indent(out) << "def __setattr__(self, name, value):" << endl;
+ indent_up();
+ for (m_iter = members.begin(); m_iter != members.end(); ++m_iter) {
Review Comment:
can you add a test (and also paste the generated python code into PR
discussion) on when a struct has 2 fields that's enum (and they are different
enum types)?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]