mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-20 19:40:18 +00:00
some fix
This commit is contained in:
parent
bc51c5e19d
commit
4633ca7242
@ -493,7 +493,9 @@ static bool pkpy_profiler_reset(int argc, py_Ref argv) {
|
|||||||
|
|
||||||
static bool pkpy_profiler_report(int argc, py_Ref argv) {
|
static bool pkpy_profiler_report(int argc, py_Ref argv) {
|
||||||
PY_CHECK_ARGC(0);
|
PY_CHECK_ARGC(0);
|
||||||
c11_string* report = LineProfiler__get_report(&pk_current_vm->line_profiler);
|
LineProfiler* lp = &pk_current_vm->line_profiler;
|
||||||
|
if(lp->enabled) LineProfiler__end(lp);
|
||||||
|
c11_string* report = LineProfiler__get_report(lp);
|
||||||
bool ok = py_json_loads(report->data);
|
bool ok = py_json_loads(report->data);
|
||||||
c11_string__delete(report);
|
c11_string__delete(report);
|
||||||
return ok;
|
return ok;
|
||||||
|
@ -51,9 +51,8 @@ int main(int argc, char** argv) {
|
|||||||
py_initialize();
|
py_initialize();
|
||||||
py_sys_setargv(argc, argv);
|
py_sys_setargv(argc, argv);
|
||||||
|
|
||||||
if(profile) py_sys_settrace(py_LineProfiler_tracefunc, true);
|
|
||||||
|
|
||||||
if(filename == NULL) {
|
if(filename == NULL) {
|
||||||
|
if(profile) printf("Warning: --profile is ignored in REPL mode.\n");
|
||||||
printf("pocketpy " PK_VERSION " (" __DATE__ ", " __TIME__ ") ");
|
printf("pocketpy " PK_VERSION " (" __DATE__ ", " __TIME__ ") ");
|
||||||
printf("[%d bit] on %s", (int)(sizeof(void*) * 8), PY_SYS_PLATFORM_STRING);
|
printf("[%d bit] on %s", (int)(sizeof(void*) * 8), PY_SYS_PLATFORM_STRING);
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
@ -79,6 +78,7 @@ int main(int argc, char** argv) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
if(profile) py_sys_settrace(py_LineProfiler_tracefunc, true);
|
||||||
char* source = read_file(filename);
|
char* source = read_file(filename);
|
||||||
if(source) {
|
if(source) {
|
||||||
if(!py_exec(source, filename, EXEC_MODE, NULL)) py_printexc();
|
if(!py_exec(source, filename, EXEC_MODE, NULL)) py_printexc();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user