From 3ed0b12b420a689273e002a6decbd3d777d16b29 Mon Sep 17 00:00:00 2001 From: xushiwei Date: Tue, 6 Oct 2026 17:53:40 +0800 Subject: [PATCH] tool test: TestPython add more examples --- tool/_testc/python-3.14.8/include/pythread.h | 2 ++ tool/_testc/python-3.14.8/llcppg.cfg | 2 +- tool/_testc/python-3.14.8/pythread.go | 5 +++++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/tool/_testc/python-3.14.8/include/pythread.h b/tool/_testc/python-3.14.8/include/pythread.h index cc043e3d..558bb428 100644 --- a/tool/_testc/python-3.14.8/include/pythread.h +++ b/tool/_testc/python-3.14.8/include/pythread.h @@ -24,6 +24,8 @@ PyAPI_FUNC(int) Py_IsTrue(PyObject *x); PyAPI_FUNC(int) PyObject_IsTrue(PyObject *x); +PyAPI_FUNC(PyObject *) PyList_GetItem(PyObject *x, PyObject *index); + #ifndef Py_LIMITED_API # define Py_CPYTHON_PYTHREAD_H # include "cpython/pythread.h" diff --git a/tool/_testc/python-3.14.8/llcppg.cfg b/tool/_testc/python-3.14.8/llcppg.cfg index d73d1be3..38d9026f 100644 --- a/tool/_testc/python-3.14.8/llcppg.cfg +++ b/tool/_testc/python-3.14.8/llcppg.cfg @@ -9,7 +9,7 @@ "NonClass": [], "TypePrefix": ["Py_", "Py"], "MethodCheck": ["Py*_: $1"], - "FuncPrefix": ["Py_"], + "FuncPrefix": ["Py_", "Py"], "MacroPrefix": ["PY_", "Py_"], "EnumPrefix": ["PY_"], "VarPrefix": ["PY_"], diff --git a/tool/_testc/python-3.14.8/pythread.go b/tool/_testc/python-3.14.8/pythread.go index 6044669c..0f0e6ce0 100644 --- a/tool/_testc/python-3.14.8/pythread.go +++ b/tool/_testc/python-3.14.8/pythread.go @@ -41,6 +41,11 @@ func (self *Object) IsTrue() c.Int { return 0 } +// llgo:link (*Object).Item C.PyList_GetItem +func (self *Object) Item(index *Object) *Object { + return self +} + // PY_TIMEOUT_MAX is the highest usable value (in microseconds) of PY_TIMEOUT_T // type, and depends on the system threading API. //