Search found 49 matches

by BramPeeters
Fri Dec 21, 2018 6:44 pm
Forum: Development of MicroPython
Topic: Right way of synchronizing C and Micropython
Replies: 4
Views: 622

Re: Right way of synchronizing C and Micropython

What makes you say micropython is running a single thread ? I don't know the esp platform, but on eg an stm with freertos under it i have several micropython threads. Wether or not they are capable of interrupting each other depends on your use of the GIL. (I enabled it so that my python threads do ...
by BramPeeters
Thu Oct 11, 2018 9:28 am
Forum: Development of MicroPython
Topic: Finaliser/__del__
Replies: 10
Views: 831

Re: Finaliser/__del__

A limitation not yet mentioned here seems to be that with the current state of code, __del__ is not called when the the object is freed not by the garbage collector, but with a gc_free. ( I assume this will change at some point since there is a TODO for it) And a side question: any reason why m_new_...
by BramPeeters
Sun Oct 07, 2018 4:38 pm
Forum: Development of MicroPython
Topic: [Solved]Catch exception raised in C in python
Replies: 5
Views: 404

Re: [Solved]Catch exception raised in C in python

Ok, thanks for the pointers/explanation !
by BramPeeters
Tue Oct 02, 2018 3:34 pm
Forum: Development of MicroPython
Topic: [Solved]Catch exception raised in C in python
Replies: 5
Views: 404

Re: Catch exception raised in C in python

You describe exactly what I was trying to do and after rechecking it in fact it works perfect, thank you! How does it work under the hood, does try 'try' instruction (temporary) replace the target jump address ? The reason it did not seem to work before is because I was still using an old .py script...
by BramPeeters
Tue Oct 02, 2018 2:40 pm
Forum: Development of MicroPython
Topic: [Solved]Catch exception raised in C in python
Replies: 5
Views: 404

[Solved]Catch exception raised in C in python

Hi. I just read an (old) thread about this topic (https://forum.micropython.org/viewtopic.php?f=2&t=178) which seems to indicate that it is possible to 'catch' an 'exception' in a python try-except block that is raised in C. However i am not able to reproduce that nor do I understand how to get it w...
by BramPeeters
Thu Sep 27, 2018 7:21 pm
Forum: Development of MicroPython
Topic: How to get a ll out of an objint (inverse of mp_obj_new_int_from_ll)
Replies: 2
Views: 248

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

My int's are 32 bit and long long's 64 bit, so thank you very much !
by BramPeeters
Thu Sep 27, 2018 5:04 pm
Forum: Development of MicroPython
Topic: How to get a ll out of an objint (inverse of mp_obj_new_int_from_ll)
Replies: 2
Views: 248

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

Hi, After creating an objint with mp_obj_new_int_from_ll, is there a way to get the long long out of there afterwards? At the moment I am only seeing the mp_int_t mp_obj_get_int(mp_const_obj_t arg) function, but that returns an mp_int_t which is not suppose to have the long long size. Is mp_obj_int_...
by BramPeeters
Mon Sep 24, 2018 10:01 am
Forum: Development of MicroPython
Topic: [SOLVED]Executing a method specified as a string of an mp_obj_t in C
Replies: 9
Views: 577

Re: [SOLVED]Executing a method specified as a string of an mp_obj_t in C

No mostly thinking out loud, sorry.

But now I was looking for a way to purge the learned qstrings from
mp_state_ctx.vm.last_pool
to start 'fresh'.

As far as I can see there is not (yet) a function to do that ? So i would have to walk through the pool list myself to clear each pool ?
by BramPeeters
Sun Sep 23, 2018 10:35 pm
Forum: Development of MicroPython
Topic: [SOLVED]Executing a method specified as a string of an mp_obj_t in C
Replies: 9
Views: 577

Re: [SOLVED]Executing a method specified as a string of an mp_obj_t in C

What do you mean by your last sentence? I don't currently have that situation (yet) but i can imagine having a situation where the method you need call is a string parameter (eg maybe it arrives from a remote server as a command or something ). In that case it will be hard for the server to know th...
by BramPeeters
Sun Sep 23, 2018 1:32 pm
Forum: Development of MicroPython
Topic: [SOLVED]Executing a method specified as a string of an mp_obj_t in C
Replies: 9
Views: 577

Re: [SOLVED]Executing a method specified as a string of an mp_obj_t in C

Q strings can never be deleted so they will take up increasing amount of ram if you keep on introducing new strings Yes, but in this case they are not new strings, they are method names that already exist as a qstring. If i recall correctly qstr_from_str will first search if the string you pass alr...