diff --git a/port/linux/.vscode/launch.json b/port/linux/.vscode/launch.json index aead8a09b..56ddd162d 100644 --- a/port/linux/.vscode/launch.json +++ b/port/linux/.vscode/launch.json @@ -24,7 +24,7 @@ // "--gtest_filter=vm.test_cmodule_import_as" // "--gtest_filter=vm.subsrc_import" // "--gtest_filter=event.event_thread" - "--gtest_filter=*mqtt*" + // "--gtest_filter=module.while_loop" ], "stopAtEntry": false, "cwd": "${workspaceFolder}", diff --git a/port/linux/test/module-test.cpp b/port/linux/test/module-test.cpp index 8756160c5..478f1ec4a 100644 --- a/port/linux/test/module-test.cpp +++ b/port/linux/test/module-test.cpp @@ -30,10 +30,11 @@ TEST(module, while_loop) { /* run */ obj_run(pikaMain, "import test_module1\n" - "test_module1.while_loop()\n"); + "test_module1.while_loop()\n" + "test_module1"); /* collect */ /* assert */ - EXPECT_STREQ("4\r\n", log_buff[0]); + EXPECT_STREQ("4\r\n", log_buff[1]); /* deinit */ obj_deinit(pikaMain); EXPECT_EQ(pikaMemNow(), 0); diff --git a/port/linux/test/python/test_module1.py b/port/linux/test/python/test_module1.py index fa8079ff7..41aeeb572 100644 --- a/port/linux/test/python/test_module1.py +++ b/port/linux/test/python/test_module1.py @@ -1,2 +1,7 @@ def mytest(): - print('test_module_1_hello') \ No newline at end of file + print('test_module_1_hello') + + +class AO: + def __init__(self): + print('test_module_1_AO') diff --git a/src/PikaObj.c b/src/PikaObj.c index baaef93f5..f3f3ab939 100644 --- a/src/PikaObj.c +++ b/src/PikaObj.c @@ -559,14 +559,23 @@ PikaObj* _pika_dict_new(int num_args, ...) { } NativeProperty* obj_getProp(PikaObj* self) { - NativeProperty* prop = obj_getPtr(self, "@p"); + Arg* aProp = obj_getArg(self, "@p"); PikaObj* class_obj = NULL; - if (NULL == prop) { + if (NULL == aProp) { if (NULL != self->constructor) { class_obj = obj_getClassObj(self); - prop = obj_getPtr(class_obj, "@p"); + aProp = obj_getArg(class_obj, "@p"); } } + NativeProperty* prop = NULL; + if (aProp == NULL) { + goto __exit; + } + if (arg_getType(aProp) != ARG_TYPE_POINTER) { + goto __exit; + } + prop = (NativeProperty*)arg_getPtr(aProp); +__exit: if (NULL != class_obj) { obj_deinit_no_del(class_obj); } diff --git a/src/PikaVersion.h b/src/PikaVersion.h index 3ef2c67ec..8720d3acd 100644 --- a/src/PikaVersion.h +++ b/src/PikaVersion.h @@ -2,4 +2,4 @@ #define PIKA_VERSION_MINOR 13 #define PIKA_VERSION_MICRO 3 -#define PIKA_EDIT_TIME "2024/05/05 02:39:07" +#define PIKA_EDIT_TIME "2024/05/06 00:34:23" diff --git a/src/dataArgs.c b/src/dataArgs.c index 1c53c4555..353832418 100644 --- a/src/dataArgs.c +++ b/src/dataArgs.c @@ -58,7 +58,6 @@ void* args_getPtr(Args* self, char* name) { if (NULL == arg) { return NULL; } - pointer = arg_getPtr(arg); return pointer; }