Search found 7 matches

by tim3385
Thu Nov 14, 2019 6:36 pm
Forum: Development of MicroPython
Topic: How to get a ll out of an objint (inverse of mp_obj_new_int_from_ll)
Replies: 4
Views: 476

Re: How to get a ll out of an objint (inverse of mp_obj_new_int_from_ll)

Thanks for your
std::uint64_t mpz_to_64bit_int(const mp_obj_int_t* arg, bool is_signed).
I want to use it to get uint64_t from mp_obj_t which is a number in upy code.

But how to get mp_obj_int_t* from a mp_obj_t? MP_OBJ_TO_PTR is a violent way and cause mpz_to_64bit_int crash.

Thank you.
by tim3385
Sat Nov 09, 2019 3:21 am
Forum: Development of MicroPython
Topic: How to soft reset the whole context of upy when process running?
Replies: 1
Views: 109

Re: How to soft reset the whole context of upy when process running?

This is my code refer from some ports implementation. upy works but soft-reset not works yet. #if MICROPY_ENABLE_GC long heap_size = 1024*1024 * (sizeof(mp_uint_t) / 4); #endif static char *heap = NULL; void __wxpyInit(void) { #if MICROPY_PY_THREAD mp_thread_init(); #endif mp_stack_ctrl_init(); stat...
by tim3385
Sat Nov 09, 2019 3:21 am
Forum: Development of MicroPython
Topic: How to soft reset the whole context of upy when process running?
Replies: 1
Views: 109

How to soft reset the whole context of upy when process running?

THIS TOPIC IS MOVED FROM ISSUES OF GITHUB(Please remove the topic that I post in "General Discussion and Questions"): I integrated upy into my project(Thanks for your great work). upy works well in my project process. In one running process, the python script file(A in short) could be reloaded when ...
by tim3385
Thu Nov 07, 2019 4:23 pm
Forum: General Discussion and Questions
Topic: How to soft reset the whole context of upy when process running?
Replies: 1
Views: 73

Re: How to soft reset the whole context of upy when process running?

This is my code refer from some ports implementation. upy works but soft-reset not works yet. #if MICROPY_ENABLE_GC long heap_size = 1024*1024 * (sizeof(mp_uint_t) / 4); #endif static char *heap = NULL; void __wxpyInit(void) { #if MICROPY_PY_THREAD mp_thread_init(); #endif mp_stack_ctrl_init(); stat...
by tim3385
Thu Nov 07, 2019 4:19 pm
Forum: General Discussion and Questions
Topic: How to soft reset the whole context of upy when process running?
Replies: 1
Views: 73

How to soft reset the whole context of upy when process running?

THIS TOPIC IS MOVED FROM ISSUES OF GITHUB: I integrated upy into my project(Thanks for your great work). upy works well in my project process. In one running process, the python script file(A in short) could be reloaded when it was modified. But another python script file(B in short) that imported b...
by tim3385
Thu Nov 07, 2019 4:17 pm
Forum: General Discussion and Questions
Topic: Python file can't import another py file
Replies: 1
Views: 316

Re: Python file can't import another py file

Importing py files in WASM works. But I am not sure if my method is correct. Here's what I did: 1)mp_lexer_new_from_file() in lexer.c was enabled by set "#define MICROPY_READER_POSIX (1)" in ports/javascript/mpconfigport.h. And comment the mp_lexer_new_from_file() define in the ports/javascript/main...
by tim3385
Mon Aug 05, 2019 3:41 am
Forum: General Discussion and Questions
Topic: Python file can't import another py file
Replies: 1
Views: 316

Python file can't import another py file

I embed javascript port into my emscripten application. mp_js_do_str works fine in my c code. And that pyexec_file invoke a python file is fine too. i.e. upy works in web application. But The python file can't "import" another module which is also a python file in the same directory. I test it in em...