-
-
Notifications
You must be signed in to change notification settings - Fork 8.2k
port-javascript: can't push twice #4860
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
would raise syntax error when importing externals.
patch is invalid it's just to show what will fail when going from do_load_from_lexer() there micropython/py/builtinimport.c Line 143 in 34c04d2
|
that seems to work https://gist.github.com/pmp-p/d72c8dddc8c3e28072b64176fa6a2492 but could be only for one code path in a test case. I leave that to any emscripten and core expert around. |
mp_print_uint(print, rc->n_qstr)
no idea if there's a connexion to the nlr_push(&nlr) return value, but since recent emsdk update i get (on WASM builds not WASM=0 like javascript port) |
Can you please expand on this, and also provide a way to reproduce the error that you see? |
@dpgeorge just drop and compile https://github.com/pmp-p/micropython-ports-wasm into ports folder and launch the python mini server provided with and goto to http://127.0.0.1:8000/next.html edit/ with all emsdk version i have i get some "syntax error" on the first non empty / non comment line. edit/ problem is raised by the parser because a module with a zero sized file - or with comments does not raise syntax error. I can't explain to myself why at all apart from emsdk problem since the imp workaround here https://github.com/pmp-p/micropython-ports-wasm/blob/master/assets/imp.py can build a good module via its source even with untouched micropython git source. edit/ parts of imp that use exec are there https://github.com/pmp-p/micropython-ports-wasm/blob/087b7d674c6d65e0b0ea28011e161caa8e4609cf/main.c#L180. AFAIK exec uses the same mechanism as import so it's really puzzling. |
i added empty.py and asset.py into assets folder, namespace packages and empty modules or containing '#' are fine ( and still import assets.assets raise the syntax too error i checked )
|
i think it has to do with memory allocation in #4723 is failing too but in a different way. |
@dpgeorge i found something weird by changing mp_lexer_show_token to
and calling it there https://github.com/micropython/micropython/blob/master/py/parse.c#L1142
does 0 means the token was invalid or that vstr pointer failed to advance ? |
That's allowed. If the kind is MP_TOKEN_INVALID (=1) then vstr is not necessarily valid. Only certain tokens are associated with a valid vstr. The "try" value you see in the vstr is from the previous valid token. |
@dpgeorge thx now i know what to search for, i guess lexer buffer got corrupted while parsing. |
pfffff i used fread instead of fgets lexer was running after source code len well at least i'll keep that e615932 |
would raise syntax error when importing externals.