8000 pyboard: When injecting mpy in a variable, clean up even if import fails · micropython/micropython@ef54cdb · GitHub
[go: up one dir, main page]

Skip to content

Commit ef54cdb

Browse files
committed
pyboard: When injecting mpy in a variable, clean up even if import fails
1 parent d5c0107 commit ef54cdb

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

tools/pyboard.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -659,9 +659,11 @@ def open(self, path, mode):
659659
return self.File()
660660
uos.mount(_FS(), '/_')
661661
uos.chdir('/_')
662-
from _injected import *
663-
uos.umount('/_')
664-
del _injected_buf, _FS
662+
try:
663+
from _injected import *
664+
finally:
665+
uos.umount('/_')
666+
del _injected_buf, _FS
665667
"""
666668

667669

0 commit comments

Comments
 (0)
0