aboutsummaryrefslogtreecommitdiff
path: root/tests/import
diff options
context:
space:
mode:
authorLéa Saviot2019-11-22 14:06:49 +0100
committerDamien George2019-11-26 00:28:32 +1100
commita7bc4d1a1455a8a5cdea53d7a2caf03c9320f460 (patch)
tree9aba81df900652ea42284c9cf800599fff7acaa2 /tests/import
parent6b3404f25e3d901d9b1313f2827a760093cddd92 (diff)
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')
-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 088f631fc..157da9839 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)