mirror of
https://gitee.com/Lyon1998/pikapython.git
synced 2025-01-15 17:02:53 +08:00
support exec()
builtin
This commit is contained in:
parent
e0eee73209
commit
ac97532a7a
@ -79,6 +79,9 @@ class SysObj:
|
||||
@staticmethod
|
||||
def dir(obj: object) -> list: ...
|
||||
|
||||
@staticmethod
|
||||
def exec(code: str): ...
|
||||
|
||||
|
||||
class RangeObj:
|
||||
def __next__(self) -> any: ...
|
||||
|
@ -499,3 +499,12 @@ PikaObj* PikaStdLib_SysObj_dir(PikaObj* self, PikaObj* obj) {
|
||||
args_deinit(context);
|
||||
return list;
|
||||
}
|
||||
|
||||
void PikaStdLib_SysObj_exec(PikaObj* self, char* code) {
|
||||
#if PIKA_EXEC_ENABLE
|
||||
obj_run(self, code);
|
||||
#else
|
||||
obj_setErrorCode(self, 1);
|
||||
__platform_printf("[Error] PIKA_EXEC_ENABLE is not enabled.\r\n");
|
||||
#endif
|
||||
}
|
||||
|
@ -79,6 +79,9 @@ class SysObj:
|
||||
@staticmethod
|
||||
def dir(obj: object) -> list: ...
|
||||
|
||||
@staticmethod
|
||||
def exec(code: str): ...
|
||||
|
||||
|
||||
class RangeObj:
|
||||
def __next__(self) -> any: ...
|
||||
|
@ -499,3 +499,12 @@ PikaObj* PikaStdLib_SysObj_dir(PikaObj* self, PikaObj* obj) {
|
||||
args_deinit(context);
|
||||
return list;
|
||||
}
|
||||
|
||||
void PikaStdLib_SysObj_exec(PikaObj* self, char* code) {
|
||||
#if PIKA_EXEC_ENABLE
|
||||
obj_run(self, code);
|
||||
#else
|
||||
obj_setErrorCode(self, 1);
|
||||
__platform_printf("[Error] PIKA_EXEC_ENABLE is not enabled.\r\n");
|
||||
#endif
|
||||
}
|
||||
|
@ -106,6 +106,10 @@
|
||||
#define PIKA_FILEIO_ENABLE 0
|
||||
#endif
|
||||
|
||||
#ifndef PIKA_EXEC_ENABLE
|
||||
#define PIKA_EXEC_ENABLE 0
|
||||
#endif
|
||||
|
||||
#elif PIKA_SYNTAX_LEVEL == PIKA_SYNTAX_LEVEL_MAXIMAL
|
||||
#ifndef PIKA_SYNTAX_SLICE_ENABLE
|
||||
#define PIKA_SYNTAX_SLICE_ENABLE 1
|
||||
@ -139,6 +143,10 @@
|
||||
#define PIKA_FILEIO_ENABLE 1
|
||||
#endif
|
||||
|
||||
#ifndef PIKA_EXEC_ENABLE
|
||||
#define PIKA_EXEC_ENABLE 1
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/* default configuration */
|
||||
@ -262,6 +270,10 @@
|
||||
#define PIKA_INSTRUCT_HOOK_PERIOD 50
|
||||
#endif
|
||||
|
||||
#ifndef PIKA_EXEC_ENABLE
|
||||
#define PIKA_EXEC_ENABLE 1
|
||||
#endif
|
||||
|
||||
/* configuration validation */
|
||||
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user