py: Prevent crash with LTO.

The protected single function call saves stack values and LTO
breaks the expectations of nlr_push and pop.
This commit is contained in:
Scott Shawcroft 2017-11-01 13:24:19 -07:00
parent dcede575ff
commit 6370b5225a
1 changed files with 2 additions and 1 deletions

View File

@ -25,9 +25,10 @@
* THE SOFTWARE. * THE SOFTWARE.
*/ */
#include "py/mpconfig.h"
#include "py/runtime.h" #include "py/runtime.h"
void mp_call_function_1_protected(mp_obj_t fun, mp_obj_t arg) { MP_NOINLINE void mp_call_function_1_protected(mp_obj_t fun, mp_obj_t arg) {
nlr_buf_t nlr; nlr_buf_t nlr;
if (nlr_push(&nlr) == 0) { if (nlr_push(&nlr) == 0) {
mp_call_function_1(fun, arg); mp_call_function_1(fun, arg);