Closed judfs closed 4 months ago
fprintf(f, "%s.%s()", tn, lm->type->shortname);
would fix emit_member_initializer
/ emit_python_init
.
Having trouble finding where the lcm_member_t
values are created if changing the lctypename
value would be preferred.
After looking through emit c, I suppose names are generated and then individual emitters are expected to modify them as needed? Looks like the above change should be the say to go.
Hitting a bug in pyright they won't fix: https://github.com/microsoft/pyright/issues/6674
. My previous proposed solution was also wrong because of this bug.
Resolved by #491
Consider the following:
Add
node_pair_t.lcm
to the example package:node_pair_t.py
looks likeThis causes
Module is not callable Pylance [reportGeneralTypeIssues]
and(variable) head: Unknown
to be reported. Therefore if I typeimport exlcm; foo = exlcm.node_pair_t(); foo.head.num_children
, my editor does not know whathead
is and therefore does not know whatnum_children
is.Things work at all because
__init__.py
has the linefrom .node_t import node_t
. And that is even how I createfoo
above.Things seem to be happy if(Does not run, pyright is bugged in accepting this)self.head = exlcm.node_t.node_t()
were to be emitted instead.Looking at
emit_member_initializer
inlcmgen/emit_python.c
.Why is it done the way it is?
Can/Should thefprintf(f, "%s()", tn);
line be changed?