Skip to content

Commit

Permalink
fix other issue for isinstance
Browse files Browse the repository at this point in the history
  • Loading branch information
pikasTech committed Aug 3, 2024
1 parent 2bd5059 commit bd42056
Show file tree
Hide file tree
Showing 9 changed files with 41 additions and 6 deletions.
14 changes: 14 additions & 0 deletions examples/_thread/thread_issue1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import time
import _thread


def task2():
while True:
print("123")
time.sleep_ms(2001)


_thread.start_new_thread(task2, ())

while True:
time.sleep_ms(2000)
1 change: 0 additions & 1 deletion package/_thread/_thread.c
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,6 @@ void _thread_start_new_thread(PikaObj* self, Arg* function, Arg* args_) {
obj_setSysOut(self, "thread create failed");
return;
}
pika_platform_thread_startup(info->thread);
#if !PIKA_THREAD_MALLOC_STACK_ENABLE
g_PikaMemInfo.heapUsed += info->stack_size;
#endif
Expand Down
4 changes: 3 additions & 1 deletion port/linux/.vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@
// "--gtest_filter=jrpc.cmd"
// "--gtest_filter=jrpc.exec_get_val"
// "--gtest_filter=jrpc.exec_get_val"
"--gtest_filter=builtin.issue_isinstance"
// "--gtest_filter=thread.issue1"
// "--gtest_filter=except.isinstance"
"--gtest_filter=builtin.isinstance"
],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
Expand Down
3 changes: 3 additions & 0 deletions port/linux/test/py-test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,9 @@ TEST_RUN_SINGLE_FILE_EXCEPT_OUTPUT(socket,
"test/python/socket/socket_download.py",
"PASS\r\n")

TEST_RUN_SINGLE_FILE_PASS(builtin,
issue_isinstance,
"test/python/builtins/issue_isinstance.py");
#endif

TEST_END
14 changes: 14 additions & 0 deletions port/linux/test/python/_thread/thread_issue1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import time
import _thread


def task2():
while True:
print("123")
time.sleep_ms(2001)


_thread.start_new_thread(task2, ())

while True:
time.sleep_ms(2000)
2 changes: 1 addition & 1 deletion src/PikaObj.c
Original file line number Diff line number Diff line change
Expand Up @@ -4010,7 +4010,7 @@ pika_bool _isinstance(Arg* aObj, Arg* classinfo) {
goto __exit;
}
Arg* aObjSuper = methodArg_super(aObjType, &objProp);
if (NULL == aObjSuper) {
if ((NULL == aObjSuper) && (NULL == objProp)) {
res = pika_false;
goto __exit;
}
Expand Down
6 changes: 4 additions & 2 deletions src/PikaPlatform.c
Original file line number Diff line number Diff line change
Expand Up @@ -612,8 +612,10 @@ PIKA_WEAK void pika_platform_thread_yield(void) {
pika_thread_idle_hook();
#if PIKA_FREERTOS_ENABLE
vTaskDelay(1);
#elif defined(__linux) || defined(_WIN32)
return;
#elif defined(_WIN32)
SwitchToThread();
#elif defined(__linux)
sched_yield();
#elif PIKA_RTTHREAD_ENABLE
rt_thread_yield();
#elif PIKA_ZEUSOS_ENABLE
Expand Down
1 change: 1 addition & 0 deletions src/PikaPlatform.h
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,7 @@ uint8_t pika_is_locked_pikaMemory(void);
/* Thread Platform */
#ifdef __linux
#include <pthread.h>
#include <sched.h>
typedef struct pika_platform_thread {
pthread_t thread;
pthread_mutex_t mutex;
Expand Down
2 changes: 1 addition & 1 deletion src/PikaVersion.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
#define PIKA_VERSION_MINOR 13
#define PIKA_VERSION_MICRO 3

#define PIKA_EDIT_TIME "2024/08/02 18:06:51"
#define PIKA_EDIT_TIME "2024/08/03 17:05:07"

0 comments on commit bd42056

Please sign in to comment.