roshanjrajan-zip commented on code in PR #2825:
URL: https://github.com/apache/thrift/pull/2825#discussion_r1249129206


##########
compiler/cpp/src/thrift/generate/t_py_generator.cc:
##########
@@ -871,7 +871,12 @@ void 
t_py_generator::generate_py_struct_definition(ostream& out,
       }
 
       if (is_immutable(tstruct)) {
-        if (gen_newstyle_ || gen_dynamic_) {
+        if (gen_enum_ && type->is_enum()) {
+          indent(out) << "super(" << tstruct->get_name() << ", 
self).__setattr__('"

Review Comment:
   The code that generates `super(TestException, self).__setattr__('whatOp', 
whatOp)` already exists before my change and I am extending this pattern. In 
python, [super](https://docs.python.org/3/library/functions.html#super) is 
implemented as part of the binding process for explicit dotted attribute 
lookups such as __setattr__ and such. So I don't think this is a concern 
because this is how Python does things under the hood.



-- 
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]

Reply via email to