In strict stackless mode, it's not possible to make a function call with
heap locked (because function activation record aka frame is allocated on
heap). So, if the only purpose of function is to introduce local variable
scope, move heap lock/unlock calls inside the function.
When printing exceptions from files sent to a target by pyboard.py the
filename in the exception is <stdin>, which differs to when running the
script on the PC. So we strip out the filename to make the outputs the
same on all targets (see also misc/print_exception.py test).