andrewcunnin commented on code in PR #2783:
URL: https://github.com/apache/thrift/pull/2783#discussion_r1169057089
##########
compiler/cpp/src/thrift/generate/t_py_generator.cc:
##########
@@ -2662,6 +2662,11 @@ string t_py_generator::declare_argument(t_field* tfield)
{
string t_py_generator::render_field_default_value(t_field* tfield) {
t_type* type = get_true_type(tfield->get_type());
if (tfield->get_value() != nullptr) {
+ if (type->is_enum() && gen_enum_) {
+ std::ostringstream out;
+ out << tfield->get_value()->get_integer();
+ return out.str();
+ }
Review Comment:
Ah, good catch. That default value change was because I thought Thrift was
generally expecting int values even representing Python enums, but after
re-testing I've found that that was only an issue for serialization and
deserialization. Removed that change and here's the updated diff:
https://gist.github.com/andrewcunnin/ba688afe22f943c7b9f96e67adb3bc53
--
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]