mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-20 11:30:18 +00:00
Merge branch 'main' into chunked_array2d
This commit is contained in:
commit
315bf4b3d6
@ -165,7 +165,7 @@ bool py_importlib_reload(py_GlobalRef module) {
|
|||||||
c11_sv path = py_tosv(py_getdict(module, __path__));
|
c11_sv path = py_tosv(py_getdict(module, __path__));
|
||||||
c11_string* slashed_path = c11_sv__replace(path, '.', PK_PLATFORM_SEP);
|
c11_string* slashed_path = c11_sv__replace(path, '.', PK_PLATFORM_SEP);
|
||||||
c11_string* filename = c11_string__new3("%s.py", slashed_path->data);
|
c11_string* filename = c11_string__new3("%s.py", slashed_path->data);
|
||||||
const char* data = vm->callbacks.importfile(filename->data);
|
char* data = vm->callbacks.importfile(filename->data);
|
||||||
if(data == NULL) {
|
if(data == NULL) {
|
||||||
c11_string__delete(filename);
|
c11_string__delete(filename);
|
||||||
filename = c11_string__new3("%s%c__init__.py", slashed_path->data, PK_PLATFORM_SEP);
|
filename = c11_string__new3("%s%c__init__.py", slashed_path->data, PK_PLATFORM_SEP);
|
||||||
@ -175,6 +175,7 @@ bool py_importlib_reload(py_GlobalRef module) {
|
|||||||
if(data == NULL) return ImportError("module '%v' not found", path);
|
if(data == NULL) return ImportError("module '%v' not found", path);
|
||||||
bool ok = py_exec(data, filename->data, EXEC_MODE, module);
|
bool ok = py_exec(data, filename->data, EXEC_MODE, module);
|
||||||
c11_string__delete(filename);
|
c11_string__delete(filename);
|
||||||
|
PK_FREE(data);
|
||||||
py_assign(py_retval(), module);
|
py_assign(py_retval(), module);
|
||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user