Skip to content

Commit 9113282

Browse files
committed
Add control for exception (file not found) on python loader.
1 parent cc47843 commit 9113282

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

source/loaders/py_loader/source/py_loader_impl.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1562,6 +1562,8 @@ int py_loader_impl_initialize_import(loader_impl_py py_impl)
15621562
" return importlib.import_module(module_name)\n"
15631563
" else:\n"
15641564
" spec = importlib.util.spec_from_file_location(module_name, path)\n"
1565+
" if spec is None:\n"
1566+
" raise ModuleNotFoundError('File ' + path + ' could not be found')\n"
15651567
" m = importlib.util.module_from_spec(spec)\n"
15661568
" spec.loader.exec_module(m)\n"
15671569
" return m\n"

0 commit comments

Comments
 (0)