mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-23 13:00:17 +00:00
...
This commit is contained in:
parent
08d6a9a1ea
commit
66301591a2
10
src/vm.h
10
src/vm.h
@ -556,11 +556,6 @@ public:
|
|||||||
|
|
||||||
Temp(VM* vm, StrName name, int type): vm(vm), name(name){
|
Temp(VM* vm, StrName name, int type): vm(vm), name(name){
|
||||||
ImportContext* ctx = &vm->_import_context;
|
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);
|
ctx->pending.emplace_back(name, type);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -596,6 +591,11 @@ public:
|
|||||||
type = 0;
|
type = 0;
|
||||||
filename = fmt(name, ".py");
|
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);
|
PyObject* ext_mod = _modules.try_get(name);
|
||||||
if(ext_mod == nullptr){
|
if(ext_mod == nullptr){
|
||||||
Str source;
|
Str source;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user