From a7bc4d1a1455a8a5cdea53d7a2caf03c9320f460 Mon Sep 17 00:00:00 2001 From: Léa Saviot Date: Fri, 22 Nov 2019 14:06:49 +0100 Subject: py/builtinimport: Raise exception on empty module name. To prevent a crash returning MP_OBJ_NULL. A test is added for this case. --- tests/import/builtin_import.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'tests') 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) -- cgit v1.2.3