This commit is contained in:
BLUELOVETH 2023-06-01 00:36:04 +08:00
parent 08d6a9a1ea
commit 66301591a2

View File

@ -556,11 +556,6 @@ public:
Temp(VM* vm, StrName name, int type): vm(vm), name(name){
ImportContext* ctx = &vm->_import_context;
for(auto& [k,v]: ctx->pending){
if(k == name){
vm->_error("ImportError", fmt("circular import ", name.escape()));
}
}
ctx->pending.emplace_back(name, type);
}
@ -596,6 +591,11 @@ public:
type = 0;
filename = fmt(name, ".py");
}
for(auto& [k, v]: _import_context.pending){
if(k == name){
vm->_error("ImportError", fmt("circular import ", name.escape()));
}
}
PyObject* ext_mod = _modules.try_get(name);
if(ext_mod == nullptr){
Str source;