print(1, 2) prints "1_space_2"
print(1, 2) prints "1_space_2"
Hi, I'm using Numworks port of Micropython https://github.com/numworks/epsilon/ and just noticed print(1, 2) prints "1_space_2" which should be "1 2" instead., mp_builtin_print uses `MP_QSTR__space_` for the separator, which Numeoworks port defines as `Q(_space_)` . I guess original Micropython defined _space_ somewhere else as " "? But I couldn't find it
Re: print(1, 2) prints "1_space_2"
For normal micropython the definition is in a file generated by makeqstrdefs.py and makeqstrdata.py during the build, qstrdefs.generated.h, and looks like QDEF(MP_QSTR__space_, (const byte*)"\x85\xb5\x01" " ") (for my windows build, might be different depending on port). This is pulled from the Q( ) in qstrdefs.h which gets special treatment in makeqstrdata.py.
Re: print(1, 2) prints "1_space_2"
Thanks! I've found it.. I don't understand why it prints differently then lol.... shouldn't normal micropython also print _space_ ? https://github.com/micropython/micropyt ... ins.c#L384
Re: print(1, 2) prints "1_space_2"
No, because in qstrdefs.generated.h it reads
Code: Select all
QDEF(MP_QSTR__space_ blablabla " ")
Re: print(1, 2) prints "1_space_2"
Oh I see. Numworks port has the same makeqstrdata.py https://github.com/numworks/epsilon/blo ... strdata.py but somehow it was generating
But I think it should be straightforward to debug at this point. Thanks a lot!!
Code: Select all
QDEF(MP_QSTR__space_, (const byte*)"\xe1\x07" "_space_")
Re: print(1, 2) prints "1_space_2"
OK so the issue was that, for _space_ we actually need the following two lines and must be ordered in that way.
Code: Select all
Q( )
Q(_space_)