summaryrefslogtreecommitdiffstatshomepage
path: root/tests/import/builtin_import.py
diff options
context:
space:
mode:
authorLéa Saviot <lea.saviot@numworks.com>2019-11-22 14:06:49 +0100
committerDamien George <damien.p.george@gmail.com>2019-11-26 00:28:32 +1100
commita7bc4d1a1455a8a5cdea53d7a2caf03c9320f460 (patch)
tree9aba81df900652ea42284c9cf800599fff7acaa2 /tests/import/builtin_import.py
parent6b3404f25e3d901d9b1313f2827a760093cddd92 (diff)
downloadmicropython-a7bc4d1a1455a8a5cdea53d7a2caf03c9320f460.tar.gz
micropython-a7bc4d1a1455a8a5cdea53d7a2caf03c9320f460.zip
py/builtinimport: Raise exception on empty module name.
To prevent a crash returning MP_OBJ_NULL. A test is added for this case.
Diffstat (limited to 'tests/import/builtin_import.py')
-rw-r--r--tests/import/builtin_import.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/import/builtin_import.py b/tests/import/builtin_import.py
index 088f631fcd..157da98398 100644
--- a/tests/import/builtin_import.py
+++ b/tests/import/builtin_import.py
@@ -9,6 +9,12 @@ try:
except TypeError:
print('TypeError')
+# module name should not be empty
+try:
+ __import__("")
+except ValueError:
+ print('ValueError')
+
# level argument should be non-negative
try:
__import__('xyz', None, None, None, -1)