summaryrefslogtreecommitdiff
path: root/tests/micropython/builtin_execfile.py
AgeCommit message (Collapse)Author
2024-12-20tests: Fix all file ioctl's to support only MP_STREAM_CLOSE.Damien George
A return value of 0 from Python-level `ioctl()` means success, but if that's returned unconditionally it means that the method supports all ioctl calls, which is not true. Returning 0 without doing anything can potentially lead to a crash, eg for MP_STREAM_SEEK which requires returning a value in the passed-in struct pointer. This commit makes it so that all `ioctl()` methods respond only to MP_STREAM_CLOSE, ie they return -1 (indicating error) for all other ioctl calls. Signed-off-by: Damien George <damien@micropython.org>
2024-02-07tests: Use vfs module instead of os.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2023-10-12py/builtinevex: Handle invalid filenames for execfile.Jim Mussared
If a non-string buffer was passed to execfile, then it would be passed as a non-null-terminated char* to mp_lexer_new_from_file. This changes mp_lexer_new_from_file to take a qstr instead (as in almost all cases a qstr will be created from this input anyway to set the `__file__` attribute on the module). This now makes execfile require a string (not generic buffer) argument, which is probably a good fix to make anyway. Fixes issue #12522. This work was funded through GitHub Sponsors. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-06-08tests: Replace umodule with module everywhere.Jim Mussared
This work was funded through GitHub Sponsors. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-06-29tests/micropython: Add test for builtin execfile() function.Damien George
Signed-off-by: Damien George <damien@micropython.org>