From 2b50aad4ef89a5f3eb4d63c73ce7ca23a6197831 Mon Sep 17 00:00:00 2001 From: blueloveTH Date: Sun, 2 Jun 2024 23:00:50 +0800 Subject: [PATCH] some fix --- src/pocketpy.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/pocketpy.cpp b/src/pocketpy.cpp index 1059c7ec..f82dd7f8 100644 --- a/src/pocketpy.cpp +++ b/src/pocketpy.cpp @@ -1557,7 +1557,9 @@ void VM::__post_init_builtin_types(){ _all_types[tp_module].m__getattr__ = [](VM* vm, PyVar obj, StrName name) -> PyVar{ const Str& path = CAST(Str&, obj->attr(__path__)); - return vm->py_import(_S(path, ".", name.sv()), false); + PyObject* retval = vm->py_import(_S(path, ".", name.sv()), false); + if(retval) return retval; + return nullptr; }; bind_func(tp_property, "setter", 2, [](VM* vm, ArgsView args) {