Skip to content

Commit

Permalink
python: object generation prefix and suffix (#7565)
Browse files Browse the repository at this point in the history
Co-authored-by: Derek Bailey <derekbailey@google.com>
  • Loading branch information
romanholidaypancakes and dbaileychess committed Oct 29, 2022
1 parent 051afd8 commit 15f32c6
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/idl_gen_python.cpp
Expand Up @@ -1160,8 +1160,8 @@ class PythonGenerator : public BaseGenerator {
code += field_type + "()";
}
code += ") is not None:";
code += GenIndents(3) + "self." + field_field + " = " + field_type +
"T.InitFromObj(" + struct_var + "." + field_method + "(";
code += GenIndents(3) + "self." + field_field + " = " + namer_.ObjectType(field_type) +
+ ".InitFromObj(" + struct_var + "." + field_method + "(";
// A struct's accessor requires a struct buf instance.
if (struct_def.fixed && field.value.type.base_type == BASE_TYPE_STRUCT) {
code += field_type + "()";
Expand Down Expand Up @@ -1211,8 +1211,8 @@ class PythonGenerator : public BaseGenerator {
"(i) is None:";
code += GenIndents(5) + "self." + field_field + ".append(None)";
code += GenIndents(4) + "else:";
code += GenIndents(5) + one_instance + " = " + field_type +
"T.InitFromObj(" + struct_var + "." + field_method + "(i))";
code += GenIndents(5) + one_instance + " = " + namer_.ObjectType(field_type) +
".InitFromObj(" + struct_var + "." + field_method + "(i))";
code +=
GenIndents(5) + "self." + field_field + ".append(" + one_instance + ")";
}
Expand Down Expand Up @@ -1242,8 +1242,8 @@ class PythonGenerator : public BaseGenerator {
"(i) is None:";
code += GenIndents(5) + "self." + field_field + ".append(None)";
code += GenIndents(4) + "else:";
code += GenIndents(5) + one_instance + " = " + field_type +
"T.InitFromObj(" + struct_var + "." + field_method + "(i))";
code += GenIndents(5) + one_instance + " = " + namer_.ObjectType(field_type) +
".InitFromObj(" + struct_var + "." + field_method + "(i))";
code +=
GenIndents(5) + "self." + field_field + ".append(" + one_instance + ")";
}
Expand Down

0 comments on commit 15f32c6

Please sign in to comment.