Skip to content

Commit

Permalink
lcmgen: Fix python for pylance #470
Browse files Browse the repository at this point in the history
  • Loading branch information
judfs committed Dec 4, 2023
1 parent 010e09c commit 451f5ea
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lcmgen/emit_python.c
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,12 @@ static void emit_member_initializer(const lcmgen_t *lcm, FILE *f, lcm_member_t *
if (initializer != NULL) {
fprintf(f, "%s", initializer);
} else {
fprintf(f, "%s()", type_name);
/* `type_name` is package.struct_file.
* In general this works because package.py reexports structs.
* It would also work here, but some python tools (pylance) will fail to understand it.
* Instead we emit the fully qualified package.struct_file.struct.
*/
fprintf(f, "%s.%s()", type_name, structure_member->type->shortname);
}
return;
}
Expand Down

0 comments on commit 451f5ea

Please sign in to comment.