snapshot before regression test
This commit is contained in:
777
Test/CPythonTest/App/cpython.py
Normal file
777
Test/CPythonTest/App/cpython.py
Normal file
@@ -0,0 +1,777 @@
|
||||
import t, c
|
||||
|
||||
|
||||
# ============================================================
|
||||
# PyObject — 所有 Python 对象的基类
|
||||
# ============================================================
|
||||
class PyObject:
|
||||
ob_refcnt: t.CLong
|
||||
ob_type: t.CPtr
|
||||
|
||||
|
||||
# ============================================================
|
||||
# 引用计数
|
||||
# ============================================================
|
||||
def Py_INCREF(op: PyObject | t.CPtr) -> t.CVoid | t.State: pass
|
||||
def Py_DECREF(op: PyObject | t.CPtr) -> t.CVoid | t.State: pass
|
||||
def Py_XINCREF(op: PyObject | t.CPtr) -> t.CVoid | t.State: pass
|
||||
def Py_XDECREF(op: PyObject | t.CPtr) -> t.CVoid | t.State: pass
|
||||
def Py_DecRef(op: PyObject | t.CPtr) -> t.CVoid | t.State: pass
|
||||
|
||||
|
||||
# ============================================================
|
||||
# 解释器初始化/终止
|
||||
# ============================================================
|
||||
def Py_Initialize() -> t.CVoid | t.State: pass
|
||||
def Py_Finalize() -> t.CVoid | t.State: pass
|
||||
def Py_InitializeEx(initsigs: t.CInt) -> t.CVoid | t.State: pass
|
||||
def Py_FinalizeEx() -> t.CInt | t.State: pass
|
||||
def Py_IsInitialized() -> t.CInt | t.State: pass
|
||||
|
||||
|
||||
# ============================================================
|
||||
# PyConfig
|
||||
# ============================================================
|
||||
class PySTATUS:
|
||||
func: t.CConst | str
|
||||
err_msg: t.CConst | str
|
||||
exitcode: t.CInt
|
||||
|
||||
class PyPreConfig:
|
||||
_config_version: t.CInt
|
||||
_config_init: t.CInt
|
||||
parse_argv: t.CInt
|
||||
isolated: t.CInt
|
||||
use_environment: t.CInt
|
||||
utf8_mode: t.CInt
|
||||
coerce_c_locale: t.CInt
|
||||
C_locale_warnings: t.CInt
|
||||
allocator: t.CInt
|
||||
dev_mode: t.CInt
|
||||
|
||||
class PyWideStringList:
|
||||
length: t.CSizeT
|
||||
items: t.CPtr
|
||||
|
||||
class PyConfig:
|
||||
_config_version: t.CInt
|
||||
_config_init: t.CInt
|
||||
isolated: t.CInt
|
||||
use_environment: t.CInt
|
||||
dev_mode: t.CInt
|
||||
install_signal_handlers: t.CInt
|
||||
use_hash_seed: t.CInt
|
||||
hash_seed: t.CUnsignedLong
|
||||
faulthandler: t.CInt
|
||||
tracemalloc: t.CInt
|
||||
import_time: t.CInt
|
||||
show_ref_count: t.CInt
|
||||
dump_refs: t.CInt
|
||||
dump_refs_file: t.CConst | str
|
||||
malloc_stats: t.CInt
|
||||
filesystem_errors: t.CInt
|
||||
pycache_prefix: t.CConst | str
|
||||
parse_argv: t.CInt
|
||||
argv: PyWideStringList
|
||||
program_name: t.CConst | str
|
||||
xoptions: PyWideStringList
|
||||
warnoptions: PyWideStringList
|
||||
site_import: t.CInt
|
||||
bytes_warning: t.CInt
|
||||
warn_default_encoding: t.CInt
|
||||
inspect: t.CInt
|
||||
interactive: t.CInt
|
||||
optimization_level: t.CInt
|
||||
parser_debug: t.CInt
|
||||
verbose: t.CInt
|
||||
quiet: t.CInt
|
||||
home: t.CConst | str
|
||||
pythonpath_env: t.CConst | str
|
||||
module_search_paths: PyWideStringList
|
||||
module_search_paths_set: t.CInt
|
||||
executable: t.CConst | str
|
||||
base_executable: t.CConst | str
|
||||
prefix: t.CConst | str
|
||||
base_prefix: t.CConst | str
|
||||
exec_prefix: t.CConst | str
|
||||
base_exec_prefix: t.CConst | str
|
||||
platlibdir: t.CConst | str
|
||||
stdio_filename: t.CConst | str
|
||||
|
||||
def PyConfig_InitPythonConfig(config: PyConfig | t.CPtr) -> t.CVoid | t.State: pass
|
||||
def PyConfig_InitIsolatedConfig(config: PyConfig | t.CPtr) -> t.CVoid | t.State: pass
|
||||
def PyConfig_Clear(config: PyConfig | t.CPtr) -> t.CVoid | t.State: pass
|
||||
def PyConfig_Read(config: PyConfig | t.CPtr) -> PySTATUS | t.State: pass
|
||||
def Py_InitializeFromConfig(config: PyConfig | t.CPtr) -> PySTATUS | t.State: pass
|
||||
def Py_DecodeLocale(s: t.CConst | str) -> str | t.State: pass
|
||||
def PyStatus_Exception(status: PySTATUS) -> t.CInt | t.State: pass
|
||||
|
||||
|
||||
# ============================================================
|
||||
# 整数操作 (PyLong)
|
||||
# ============================================================
|
||||
def PyLong_FromLong(v: t.CLong) -> PyObject | t.CPtr | t.State: pass
|
||||
def PyLong_FromUnsignedLong(v: t.CUnsignedLong) -> PyObject | t.CPtr | t.State: pass
|
||||
def PyLong_FromLongLong(v: t.CLong) -> PyObject | t.CPtr | t.State: pass
|
||||
def PyLong_FromUnsignedLongLong(v: t.CUnsignedLong) -> PyObject | t.CPtr | t.State: pass
|
||||
def PyLong_FromSsize_t(v: t.CPtrDiffT) -> PyObject | t.CPtr | t.State: pass
|
||||
def PyLong_FromSize_t(v: t.CSizeT) -> PyObject | t.CPtr | t.State: pass
|
||||
def PyLong_FromDouble(v: t.CDouble) -> PyObject | t.CPtr | t.State: pass
|
||||
def PyLong_AsLong(obj: PyObject | t.CPtr) -> t.CLong | t.State: pass
|
||||
def PyLong_AsUnsignedLong(obj: PyObject | t.CPtr) -> t.CUnsignedLong | t.State: pass
|
||||
def PyLong_AsLongLong(obj: PyObject | t.CPtr) -> t.CLong | t.State: pass
|
||||
def PyLong_AsUnsignedLongLong(obj: PyObject | t.CPtr) -> t.CUnsignedLong | t.State: pass
|
||||
def PyLong_AsDouble(obj: PyObject | t.CPtr) -> t.CDouble | t.State: pass
|
||||
def PyLong_AsSsize_t(obj: PyObject | t.CPtr) -> t.CPtrDiffT | t.State: pass
|
||||
def PyLong_AsSize_t(obj: PyObject | t.CPtr) -> t.CSizeT | t.State: pass
|
||||
|
||||
|
||||
# ============================================================
|
||||
# 浮点数操作 (PyFloat)
|
||||
# ============================================================
|
||||
def PyFloat_FromDouble(v: t.CDouble) -> PyObject | t.CPtr | t.State: pass
|
||||
def PyFloat_AsDouble(obj: PyObject | t.CPtr) -> t.CDouble | t.State: pass
|
||||
def PyFloat_FromString(s: PyObject | t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
|
||||
|
||||
# ============================================================
|
||||
# 字符串操作 (PyUnicode / PyBytes)
|
||||
# ============================================================
|
||||
def PyUnicode_FromString(u: t.CConst | str) -> PyObject | t.CPtr | t.State: pass
|
||||
def PyUnicode_FromStringAndSize(u: t.CConst | str, size: t.CSizeT) -> PyObject | t.CPtr | t.State: pass
|
||||
def PyUnicode_FromFormat(fmt: t.CConst | str) -> PyObject | t.CPtr | t.State: pass
|
||||
def PyUnicode_AsUTF8(obj: PyObject | t.CPtr) -> str | t.State: pass
|
||||
def PyUnicode_AsUTF8AndSize(obj: PyObject | t.CPtr, size: t.CPtrDiffT | t.CPtr) -> str | t.State: pass
|
||||
def PyUnicode_AsWideChar(obj: PyObject | t.CPtr, wbuf: t.CPtr, bufsize: t.CSizeT) -> t.CSizeT | t.State: pass
|
||||
def PyUnicode_GetLength(obj: PyObject | t.CPtr) -> t.CPtrDiffT | t.State: pass
|
||||
def PyUnicode_ReadChar(obj: PyObject | t.CPtr, idx: t.CSizeT) -> t.CUInt32T | t.State: pass
|
||||
def PyUnicode_WriteChar(obj: PyObject | t.CPtr, idx: t.CSizeT, ch: t.CUInt32T) -> t.CInt | t.State: pass
|
||||
def PyUnicode_Compare(l: PyObject | t.CPtr, r: PyObject | t.CPtr) -> t.CInt | t.State: pass
|
||||
def PyUnicode_Concat(l: PyObject | t.CPtr, r: PyObject | t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
def PyUnicode_Contains(container: PyObject | t.CPtr, element: PyObject | t.CPtr) -> t.CInt | t.State: pass
|
||||
def PyUnicode_Format(fmt: PyObject | t.CPtr, args: PyObject | t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
def PyUnicode_InternInPlace(s: PyObject | t.CPtr | t.CPtr) -> t.CVoid | t.State: pass
|
||||
def PyUnicode_InternFromString(u: t.CConst | str) -> PyObject | t.CPtr | t.State: pass
|
||||
|
||||
def PyBytes_FromString(v: t.CConst | str) -> PyObject | t.CPtr | t.State: pass
|
||||
def PyBytes_FromStringAndSize(v: t.CConst | str, size: t.CSizeT) -> PyObject | t.CPtr | t.State: pass
|
||||
def PyBytes_AsString(obj: PyObject | t.CPtr) -> str | t.State: pass
|
||||
def PyBytes_Size(obj: PyObject | t.CPtr) -> t.CSizeT | t.State: pass
|
||||
def PyBytes_FromObject(o: PyObject | t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
def PyBytes_FromFormat(fmt: t.CConst | str) -> PyObject | t.CPtr | t.State: pass
|
||||
|
||||
|
||||
# ============================================================
|
||||
# 布尔 / None
|
||||
# ============================================================
|
||||
def PyBool_FromLong(v: t.CLong) -> PyObject | t.CPtr | t.State: pass
|
||||
|
||||
Py_True: PyObject | t.CPtr | t.State
|
||||
Py_False: PyObject | t.CPtr | t.State
|
||||
Py_None: PyObject | t.CPtr | t.State
|
||||
|
||||
|
||||
# ============================================================
|
||||
# 列表操作 (PyList)
|
||||
# ============================================================
|
||||
def PyList_New(len: t.CSizeT) -> PyObject | t.CPtr | t.State: pass
|
||||
def PyList_Size(lst: PyObject | t.CPtr) -> t.CSizeT | t.State: pass
|
||||
def PyList_GetItem(lst: PyObject | t.CPtr, idx: t.CSizeT) -> PyObject | t.CPtr | t.State: pass
|
||||
def PyList_SetItem(lst: PyObject | t.CPtr, idx: t.CSizeT, item: PyObject | t.CPtr) -> t.CInt | t.State: pass
|
||||
def PyList_Insert(lst: PyObject | t.CPtr, idx: t.CSizeT, item: PyObject | t.CPtr) -> t.CInt | t.State: pass
|
||||
def PyList_Append(lst: PyObject | t.CPtr, item: PyObject | t.CPtr) -> t.CInt | t.State: pass
|
||||
def PyList_GetSlice(lst: PyObject | t.CPtr, lo: t.CSizeT, hi: t.CSizeT) -> PyObject | t.CPtr | t.State: pass
|
||||
def PyList_SetSlice(lst: PyObject | t.CPtr, lo: t.CSizeT, hi: t.CSizeT, items: PyObject | t.CPtr) -> t.CInt | t.State: pass
|
||||
def PyList_Sort(lst: PyObject | t.CPtr) -> t.CInt | t.State: pass
|
||||
def PyList_Reverse(lst: PyObject | t.CPtr) -> t.CInt | t.State: pass
|
||||
def PyList_AsTuple(lst: PyObject | t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
|
||||
|
||||
# ============================================================
|
||||
# 元组操作 (PyTuple)
|
||||
# ============================================================
|
||||
def PyTuple_New(len: t.CSizeT) -> PyObject | t.CPtr | t.State: pass
|
||||
def PyTuple_Size(tup: PyObject | t.CPtr) -> t.CSizeT | t.State: pass
|
||||
def PyTuple_GetItem(tup: PyObject | t.CPtr, idx: t.CSizeT) -> PyObject | t.CPtr | t.State: pass
|
||||
def PyTuple_SetItem(tup: PyObject | t.CPtr, idx: t.CSizeT, item: PyObject | t.CPtr) -> t.CInt | t.State: pass
|
||||
def PyTuple_GetSlice(tup: PyObject | t.CPtr, lo: t.CSizeT, hi: t.CSizeT) -> PyObject | t.CPtr | t.State: pass
|
||||
def PyTuple_Pack(n: t.CSizeT) -> PyObject | t.CPtr | t.State: pass
|
||||
|
||||
|
||||
# ============================================================
|
||||
# 字典操作 (PyDict)
|
||||
# ============================================================
|
||||
def PyDict_New() -> PyObject | t.CPtr | t.State: pass
|
||||
def PyDict_GetItem(d: PyObject | t.CPtr, key: PyObject | t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
def PyDict_GetItemString(d: PyObject | t.CPtr, key: t.CConst | str) -> PyObject | t.CPtr | t.State: pass
|
||||
def PyDict_SetItem(d: PyObject | t.CPtr, key: PyObject | t.CPtr, val: PyObject | t.CPtr) -> t.CInt | t.State: pass
|
||||
def PyDict_SetItemString(d: PyObject | t.CPtr, key: t.CConst | str, val: PyObject | t.CPtr) -> t.CInt | t.State: pass
|
||||
def PyDict_DelItem(d: PyObject | t.CPtr, key: PyObject | t.CPtr) -> t.CInt | t.State: pass
|
||||
def PyDict_DelItemString(d: PyObject | t.CPtr, key: t.CConst | str) -> t.CInt | t.State: pass
|
||||
def PyDict_Size(d: PyObject | t.CPtr) -> t.CSizeT | t.State: pass
|
||||
def PyDict_Keys(d: PyObject | t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
def PyDict_Values(d: PyObject | t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
def PyDict_Items(d: PyObject | t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
def PyDict_Copy(d: PyObject | t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
def PyDict_Clear(d: PyObject | t.CPtr) -> t.CVoid | t.State: pass
|
||||
def PyDict_Contains(d: PyObject | t.CPtr, key: PyObject | t.CPtr) -> t.CInt | t.State: pass
|
||||
def PyDict_Next(d: PyObject | t.CPtr, pos: t.CPtrDiffT | t.CPtr, key: PyObject | t.CPtr | t.CPtr, val: PyObject | t.CPtr | t.CPtr) -> t.CInt | t.State: pass
|
||||
def PyDict_Merge(d: PyObject | t.CPtr, other: PyObject | t.CPtr, override: t.CInt) -> t.CInt | t.State: pass
|
||||
def PyDict_Update(d: PyObject | t.CPtr, other: PyObject | t.CPtr) -> t.CInt | t.State: pass
|
||||
|
||||
|
||||
# ============================================================
|
||||
# 对象通用操作
|
||||
# ============================================================
|
||||
def PyObject_Str(obj: PyObject | t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
def PyObject_Repr(obj: PyObject | t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
def PyObject_Type(obj: PyObject | t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
def PyObject_IsInstance(obj: PyObject | t.CPtr, cls: PyObject | t.CPtr) -> t.CInt | t.State: pass
|
||||
def PyObject_IsSubclass(obj: PyObject | t.CPtr, cls: PyObject | t.CPtr) -> t.CInt | t.State: pass
|
||||
def PyObject_HasAttr(obj: PyObject | t.CPtr, name: PyObject | t.CPtr) -> t.CInt | t.State: pass
|
||||
def PyObject_HasAttrString(obj: PyObject | t.CPtr, name: t.CConst | str) -> t.CInt | t.State: pass
|
||||
def PyObject_GetAttr(obj: PyObject | t.CPtr, name: PyObject | t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
def PyObject_GetAttrString(obj: PyObject | t.CPtr, name: t.CConst | str) -> PyObject | t.CPtr | t.State: pass
|
||||
def PyObject_SetAttr(obj: PyObject | t.CPtr, name: PyObject | t.CPtr, val: PyObject | t.CPtr) -> t.CInt | t.State: pass
|
||||
def PyObject_SetAttrString(obj: PyObject | t.CPtr, name: t.CConst | str, val: PyObject | t.CPtr) -> t.CInt | t.State: pass
|
||||
def PyObject_DelAttr(obj: PyObject | t.CPtr, name: PyObject | t.CPtr) -> t.CInt | t.State: pass
|
||||
def PyObject_DelAttrString(obj: PyObject | t.CPtr, name: t.CConst | str) -> t.CInt | t.State: pass
|
||||
def PyObject_Call(callable: PyObject | t.CPtr, args: PyObject | t.CPtr, kwargs: PyObject | t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
def PyObject_CallObject(callable: PyObject | t.CPtr, args: PyObject | t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
def PyObject_CallNoArgs(callable: PyObject | t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
def PyObject_CallOneArg(callable: PyObject | t.CPtr, arg: PyObject | t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
def PyObject_IsTrue(obj: PyObject | t.CPtr) -> t.CInt | t.State: pass
|
||||
def PyObject_Not(obj: PyObject | t.CPtr) -> t.CInt | t.State: pass
|
||||
def PyObject_RichCompare(o1: PyObject | t.CPtr, o2: PyObject | t.CPtr, opid: t.CInt) -> PyObject | t.CPtr | t.State: pass
|
||||
def PyObject_RichCompareBool(o1: PyObject | t.CPtr, o2: PyObject | t.CPtr, opid: t.CInt) -> t.CInt | t.State: pass
|
||||
def PyObject_Hash(obj: PyObject | t.CPtr) -> t.CLong | t.State: pass
|
||||
def PyObject_Length(obj: PyObject | t.CPtr) -> t.CSizeT | t.State: pass
|
||||
def PyObject_GetItem(obj: PyObject | t.CPtr, key: PyObject | t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
def PyObject_SetItem(obj: PyObject | t.CPtr, key: PyObject | t.CPtr, val: PyObject | t.CPtr) -> t.CInt | t.State: pass
|
||||
def PyObject_DelItem(obj: PyObject | t.CPtr, key: PyObject | t.CPtr) -> t.CInt | t.State: pass
|
||||
def PyObject_Dir(obj: PyObject | t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
def PyObject_GetIter(obj: PyObject | t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
def PyIter_Next(obj: PyObject | t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
|
||||
|
||||
# ============================================================
|
||||
# 比较常量
|
||||
# ============================================================
|
||||
Py_LT: t.CInt | t.State
|
||||
Py_LE: t.CInt | t.State
|
||||
Py_EQ: t.CInt | t.State
|
||||
Py_NE: t.CInt | t.State
|
||||
Py_GT: t.CInt | t.State
|
||||
Py_GE: t.CInt | t.State
|
||||
|
||||
|
||||
# ============================================================
|
||||
# 模块操作
|
||||
# ============================================================
|
||||
def PyImport_ImportModule(name: t.CConst | str) -> PyObject | t.CPtr | t.State: pass
|
||||
def PyImport_Import(name: PyObject | t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
def PyImport_ImportModuleLevelObject(name: PyObject | t.CPtr, globs: PyObject | t.CPtr, locs: PyObject | t.CPtr, fromlist: PyObject | t.CPtr, level: t.CInt) -> PyObject | t.CPtr | t.State: pass
|
||||
def PyImport_ReloadModule(mod: PyObject | t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
def PyImport_AddModule(name: t.CConst | str) -> PyObject | t.CPtr | t.State: pass
|
||||
def PyImport_GetModuleDict() -> PyObject | t.CPtr | t.State: pass
|
||||
def PyImport_ImportModuleEx(name: t.CConst | str, globs: PyObject | t.CPtr, locs: PyObject | t.CPtr, fromlist: PyObject | t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
|
||||
|
||||
# ============================================================
|
||||
# 模块创建
|
||||
# ============================================================
|
||||
class PyMethodDef:
|
||||
ml_name: t.CConst | str
|
||||
ml_meth: t.CPtr
|
||||
ml_flags: t.CInt
|
||||
ml_doc: t.CConst | str
|
||||
|
||||
class PyModuleDef_Base:
|
||||
ob_base: PyObject
|
||||
m_init: t.CPtr
|
||||
m_index: t.CSizeT
|
||||
m_copy: PyObject | t.CPtr
|
||||
|
||||
class PyModuleDef:
|
||||
m_base: PyModuleDef_Base
|
||||
m_name: t.CConst | str
|
||||
m_doc: t.CConst | str
|
||||
m_size: t.CPtrDiffT
|
||||
m_methods: PyMethodDef | t.CPtr
|
||||
m_slots: t.CPtr
|
||||
m_traverse: t.CPtr
|
||||
m_clear: t.CPtr
|
||||
m_free: t.CPtr
|
||||
|
||||
def PyModule_Create(mod: PyModuleDef | t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
def PyModule_Create2(mod: PyModuleDef | t.CPtr, ver: t.CInt) -> PyObject | t.CPtr | t.State: pass
|
||||
def PyModule_GetName(mod: PyObject | t.CPtr) -> str | t.State: pass
|
||||
def PyModule_GetDict(mod: PyObject | t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
def PyModule_GetFilenameObject(mod: PyObject | t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
def PyModule_AddObject(mod: PyObject | t.CPtr, name: t.CConst | str, val: PyObject | t.CPtr) -> t.CInt | t.State: pass
|
||||
def PyModule_AddObjectRef(mod: PyObject | t.CPtr, name: t.CConst | str, val: PyObject | t.CPtr) -> t.CInt | t.State: pass
|
||||
def PyModule_AddIntConstant(mod: PyObject | t.CPtr, name: t.CConst | str, val: t.CLong) -> t.CInt | t.State: pass
|
||||
def PyModule_AddStringConstant(mod: PyObject | t.CPtr, name: t.CConst | str, val: t.CConst | str) -> t.CInt | t.State: pass
|
||||
|
||||
|
||||
# ============================================================
|
||||
# GIL 管理
|
||||
# ============================================================
|
||||
def PyGILState_Ensure() -> t.CInt | t.State: pass
|
||||
def PyGILState_Release(state: t.CInt) -> t.CVoid | t.State: pass
|
||||
def PyEval_SaveThread() -> t.CPtr | t.State: pass
|
||||
def PyEval_RestoreThread(tstate: t.CPtr) -> t.CVoid | t.State: pass
|
||||
def PyEval_AcquireThread(tstate: t.CPtr) -> t.CVoid | t.State: pass
|
||||
def PyEval_ReleaseThread(tstate: t.CPtr) -> t.CVoid | t.State: pass
|
||||
def PyEval_AcquireLock() -> t.CVoid | t.State: pass
|
||||
def PyEval_ReleaseLock() -> t.CVoid | t.State: pass
|
||||
def PyEval_ThreadsInitialized() -> t.CInt | t.State: pass
|
||||
def PyEval_InitThreads() -> t.CVoid | t.State: pass
|
||||
|
||||
|
||||
# ============================================================
|
||||
# 错误处理
|
||||
# ============================================================
|
||||
def PyErr_Occurred() -> PyObject | t.CPtr | t.State: pass
|
||||
def PyErr_Clear() -> t.CVoid | t.State: pass
|
||||
def PyErr_Fetch(tp: PyObject | t.CPtr | t.CPtr, val: PyObject | t.CPtr | t.CPtr, tb: PyObject | t.CPtr | t.CPtr) -> t.CVoid | t.State: pass
|
||||
def PyErr_Restore(tp: PyObject | t.CPtr, val: PyObject | t.CPtr, tb: PyObject | t.CPtr) -> t.CVoid | t.State: pass
|
||||
def PyErr_NormalizeException(tp: PyObject | t.CPtr | t.CPtr, val: PyObject | t.CPtr | t.CPtr, tb: PyObject | t.CPtr | t.CPtr) -> t.CVoid | t.State: pass
|
||||
def PyErr_SetString(tp: PyObject | t.CPtr, msg: t.CConst | str) -> t.CVoid | t.State: pass
|
||||
def PyErr_SetObject(tp: PyObject | t.CPtr, val: PyObject | t.CPtr) -> t.CVoid | t.State: pass
|
||||
def PyErr_BadArgument() -> t.CPtr | t.State: pass
|
||||
def PyErr_NoMemory() -> t.CPtr | t.State: pass
|
||||
def PyErr_Print() -> t.CVoid | t.State: pass
|
||||
def PyErr_ExceptionMatches(exc: PyObject | t.CPtr) -> t.CInt | t.State: pass
|
||||
def PyErr_GivenExceptionMatches(given: PyObject | t.CPtr, exc: PyObject | t.CPtr) -> t.CInt | t.State: pass
|
||||
|
||||
|
||||
# ============================================================
|
||||
# 内置异常类型
|
||||
# ============================================================
|
||||
PyExc_BaseException: PyObject | t.CPtr | t.State
|
||||
PyExc_Exception: PyObject | t.CPtr | t.State
|
||||
PyExc_TypeError: PyObject | t.CPtr | t.State
|
||||
PyExc_ValueError: PyObject | t.CPtr | t.State
|
||||
PyExc_RuntimeError: PyObject | t.CPtr | t.State
|
||||
PyExc_KeyError: PyObject | t.CPtr | t.State
|
||||
PyExc_IndexError: PyObject | t.CPtr | t.State
|
||||
PyExc_AttributeError: PyObject | t.CPtr | t.State
|
||||
PyExc_ImportError: PyObject | t.CPtr | t.State
|
||||
PyExc_OSError: PyObject | t.CPtr | t.State
|
||||
PyExc_IOError: PyObject | t.CPtr | t.State
|
||||
PyExc_ZeroDivisionError: PyObject | t.CPtr | t.State
|
||||
PyExc_OverflowError: PyObject | t.CPtr | t.State
|
||||
PyExc_MemoryError: PyObject | t.CPtr | t.State
|
||||
PyExc_NameError: PyObject | t.CPtr | t.State
|
||||
PyExc_StopIteration: PyObject | t.CPtr | t.State
|
||||
PyExc_NotImplementedError: PyObject | t.CPtr | t.State
|
||||
PyExc_SyntaxError: PyObject | t.CPtr | t.State
|
||||
PyExc_FileNotFoundError: PyObject | t.CPtr | t.State
|
||||
PyExc_PermissionError: PyObject | t.CPtr | t.State
|
||||
PyExc_IsADirectoryError: PyObject | t.CPtr | t.State
|
||||
PyExc_NotADirectoryError: PyObject | t.CPtr | t.State
|
||||
|
||||
|
||||
# ============================================================
|
||||
# 内置函数
|
||||
# ============================================================
|
||||
def Py_BuildValue(fmt: t.CConst | str) -> PyObject | t.CPtr | t.State: pass
|
||||
def Py_VaBuildValue(fmt: t.CConst | str, va: t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
|
||||
|
||||
# ============================================================
|
||||
# 类型检查
|
||||
# ============================================================
|
||||
def PyLong_Check(obj: PyObject | t.CPtr) -> t.CInt | t.State: pass
|
||||
def PyFloat_Check(obj: PyObject | t.CPtr) -> t.CInt | t.State: pass
|
||||
def PyUnicode_Check(obj: PyObject | t.CPtr) -> t.CInt | t.State: pass
|
||||
def PyBytes_Check(obj: PyObject | t.CPtr) -> t.CInt | t.State: pass
|
||||
def PyList_Check(obj: PyObject | t.CPtr) -> t.CInt | t.State: pass
|
||||
def PyTuple_Check(obj: PyObject | t.CPtr) -> t.CInt | t.State: pass
|
||||
def PyDict_Check(obj: PyObject | t.CPtr) -> t.CInt | t.State: pass
|
||||
def PyBool_Check(obj: PyObject | t.CPtr) -> t.CInt | t.State: pass
|
||||
def PyNone_Check(obj: PyObject | t.CPtr) -> t.CInt | t.State: pass
|
||||
|
||||
|
||||
# ============================================================
|
||||
# 内存管理
|
||||
# ============================================================
|
||||
def PyMem_Malloc(size: t.CSizeT) -> t.CPtr | t.State: pass
|
||||
def PyMem_Realloc(ptr: t.CPtr, size: t.CSizeT) -> t.CPtr | t.State: pass
|
||||
def PyMem_Free(ptr: t.CPtr) -> t.CVoid | t.State: pass
|
||||
def PyMem_Calloc(nelem: t.CSizeT, elsize: t.CSizeT) -> t.CPtr | t.State: pass
|
||||
def PyObject_Malloc(size: t.CSizeT) -> t.CPtr | t.State: pass
|
||||
def PyObject_Realloc(ptr: t.CPtr, size: t.CSizeT) -> t.CPtr | t.State: pass
|
||||
def PyObject_Free(ptr: t.CPtr) -> t.CVoid | t.State: pass
|
||||
def PyObject_Calloc(nelem: t.CSizeT, elsize: t.CSizeT) -> t.CPtr | t.State: pass
|
||||
def PyObject_Init(obj: PyObject | t.CPtr, tp: t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
def PyObject_InitVar(obj: PyObject | t.CPtr, tp: t.CPtr, size: t.CSizeT) -> PyObject | t.CPtr | t.State: pass
|
||||
|
||||
|
||||
# ============================================================
|
||||
# 文件操作
|
||||
# ============================================================
|
||||
def PyFile_FromString(filename: t.CConst | str, mode: t.CConst | str) -> PyObject | t.CPtr | t.State: pass
|
||||
def PyFile_AsFile(file: PyObject | t.CPtr) -> t.CPtr | t.State: pass
|
||||
def PyFile_WriteObject(obj: PyObject | t.CPtr, file: PyObject | t.CPtr, flags: t.CInt) -> t.CInt | t.State: pass
|
||||
def PyFile_WriteString(s: t.CConst | str, file: PyObject | t.CPtr) -> t.CInt | t.State: pass
|
||||
|
||||
|
||||
# ============================================================
|
||||
# 编译/执行
|
||||
# ============================================================
|
||||
def Py_CompileString(s: t.CConst | str, filename: t.CConst | str, start: t.CInt) -> PyObject | t.CPtr | t.State: pass
|
||||
def PyEval_EvalCode(code: PyObject | t.CPtr, globs: PyObject | t.CPtr, locs: PyObject | t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
def PyEval_EvalCodeEx(code: PyObject | t.CPtr, globs: PyObject | t.CPtr, locs: PyObject | t.CPtr, args: PyObject | t.CPtr | t.CPtr, argc: t.CInt, kws: PyObject | t.CPtr | t.CPtr, kwc: t.CInt, defs: PyObject | t.CPtr | t.CPtr, defc: t.CInt, kwdefs: PyObject | t.CPtr, closure: PyObject | t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
def PyEval_EvalFrame(frame: t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
def PyEval_CallObject(callable: PyObject | t.CPtr, args: PyObject | t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
def PyEval_CallFunction(callable: PyObject | t.CPtr, fmt: t.CConst | str) -> PyObject | t.CPtr | t.State: pass
|
||||
def PyEval_CallMethod(obj: PyObject | t.CPtr, method: t.CConst | str, fmt: t.CConst | str) -> PyObject | t.CPtr | t.State: pass
|
||||
|
||||
|
||||
# ============================================================
|
||||
# PyRun
|
||||
# ============================================================
|
||||
def PyRun_SimpleString(cmd: t.CConst | str) -> t.CInt | t.State: pass
|
||||
def PyRun_SimpleFile(fp: t.CPtr, filename: t.CConst | str) -> t.CInt | t.State: pass
|
||||
def PyRun_AnyFile(fp: t.CPtr, filename: t.CConst | str) -> t.CInt | t.State: pass
|
||||
def PyRun_String(s: t.CConst | str, start: t.CInt, globs: PyObject | t.CPtr, locs: PyObject | t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
def PyRun_File(fp: t.CPtr, filename: t.CConst | str, start: t.CInt, globs: PyObject | t.CPtr, locs: PyObject | t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
|
||||
Py_single_input: t.CInt | t.State
|
||||
Py_file_input: t.CInt | t.State
|
||||
Py_eval_input: t.CInt | t.State
|
||||
|
||||
|
||||
# ============================================================
|
||||
# Capsule
|
||||
# ============================================================
|
||||
def PyCapsule_New(ptr: t.CPtr, name: t.CConst | str, dtor: t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
def PyCapsule_GetPointer(cap: PyObject | t.CPtr, name: t.CConst | str) -> t.CPtr | t.State: pass
|
||||
def PyCapsule_GetName(cap: PyObject | t.CPtr) -> str | t.State: pass
|
||||
def PyCapsule_IsValid(cap: PyObject | t.CPtr, name: t.CConst | str) -> t.CInt | t.State: pass
|
||||
def PyCapsule_SetPointer(cap: PyObject | t.CPtr, ptr: t.CPtr) -> t.CInt | t.State: pass
|
||||
def PyCapsule_SetName(cap: PyObject | t.CPtr, name: t.CConst | str) -> t.CInt | t.State: pass
|
||||
def PyCapsule_SetDestructor(cap: PyObject | t.CPtr, dtor: t.CPtr) -> t.CInt | t.State: pass
|
||||
|
||||
|
||||
# ============================================================
|
||||
# 序列操作
|
||||
# ============================================================
|
||||
def PySequence_Check(obj: PyObject | t.CPtr) -> t.CInt | t.State: pass
|
||||
def PySequence_Size(obj: PyObject | t.CPtr) -> t.CSizeT | t.State: pass
|
||||
def PySequence_Length(obj: PyObject | t.CPtr) -> t.CSizeT | t.State: pass
|
||||
def PySequence_Concat(o1: PyObject | t.CPtr, o2: PyObject | t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
def PySequence_Repeat(obj: PyObject | t.CPtr, count: t.CSizeT) -> PyObject | t.CPtr | t.State: pass
|
||||
def PySequence_GetItem(obj: PyObject | t.CPtr, idx: t.CSizeT) -> PyObject | t.CPtr | t.State: pass
|
||||
def PySequence_SetItem(obj: PyObject | t.CPtr, idx: t.CSizeT, val: PyObject | t.CPtr) -> t.CInt | t.State: pass
|
||||
def PySequence_DelItem(obj: PyObject | t.CPtr, idx: t.CSizeT) -> t.CInt | t.State: pass
|
||||
def PySequence_GetSlice(obj: PyObject | t.CPtr, start: t.CSizeT, end: t.CSizeT) -> PyObject | t.CPtr | t.State: pass
|
||||
def PySequence_SetSlice(obj: PyObject | t.CPtr, start: t.CSizeT, end: t.CSizeT, val: PyObject | t.CPtr) -> t.CInt | t.State: pass
|
||||
def PySequence_DelSlice(obj: PyObject | t.CPtr, start: t.CSizeT, end: t.CSizeT) -> t.CInt | t.State: pass
|
||||
def PySequence_Contains(obj: PyObject | t.CPtr, val: PyObject | t.CPtr) -> t.CInt | t.State: pass
|
||||
def PySequence_Index(obj: PyObject | t.CPtr, val: PyObject | t.CPtr) -> t.CSizeT | t.State: pass
|
||||
def PySequence_Count(obj: PyObject | t.CPtr, val: PyObject | t.CPtr) -> t.CSizeT | t.State: pass
|
||||
def PySequence_List(obj: PyObject | t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
def PySequence_Tuple(obj: PyObject | t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
|
||||
|
||||
# ============================================================
|
||||
# 映射操作
|
||||
# ============================================================
|
||||
def PyMapping_Check(obj: PyObject | t.CPtr) -> t.CInt | t.State: pass
|
||||
def PyMapping_Size(obj: PyObject | t.CPtr) -> t.CSizeT | t.State: pass
|
||||
def PyMapping_Length(obj: PyObject | t.CPtr) -> t.CSizeT | t.State: pass
|
||||
def PyMapping_HasKey(obj: PyObject | t.CPtr, key: PyObject | t.CPtr) -> t.CInt | t.State: pass
|
||||
def PyMapping_HasKeyString(obj: PyObject | t.CPtr, key: t.CConst | str) -> t.CInt | t.State: pass
|
||||
def PyMapping_GetItemString(obj: PyObject | t.CPtr, key: t.CConst | str) -> PyObject | t.CPtr | t.State: pass
|
||||
def PyMapping_SetItemString(obj: PyObject | t.CPtr, key: t.CConst | str, val: PyObject | t.CPtr) -> t.CInt | t.State: pass
|
||||
def PyMapping_Keys(obj: PyObject | t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
def PyMapping_Values(obj: PyObject | t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
def PyMapping_Items(obj: PyObject | t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
|
||||
|
||||
# ============================================================
|
||||
# 数字操作
|
||||
# ============================================================
|
||||
def PyNumber_Add(o1: PyObject | t.CPtr, o2: PyObject | t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
def PyNumber_Subtract(o1: PyObject | t.CPtr, o2: PyObject | t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
def PyNumber_Multiply(o1: PyObject | t.CPtr, o2: PyObject | t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
def PyNumber_MatrixMultiply(o1: PyObject | t.CPtr, o2: PyObject | t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
def PyNumber_FloorDivide(o1: PyObject | t.CPtr, o2: PyObject | t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
def PyNumber_TrueDivide(o1: PyObject | t.CPtr, o2: PyObject | t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
def PyNumber_Modulo(o1: PyObject | t.CPtr, o2: PyObject | t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
def PyNumber_Power(o1: PyObject | t.CPtr, o2: PyObject | t.CPtr, o3: PyObject | t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
def PyNumber_Negative(obj: PyObject | t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
def PyNumber_Positive(obj: PyObject | t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
def PyNumber_Absolute(obj: PyObject | t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
def PyNumber_Invert(obj: PyObject | t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
def PyNumber_Lshift(o1: PyObject | t.CPtr, o2: PyObject | t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
def PyNumber_Rshift(o1: PyObject | t.CPtr, o2: PyObject | t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
def PyNumber_And(o1: PyObject | t.CPtr, o2: PyObject | t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
def PyNumber_Xor(o1: PyObject | t.CPtr, o2: PyObject | t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
def PyNumber_Or(o1: PyObject | t.CPtr, o2: PyObject | t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
def PyNumber_Index(obj: PyObject | t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
def PyNumber_Long(obj: PyObject | t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
def PyNumber_Float(obj: PyObject | t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
def PyNumber_Check(obj: PyObject | t.CPtr) -> t.CInt | t.State: pass
|
||||
|
||||
|
||||
# ============================================================
|
||||
# 弱引用
|
||||
# ============================================================
|
||||
def PyWeakref_NewRef(obj: PyObject | t.CPtr, cb: PyObject | t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
def PyWeakref_GetObject(ref: PyObject | t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
def PyWeakref_Check(obj: PyObject | t.CPtr) -> t.CInt | t.State: pass
|
||||
|
||||
|
||||
# ============================================================
|
||||
# 属性描述符
|
||||
# ============================================================
|
||||
class PyGetSetDef:
|
||||
name: t.CConst | str
|
||||
get: t.CPtr
|
||||
set: t.CPtr
|
||||
doc: t.CConst | str
|
||||
closure: t.CPtr
|
||||
|
||||
class PyMemberDef:
|
||||
name: t.CConst | str
|
||||
type: t.CInt
|
||||
offset: t.CPtrDiffT
|
||||
flags: t.CInt
|
||||
doc: t.CConst | str
|
||||
|
||||
|
||||
# ============================================================
|
||||
# sys 模块
|
||||
# ============================================================
|
||||
def PySys_GetObject(name: t.CConst | str) -> PyObject | t.CPtr | t.State: pass
|
||||
def PySys_SetObject(name: t.CConst | str, val: PyObject | t.CPtr) -> t.CInt | t.State: pass
|
||||
def PySys_ResetWarnOptions() -> t.CVoid | t.State: pass
|
||||
def PySys_AddWarnOption(s: PyObject | t.CPtr) -> t.CVoid | t.State: pass
|
||||
def PySYS_AddXOption(s: PyObject | t.CPtr) -> t.CVoid | t.State: pass
|
||||
def PySys_WriteStdout(fmt: t.CConst | str) -> t.CVoid | t.State: pass
|
||||
def PySys_WriteStderr(fmt: t.CConst | str) -> t.CVoid | t.State: pass
|
||||
def PySys_FormatStdout(fmt: t.CConst | str) -> t.CVoid | t.State: pass
|
||||
def PySys_FormatStderr(fmt: t.CConst | str) -> t.CVoid | t.State: pass
|
||||
|
||||
|
||||
# ============================================================
|
||||
# 内存视图
|
||||
# ============================================================
|
||||
def PyMemoryView_FromObject(obj: PyObject | t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
def PyMemoryView_GetContiguous(obj: PyObject | t.CPtr, btype: t.CInt, order: t.CChar) -> PyObject | t.CPtr | t.State: pass
|
||||
def PyMemoryView_Check(obj: PyObject | t.CPtr) -> t.CInt | t.State: pass
|
||||
|
||||
|
||||
# ============================================================
|
||||
# set / frozenset
|
||||
# ============================================================
|
||||
def PySet_New(iterable: PyObject | t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
def PySet_Add(s: PyObject | t.CPtr, key: PyObject | t.CPtr) -> t.CInt | t.State: pass
|
||||
def PySet_Discard(s: PyObject | t.CPtr, key: PyObject | t.CPtr) -> t.CInt | t.State: pass
|
||||
def PySet_Contains(s: PyObject | t.CPtr, key: PyObject | t.CPtr) -> t.CInt | t.State: pass
|
||||
def PySet_Size(s: PyObject | t.CPtr) -> t.CSizeT | t.State: pass
|
||||
def PySet_Clear(s: PyObject | t.CPtr) -> t.CVoid | t.State: pass
|
||||
def PySet_Check(obj: PyObject | t.CPtr) -> t.CInt | t.State: pass
|
||||
def PyFrozenSet_New(iterable: PyObject | t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
def PyFrozenSet_Check(obj: PyObject | t.CPtr) -> t.CInt | t.State: pass
|
||||
|
||||
|
||||
# ============================================================
|
||||
# slice
|
||||
# ============================================================
|
||||
def PySlice_New(start: PyObject | t.CPtr, stop: PyObject | t.CPtr, step: PyObject | t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
def PySlice_GetIndicesEx(sl: PyObject | t.CPtr, length: t.CSizeT, start: t.CSizeT | t.CPtr, stop: t.CSizeT | t.CPtr, step: t.CSizeT | t.CPtr, slicelen: t.CSizeT | t.CPtr) -> t.CInt | t.State: pass
|
||||
def PySlice_Unpack(sl: PyObject | t.CPtr, start: t.CPtrDiffT | t.CPtr, stop: t.CPtrDiffT | t.CPtr, step: t.CPtrDiffT | t.CPtr) -> t.CVoid | t.State: pass
|
||||
def PySlice_AdjustIndices(length: t.CSizeT, start: t.CPtrDiffT | t.CPtr, stop: t.CPtrDiffT | t.CPtr, step: t.CPtrDiffT) -> t.CSizeT | t.State: pass
|
||||
def PySlice_Check(obj: PyObject | t.CPtr) -> t.CInt | t.State: pass
|
||||
|
||||
|
||||
# ============================================================
|
||||
# 类型包装类 — 带运算符重载
|
||||
# ============================================================
|
||||
|
||||
# --- PyLongObj: Python 整数包装 ---
|
||||
class PyLongObj:
|
||||
ptr: PyObject | t.CPtr
|
||||
|
||||
def __new__(self) -> 'PyLongObj' | t.CPtr:
|
||||
return t.CPtr(malloc(PyLongObj.__sizeof__()))
|
||||
|
||||
@staticmethod
|
||||
def from_long(val: t.CLong) -> 'PyLongObj' | t.CPtr:
|
||||
obj: PyLongObj | t.CPtr = PyLongObj()
|
||||
obj.ptr = PyLong_FromLong(val)
|
||||
return obj
|
||||
|
||||
def __add__(self, other: PyLongObj | t.CPtr) -> 'PyLongObj' | t.CPtr:
|
||||
res: PyLongObj | t.CPtr = PyLongObj()
|
||||
res.ptr = PyNumber_Add(self.ptr, other.ptr)
|
||||
return res
|
||||
|
||||
def __sub__(self, other: PyLongObj | t.CPtr) -> 'PyLongObj' | t.CPtr:
|
||||
res: PyLongObj | t.CPtr = PyLongObj()
|
||||
res.ptr = PyNumber_Subtract(self.ptr, other.ptr)
|
||||
return res
|
||||
|
||||
def __mul__(self, other: PyLongObj | t.CPtr) -> 'PyLongObj' | t.CPtr:
|
||||
res: PyLongObj | t.CPtr = PyLongObj()
|
||||
res.ptr = PyNumber_Multiply(self.ptr, other.ptr)
|
||||
return res
|
||||
|
||||
def __neg__(self) -> 'PyLongObj' | t.CPtr:
|
||||
res: PyLongObj | t.CPtr = PyLongObj()
|
||||
res.ptr = PyNumber_Negative(self.ptr)
|
||||
return res
|
||||
|
||||
def to_long(self) -> t.CLong:
|
||||
return PyLong_AsLong(self.ptr)
|
||||
|
||||
def __str__(self) -> PyObject | t.CPtr:
|
||||
return PyObject_Str(self.ptr)
|
||||
|
||||
def dec_ref(self):
|
||||
Py_DecRef(self.ptr)
|
||||
|
||||
|
||||
# --- PyFloatObj: Python 浮点数包装 ---
|
||||
class PyFloatObj:
|
||||
ptr: PyObject | t.CPtr
|
||||
|
||||
def __new__(self) -> 'PyFloatObj' | t.CPtr:
|
||||
return t.CPtr(malloc(PyFloatObj.__sizeof__()))
|
||||
|
||||
@staticmethod
|
||||
def from_double(val: t.CDouble) -> 'PyFloatObj' | t.CPtr:
|
||||
obj: PyFloatObj | t.CPtr = PyFloatObj()
|
||||
obj.ptr = PyFloat_FromDouble(val)
|
||||
return obj
|
||||
|
||||
def __add__(self, other: PyFloatObj | t.CPtr) -> 'PyFloatObj' | t.CPtr:
|
||||
res: PyFloatObj | t.CPtr = PyFloatObj()
|
||||
res.ptr = PyNumber_Add(self.ptr, other.ptr)
|
||||
return res
|
||||
|
||||
def __sub__(self, other: PyFloatObj | t.CPtr) -> 'PyFloatObj' | t.CPtr:
|
||||
res: PyFloatObj | t.CPtr = PyFloatObj()
|
||||
res.ptr = PyNumber_Subtract(self.ptr, other.ptr)
|
||||
return res
|
||||
|
||||
def __mul__(self, other: PyFloatObj | t.CPtr) -> 'PyFloatObj' | t.CPtr:
|
||||
res: PyFloatObj | t.CPtr = PyFloatObj()
|
||||
res.ptr = PyNumber_Multiply(self.ptr, other.ptr)
|
||||
return res
|
||||
|
||||
def __truediv__(self, other: PyFloatObj | t.CPtr) -> 'PyFloatObj' | t.CPtr:
|
||||
res: PyFloatObj | t.CPtr = PyFloatObj()
|
||||
res.ptr = PyNumber_TrueDivide(self.ptr, other.ptr)
|
||||
return res
|
||||
|
||||
def __neg__(self) -> 'PyFloatObj' | t.CPtr:
|
||||
res: PyFloatObj | t.CPtr = PyFloatObj()
|
||||
res.ptr = PyNumber_Negative(self.ptr)
|
||||
return res
|
||||
|
||||
def to_double(self) -> t.CDouble:
|
||||
return PyFloat_AsDouble(self.ptr)
|
||||
|
||||
def __str__(self) -> PyObject | t.CPtr:
|
||||
return PyObject_Str(self.ptr)
|
||||
|
||||
def dec_ref(self):
|
||||
Py_DecRef(self.ptr)
|
||||
|
||||
|
||||
# --- PyUnicodeObj: Python 字符串包装 ---
|
||||
class PyUnicodeObj:
|
||||
ptr: PyObject | t.CPtr
|
||||
|
||||
def __new__(self) -> 'PyUnicodeObj' | t.CPtr:
|
||||
return t.CPtr(malloc(PyUnicodeObj.__sizeof__()))
|
||||
|
||||
@staticmethod
|
||||
def from_string(s: t.CChar | t.CPtr) -> 'PyUnicodeObj' | t.CPtr:
|
||||
obj: PyUnicodeObj | t.CPtr = PyUnicodeObj()
|
||||
obj.ptr = PyUnicode_FromString(s)
|
||||
return obj
|
||||
|
||||
def __add__(self, other: PyUnicodeObj | t.CPtr) -> 'PyUnicodeObj' | t.CPtr:
|
||||
res: PyUnicodeObj | t.CPtr = PyUnicodeObj()
|
||||
res.ptr = PyUnicode_Concat(self.ptr, other.ptr)
|
||||
return res
|
||||
|
||||
def __len__(self) -> t.CPtrDiffT:
|
||||
return PyUnicode_GetLength(self.ptr)
|
||||
|
||||
def as_utf8(self) -> t.CChar | t.CPtr:
|
||||
return PyUnicode_AsUTF8(self.ptr)
|
||||
|
||||
def __str__(self) -> PyObject | t.CPtr:
|
||||
return self.ptr
|
||||
|
||||
def dec_ref(self):
|
||||
Py_DecRef(self.ptr)
|
||||
|
||||
|
||||
# --- PyListObj: Python 列表包装 ---
|
||||
class PyListObj:
|
||||
ptr: PyObject | t.CPtr
|
||||
|
||||
def __new__(self) -> 'PyListObj' | t.CPtr:
|
||||
return t.CPtr(malloc(PyListObj.__sizeof__()))
|
||||
|
||||
@staticmethod
|
||||
def new() -> 'PyListObj' | t.CPtr:
|
||||
obj: PyListObj | t.CPtr = PyListObj()
|
||||
obj.ptr = PyList_New(0)
|
||||
return obj
|
||||
|
||||
def __getitem__(self, idx: t.CSizeT) -> PyObject | t.CPtr:
|
||||
return PyList_GetItem(self.ptr, idx)
|
||||
|
||||
def __setitem__(self, idx: t.CSizeT, val: PyObject | t.CPtr):
|
||||
PyList_SetItem(self.ptr, idx, val)
|
||||
|
||||
def __len__(self) -> t.CSizeT:
|
||||
return PyList_Size(self.ptr)
|
||||
|
||||
def append(self, item: PyObject | t.CPtr) -> t.CInt:
|
||||
return PyList_Append(self.ptr, item)
|
||||
|
||||
def dec_ref(self):
|
||||
Py_DecRef(self.ptr)
|
||||
|
||||
|
||||
# --- PyDictObj: Python 字典包装 ---
|
||||
class PyDictObj:
|
||||
ptr: PyObject | t.CPtr
|
||||
|
||||
def __new__(self) -> 'PyDictObj' | t.CPtr:
|
||||
return t.CPtr(malloc(PyDictObj.__sizeof__()))
|
||||
|
||||
@staticmethod
|
||||
def new() -> 'PyDictObj' | t.CPtr:
|
||||
obj: PyDictObj | t.CPtr = PyDictObj()
|
||||
obj.ptr = PyDict_New()
|
||||
return obj
|
||||
|
||||
def __getitem__(self, key: PyObject | t.CPtr) -> PyObject | t.CPtr:
|
||||
return PyDict_GetItem(self.ptr, key)
|
||||
|
||||
def __setitem__(self, key: PyObject | t.CPtr, val: PyObject | t.CPtr):
|
||||
PyDict_SetItem(self.ptr, key, val)
|
||||
|
||||
def __len__(self) -> t.CSizeT:
|
||||
return PyDict_Size(self.ptr)
|
||||
|
||||
def get_string(self, key: t.CChar | t.CPtr) -> PyObject | t.CPtr:
|
||||
return PyDict_GetItemString(self.ptr, key)
|
||||
|
||||
def set_string(self, key: t.CChar | t.CPtr, val: PyObject | t.CPtr):
|
||||
PyDict_SetItemString(self.ptr, key, val)
|
||||
|
||||
def dec_ref(self):
|
||||
Py_DecRef(self.ptr)
|
||||
359
Test/CPythonTest/App/main.py
Normal file
359
Test/CPythonTest/App/main.py
Normal file
@@ -0,0 +1,359 @@
|
||||
import t, c
|
||||
from t import CInt, CLong, CDouble, CPtr, CSizeT
|
||||
from stdio import printf
|
||||
import cpython
|
||||
import testcheck
|
||||
|
||||
|
||||
def test_init_finalize():
|
||||
testcheck.section("Py_Initialize / Py_Finalize")
|
||||
cpython.Py_Initialize()
|
||||
testcheck.check(cpython.Py_IsInitialized() != 0, "Py_Initialize succeeded", "Py_Initialize succeeded")
|
||||
cpython.Py_Finalize()
|
||||
testcheck.check(cpython.Py_IsInitialized() == 0, "Py_Finalize succeeded", "Py_Finalize succeeded")
|
||||
|
||||
|
||||
def test_long_operations():
|
||||
testcheck.section("PyLong operations")
|
||||
cpython.Py_Initialize()
|
||||
|
||||
# 创建整数
|
||||
py_num: cpython.PyObject | CPtr = cpython.PyLong_FromLong(12345)
|
||||
testcheck.check(py_num != 0, "PyLong_FromLong != NULL", "PyLong_FromLong != NULL")
|
||||
|
||||
# 整数转字符串
|
||||
py_str: cpython.PyObject | CPtr = cpython.PyObject_Str(py_num)
|
||||
testcheck.check(py_str != 0, "PyObject_Str != NULL", "PyObject_Str != NULL")
|
||||
|
||||
# 获取 C 字符串
|
||||
c_str: t.CChar | CPtr = cpython.PyUnicode_AsUTF8(py_str)
|
||||
testcheck.check(c_str != 0, "PyUnicode_AsUTF8 != NULL", "PyUnicode_AsUTF8 != NULL")
|
||||
printf(" PyLong_FromLong(12345) -> str = %s\n", c_str)
|
||||
|
||||
# 读取回来
|
||||
val: CLong = cpython.PyLong_AsLong(py_num)
|
||||
testcheck.check(val == 12345, "PyLong_AsLong == 12345", "PyLong_AsLong == 12345")
|
||||
|
||||
# 负数
|
||||
py_neg: cpython.PyObject | CPtr = cpython.PyLong_FromLong(-999)
|
||||
neg_val: CLong = cpython.PyLong_AsLong(py_neg)
|
||||
testcheck.check(neg_val == -999, "PyLong_FromLong(-999) == -999", "PyLong_FromLong(-999) == -999")
|
||||
|
||||
# 浮点数转整数
|
||||
py_dbl: cpython.PyObject | CPtr = cpython.PyFloat_FromDouble(3.14159)
|
||||
testcheck.check(py_dbl != 0, "PyFloat_FromDouble != NULL", "PyFloat_FromDouble != NULL")
|
||||
dbl_val: CDouble = cpython.PyFloat_AsDouble(py_dbl)
|
||||
testcheck.check(dbl_val > 3.14 and dbl_val < 3.15, "PyFloat_AsDouble ~= 3.14", "PyFloat_AsDouble ~= 3.14")
|
||||
|
||||
# 清理
|
||||
cpython.Py_DecRef(py_dbl)
|
||||
cpython.Py_DecRef(py_neg)
|
||||
cpython.Py_DecRef(py_str)
|
||||
cpython.Py_DecRef(py_num)
|
||||
|
||||
cpython.Py_Finalize()
|
||||
|
||||
|
||||
def test_string_operations():
|
||||
testcheck.section("PyUnicode operations")
|
||||
cpython.Py_Initialize()
|
||||
|
||||
# 从 C 字符串创建
|
||||
py_s1: cpython.PyObject | CPtr = cpython.PyUnicode_FromString("Hello, Viper!")
|
||||
testcheck.check(py_s1 != 0, "PyUnicode_FromString != NULL", "PyUnicode_FromString != NULL")
|
||||
|
||||
# 获取 UTF8
|
||||
utf8: t.CChar | CPtr = cpython.PyUnicode_AsUTF8(py_s1)
|
||||
testcheck.check(utf8 != 0, "AsUTF8 != NULL", "AsUTF8 != NULL")
|
||||
printf(" PyUnicode_FromString -> %s\n", utf8)
|
||||
|
||||
# 字符串长度
|
||||
length: CLong = cpython.PyUnicode_GetLength(py_s1)
|
||||
testcheck.check(length == 13, "GetLength == 13", "GetLength == 13")
|
||||
|
||||
# 字符串拼接
|
||||
py_s2: cpython.PyObject | CPtr = cpython.PyUnicode_FromString(" World")
|
||||
py_concat: cpython.PyObject | CPtr = cpython.PyUnicode_Concat(py_s1, py_s2)
|
||||
concat_utf8: t.CChar | CPtr = cpython.PyUnicode_AsUTF8(py_concat)
|
||||
testcheck.check(py_concat != 0, "Concat != NULL", "Concat != NULL")
|
||||
printf(" Concat -> %s\n", concat_utf8)
|
||||
|
||||
# 清理
|
||||
cpython.Py_DecRef(py_concat)
|
||||
cpython.Py_DecRef(py_s2)
|
||||
cpython.Py_DecRef(py_s1)
|
||||
|
||||
cpython.Py_Finalize()
|
||||
|
||||
|
||||
def test_list_operations():
|
||||
testcheck.section("PyList operations")
|
||||
cpython.Py_Initialize()
|
||||
|
||||
# 创建列表
|
||||
py_list: cpython.PyObject | CPtr = cpython.PyList_New(0)
|
||||
testcheck.check(py_list != 0, "PyList_New != NULL", "PyList_New != NULL")
|
||||
|
||||
# Append 元素
|
||||
py_i1: cpython.PyObject | CPtr = cpython.PyLong_FromLong(10)
|
||||
py_i2: cpython.PyObject | CPtr = cpython.PyLong_FromLong(20)
|
||||
py_i3: cpython.PyObject | CPtr = cpython.PyLong_FromLong(30)
|
||||
cpython.PyList_Append(py_list, py_i1)
|
||||
cpython.PyList_Append(py_list, py_i2)
|
||||
cpython.PyList_Append(py_list, py_i3)
|
||||
|
||||
# 检查大小
|
||||
list_size: CSizeT = cpython.PyList_Size(py_list)
|
||||
testcheck.check(list_size == 3, "PyList_Size == 3", "PyList_Size == 3")
|
||||
|
||||
# 获取元素
|
||||
item0: cpython.PyObject | CPtr = cpython.PyList_GetItem(py_list, 0)
|
||||
val0: CLong = cpython.PyLong_AsLong(item0)
|
||||
testcheck.check(val0 == 10, "list[0] == 10", "list[0] == 10")
|
||||
|
||||
item2: cpython.PyObject | CPtr = cpython.PyList_GetItem(py_list, 2)
|
||||
val2: CLong = cpython.PyLong_AsLong(item2)
|
||||
testcheck.check(val2 == 30, "list[2] == 30", "list[2] == 30")
|
||||
|
||||
# 清理
|
||||
cpython.Py_DecRef(py_i3)
|
||||
cpython.Py_DecRef(py_i2)
|
||||
cpython.Py_DecRef(py_i1)
|
||||
cpython.Py_DecRef(py_list)
|
||||
|
||||
cpython.Py_Finalize()
|
||||
|
||||
|
||||
def test_dict_operations():
|
||||
testcheck.section("PyDict operations")
|
||||
cpython.Py_Initialize()
|
||||
|
||||
# 创建字典
|
||||
py_dict: cpython.PyObject | CPtr = cpython.PyDict_New()
|
||||
testcheck.check(py_dict != 0, "PyDict_New != NULL", "PyDict_New != NULL")
|
||||
|
||||
# 设置键值对
|
||||
py_key1: cpython.PyObject | CPtr = cpython.PyUnicode_FromString("name")
|
||||
py_val1: cpython.PyObject | CPtr = cpython.PyUnicode_FromString("Viper")
|
||||
cpython.PyDict_SetItem(py_dict, py_key1, py_val1)
|
||||
|
||||
py_key2: cpython.PyObject | CPtr = cpython.PyUnicode_FromString("version")
|
||||
py_val2: cpython.PyObject | CPtr = cpython.PyLong_FromLong(1)
|
||||
cpython.PyDict_SetItem(py_dict, py_key2, py_val2)
|
||||
|
||||
# 检查大小
|
||||
dict_size: CSizeT = cpython.PyDict_Size(py_dict)
|
||||
testcheck.check(dict_size == 2, "PyDict_Size == 2", "PyDict_Size == 2")
|
||||
|
||||
# 获取值
|
||||
got_val: cpython.PyObject | CPtr = cpython.PyDict_GetItem(py_dict, py_key1)
|
||||
testcheck.check(got_val != 0, "GetItem(name) != NULL", "GetItem(name) != NULL")
|
||||
got_str: t.CChar | CPtr = cpython.PyUnicode_AsUTF8(got_val)
|
||||
testcheck.check(got_str != 0, "name == Viper", "name == Viper")
|
||||
printf(" dict['name'] = %s\n", got_str)
|
||||
|
||||
# 使用 GetItemString
|
||||
got_ver: cpython.PyObject | CPtr = cpython.PyDict_GetItemString(py_dict, "version")
|
||||
testcheck.check(got_ver != 0, "GetItemString(version) != NULL", "GetItemString(version) != NULL")
|
||||
ver_val: CLong = cpython.PyLong_AsLong(got_ver)
|
||||
testcheck.check(ver_val == 1, "version == 1", "version == 1")
|
||||
|
||||
# 清理
|
||||
cpython.Py_DecRef(py_val2)
|
||||
cpython.Py_DecRef(py_key2)
|
||||
cpython.Py_DecRef(py_val1)
|
||||
cpython.Py_DecRef(py_key1)
|
||||
cpython.Py_DecRef(py_dict)
|
||||
|
||||
cpython.Py_Finalize()
|
||||
|
||||
|
||||
def test_pyrun_string():
|
||||
testcheck.section("PyRun_SimpleString")
|
||||
cpython.Py_Initialize()
|
||||
|
||||
# 执行简单 Python 代码
|
||||
rc: CInt = cpython.PyRun_SimpleString("print('Hello from embedded Python!')")
|
||||
testcheck.check(rc == 0, "PyRun_SimpleString == 0", "PyRun_SimpleString == 0")
|
||||
|
||||
# 执行赋值
|
||||
rc2: CInt = cpython.PyRun_SimpleString("x = 6 * 7")
|
||||
testcheck.check(rc2 == 0, "PyRun_SimpleString(assign) == 0", "PyRun_SimpleString(assign) == 0")
|
||||
|
||||
# 读取结果
|
||||
rc3: CInt = cpython.PyRun_SimpleString("print(f'The answer is {x}')")
|
||||
testcheck.check(rc3 == 0, "PyRun_SimpleString(print) == 0", "PyRun_SimpleString(print) == 0")
|
||||
|
||||
cpython.Py_Finalize()
|
||||
|
||||
|
||||
def test_import_module():
|
||||
testcheck.section("PyImport_ImportModule")
|
||||
cpython.Py_Initialize()
|
||||
|
||||
# 导入 math 模块
|
||||
math_mod: cpython.PyObject | CPtr = cpython.PyImport_ImportModule("math")
|
||||
testcheck.check(math_mod != 0, "import math != NULL", "import math != NULL")
|
||||
|
||||
if math_mod != 0:
|
||||
# 获取 math.pi
|
||||
pi_val: cpython.PyObject | CPtr = cpython.PyObject_GetAttrString(math_mod, "pi")
|
||||
testcheck.check(pi_val != 0, "math.pi != NULL", "math.pi != NULL")
|
||||
if pi_val != 0:
|
||||
pi_dbl: CDouble = cpython.PyFloat_AsDouble(pi_val)
|
||||
testcheck.check(pi_dbl > 3.14 and pi_dbl < 3.15, "math.pi ~= 3.14", "math.pi ~= 3.14")
|
||||
printf(" math.pi = %f\n", pi_dbl)
|
||||
cpython.Py_DecRef(pi_val)
|
||||
|
||||
# 获取 math.sqrt 函数
|
||||
sqrt_func: cpython.PyObject | CPtr = cpython.PyObject_GetAttrString(math_mod, "sqrt")
|
||||
testcheck.check(sqrt_func != 0, "math.sqrt != NULL", "math.sqrt != NULL")
|
||||
if sqrt_func != 0:
|
||||
cpython.Py_DecRef(sqrt_func)
|
||||
|
||||
cpython.Py_DecRef(math_mod)
|
||||
|
||||
cpython.Py_Finalize()
|
||||
|
||||
|
||||
def test_operator_overload():
|
||||
testcheck.section("Operator Overload (PyLongObj / PyFloatObj / PyUnicodeObj / PyListObj / PyDictObj)")
|
||||
cpython.Py_Initialize()
|
||||
|
||||
# --- PyLongObj: from_long, to_long, +, -, *, - (neg) ---
|
||||
a: cpython.PyLongObj | CPtr = cpython.PyLongObj.from_long(10)
|
||||
b: cpython.PyLongObj | CPtr = cpython.PyLongObj.from_long(3)
|
||||
testcheck.check(a != 0 and b != 0, "PyLongObj.from_long != NULL", "PyLongObj.from_long != NULL")
|
||||
|
||||
add_r: cpython.PyLongObj | CPtr = a + b
|
||||
testcheck.check(add_r.to_long() == 13, "PyLongObj 10 + 3 == 13", "PyLongObj 10 + 3 == 13")
|
||||
|
||||
sub_r: cpython.PyLongObj | CPtr = a - b
|
||||
testcheck.check(sub_r.to_long() == 7, "PyLongObj 10 - 3 == 7", "PyLongObj 10 - 3 == 7")
|
||||
|
||||
mul_r: cpython.PyLongObj | CPtr = a * b
|
||||
testcheck.check(mul_r.to_long() == 30, "PyLongObj 10 * 3 == 30", "PyLongObj 10 * 3 == 30")
|
||||
|
||||
neg_r: cpython.PyLongObj | CPtr = -b
|
||||
testcheck.check(neg_r.to_long() == -3, "PyLongObj -3 == -3", "PyLongObj -3 == -3")
|
||||
|
||||
mul_r.dec_ref()
|
||||
sub_r.dec_ref()
|
||||
add_r.dec_ref()
|
||||
neg_r.dec_ref()
|
||||
b.dec_ref()
|
||||
a.dec_ref()
|
||||
|
||||
# --- PyFloatObj: from_double, to_double, +, -, *, /, - (neg) ---
|
||||
fa: cpython.PyFloatObj | CPtr = cpython.PyFloatObj.from_double(10.0)
|
||||
fb: cpython.PyFloatObj | CPtr = cpython.PyFloatObj.from_double(4.0)
|
||||
testcheck.check(fa != 0 and fb != 0, "PyFloatObj.from_double != NULL", "PyFloatObj.from_double != NULL")
|
||||
|
||||
fadd: cpython.PyFloatObj | CPtr = fa + fb
|
||||
testcheck.check(fadd.to_double() == 14.0, "PyFloatObj 10.0 + 4.0 == 14.0", "PyFloatObj 10.0 + 4.0 == 14.0")
|
||||
|
||||
fsub: cpython.PyFloatObj | CPtr = fa - fb
|
||||
testcheck.check(fsub.to_double() == 6.0, "PyFloatObj 10.0 - 4.0 == 6.0", "PyFloatObj 10.0 - 4.0 == 6.0")
|
||||
|
||||
fmul: cpython.PyFloatObj | CPtr = fa * fb
|
||||
testcheck.check(fmul.to_double() == 40.0, "PyFloatObj 10.0 * 4.0 == 40.0", "PyFloatObj 10.0 * 4.0 == 40.0")
|
||||
|
||||
fdiv: cpython.PyFloatObj | CPtr = fa / fb
|
||||
testcheck.check(fdiv.to_double() == 2.5, "PyFloatObj 10.0 / 4.0 == 2.5", "PyFloatObj 10.0 / 4.0 == 2.5")
|
||||
|
||||
fneg: cpython.PyFloatObj | CPtr = -fb
|
||||
testcheck.check(fneg.to_double() == -4.0, "PyFloatObj -4.0 == -4.0", "PyFloatObj -4.0 == -4.0")
|
||||
|
||||
fadd.dec_ref()
|
||||
fsub.dec_ref()
|
||||
fmul.dec_ref()
|
||||
fdiv.dec_ref()
|
||||
fneg.dec_ref()
|
||||
fb.dec_ref()
|
||||
fa.dec_ref()
|
||||
|
||||
# --- PyUnicodeObj: from_string, as_utf8, len, + (concat) ---
|
||||
sa: cpython.PyUnicodeObj | CPtr = cpython.PyUnicodeObj.from_string("Hello")
|
||||
sb: cpython.PyUnicodeObj | CPtr = cpython.PyUnicodeObj.from_string(" World")
|
||||
testcheck.check(sa != 0 and sb != 0, "PyUnicodeObj.from_string != NULL", "PyUnicodeObj.from_string != NULL")
|
||||
|
||||
sc: cpython.PyUnicodeObj | CPtr = sa + sb
|
||||
sc_utf8: t.CChar | CPtr = sc.as_utf8()
|
||||
testcheck.check(sc_utf8 != 0, "PyUnicodeObj concat != NULL", "PyUnicodeObj concat != NULL")
|
||||
if sc_utf8 != 0:
|
||||
printf(" PyUnicodeObj 'Hello' + ' World' = %s\n", sc_utf8)
|
||||
|
||||
sa_len: t.CPtrDiffT = len(sa)
|
||||
testcheck.check(sa_len == 5, "PyUnicodeObj len('Hello') == 5", "PyUnicodeObj len('Hello') == 5")
|
||||
|
||||
sc.dec_ref()
|
||||
sb.dec_ref()
|
||||
sa.dec_ref()
|
||||
|
||||
# --- PyListObj: new, append, len, [], []= ---
|
||||
lst: cpython.PyListObj | CPtr = cpython.PyListObj.new()
|
||||
testcheck.check(lst != 0, "PyListObj.new != NULL", "PyListObj.new != NULL")
|
||||
if lst != 0:
|
||||
e1: cpython.PyObject | CPtr = cpython.PyLong_FromLong(100)
|
||||
e2: cpython.PyObject | CPtr = cpython.PyLong_FromLong(200)
|
||||
e3: cpython.PyObject | CPtr = cpython.PyLong_FromLong(300)
|
||||
lst.append(e1)
|
||||
lst.append(e2)
|
||||
lst.append(e3)
|
||||
testcheck.check(len(lst) == 3, "PyListObj len == 3", "PyListObj len == 3")
|
||||
|
||||
item0: cpython.PyObject | CPtr = lst[t.CSizeT(0)]
|
||||
testcheck.check(cpython.PyLong_AsLong(item0) == 100, "PyListObj lst[0] == 100", "PyListObj lst[0] == 100")
|
||||
|
||||
# __setitem__
|
||||
e4: cpython.PyObject | CPtr = cpython.PyLong_FromLong(999)
|
||||
lst[t.CSizeT(1)] = e4
|
||||
item1: cpython.PyObject | CPtr = lst[t.CSizeT(1)]
|
||||
testcheck.check(cpython.PyLong_AsLong(item1) == 999, "PyListObj lst[1] = 999", "PyListObj lst[1] = 999")
|
||||
|
||||
cpython.Py_DecRef(e4)
|
||||
cpython.Py_DecRef(e3)
|
||||
cpython.Py_DecRef(e2)
|
||||
cpython.Py_DecRef(e1)
|
||||
lst.dec_ref()
|
||||
|
||||
# --- PyDictObj: new, [], []=, len, set_string, get_string ---
|
||||
dct: cpython.PyDictObj | CPtr = cpython.PyDictObj.new()
|
||||
testcheck.check(dct != 0, "PyDictObj.new != NULL", "PyDictObj.new != NULL")
|
||||
if dct != 0:
|
||||
dk1: cpython.PyObject | CPtr = cpython.PyUnicode_FromString("lang")
|
||||
dv1: cpython.PyObject | CPtr = cpython.PyUnicode_FromString("Viper")
|
||||
dct[dk1] = dv1
|
||||
testcheck.check(len(dct) == 1, "PyDictObj len == 1", "PyDictObj len == 1")
|
||||
|
||||
got_lang: cpython.PyObject | CPtr = dct[dk1]
|
||||
got_str: t.CChar | CPtr = cpython.PyUnicode_AsUTF8(got_lang)
|
||||
testcheck.check(got_str != 0, "PyDictObj dct['lang'] == Viper", "PyDictObj dct['lang'] == Viper")
|
||||
if got_str != 0:
|
||||
printf(" PyDictObj dct['lang'] = %s\n", got_str)
|
||||
|
||||
# get_string / set_string
|
||||
dct.set_string("ver", cpython.PyLong_FromLong(3))
|
||||
got_ver: cpython.PyObject | CPtr = dct.get_string("ver")
|
||||
testcheck.check(got_ver != 0 and cpython.PyLong_AsLong(got_ver) == 3, "PyDictObj get_string('ver') == 3", "PyDictObj get_string('ver') == 3")
|
||||
|
||||
cpython.Py_DecRef(dv1)
|
||||
cpython.Py_DecRef(dk1)
|
||||
dct.dec_ref()
|
||||
|
||||
cpython.Py_Finalize()
|
||||
|
||||
|
||||
def main() -> CInt | t.CExport:
|
||||
testcheck.begin("CPython Integration Test")
|
||||
|
||||
test_init_finalize()
|
||||
test_long_operations()
|
||||
test_string_operations()
|
||||
test_list_operations()
|
||||
test_dict_operations()
|
||||
test_pyrun_string()
|
||||
test_import_module()
|
||||
test_operator_overload()
|
||||
|
||||
return testcheck.end()
|
||||
1
Test/CPythonTest/output/7c5d5ec59c5fb0a8.deps.json
Normal file
1
Test/CPythonTest/output/7c5d5ec59c5fb0a8.deps.json
Normal file
@@ -0,0 +1 @@
|
||||
{"stdio": "6f62fe05c5ea1ceb", "w32.win32base": "7e529fe7a078cfef", "win32base": "7e529fe7a078cfef", "w32.win32console": "bbdf3bbd4c3bc28c", "win32console": "bbdf3bbd4c3bc28c", "testcheck": "dd3002730623424b", "stdint": "f5522571bcce7bcb", "main": "fb6cea4f70fade7a"}
|
||||
1
Test/CPythonTest/output/fb6cea4f70fade7a.deps.json
Normal file
1
Test/CPythonTest/output/fb6cea4f70fade7a.deps.json
Normal file
@@ -0,0 +1 @@
|
||||
{"stdio": "6f62fe05c5ea1ceb", "cpython": "7c5d5ec59c5fb0a8", "w32.win32base": "7e529fe7a078cfef", "win32base": "7e529fe7a078cfef", "w32.win32console": "bbdf3bbd4c3bc28c", "win32console": "bbdf3bbd4c3bc28c", "testcheck": "dd3002730623424b", "stdint": "f5522571bcce7bcb"}
|
||||
35
Test/CPythonTest/project.json
Normal file
35
Test/CPythonTest/project.json
Normal file
@@ -0,0 +1,35 @@
|
||||
{
|
||||
"$schema": "https://raw.githubusercontent.com/TermiNexus/TransPyC/main/schemas/project-schema.json",
|
||||
"name": "CPythonTest",
|
||||
"version": "1.0.0",
|
||||
"source_dir": "./App",
|
||||
"temp_dir": "./temp",
|
||||
"output_dir": "./output",
|
||||
"compiler": {
|
||||
"cmd": "llc",
|
||||
"flags": ["-filetype=obj", "-relocation-model=pic"]
|
||||
},
|
||||
"linker": {
|
||||
"cmd": "clang++",
|
||||
"flags": [
|
||||
"-L", "D:\\Python312\\libs",
|
||||
"-lmsvcrt", "-lucrt", "-lpthread", "-lmingwex",
|
||||
"-lkernel32", "-luser32",
|
||||
"-lpython312",
|
||||
"-Wl,--allow-multiple-definition"
|
||||
],
|
||||
"output": "CPythonTest.exe"
|
||||
},
|
||||
"includes": [
|
||||
"./includes"
|
||||
],
|
||||
"target": {
|
||||
"triple": "x86_64-pc-windows-gnu",
|
||||
"datalayout": "e-m:w-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
|
||||
},
|
||||
"options": {
|
||||
"slice_level": 3,
|
||||
"target": "llvm",
|
||||
"strict_mode": false
|
||||
}
|
||||
}
|
||||
28
Test/CPythonTest/temp/6f62fe05c5ea1ceb.pyi
Normal file
28
Test/CPythonTest/temp/6f62fe05c5ea1ceb.pyi
Normal file
@@ -0,0 +1,28 @@
|
||||
"""
|
||||
Auto-generated Python stub file from stdio.py
|
||||
Module: stdio
|
||||
"""
|
||||
|
||||
|
||||
import t, c
|
||||
|
||||
def printf(fmt: t.CConst | str, *args) -> t.CInt | t.State: pass
|
||||
|
||||
def fprintf(stream: bytes, fmt: t.CConst | str, *args) -> t.CInt | t.State: pass
|
||||
|
||||
def sprintf(buf: bytes, fmt: t.CConst | str, *args) -> t.CInt | t.State: pass
|
||||
|
||||
def snprintf(buf: bytes, size: t.CSizeT, fmt: t.CConst | str, *args) -> t.CInt | t.State: pass
|
||||
|
||||
def puts(s: t.CConst | str) -> t.CInt | t.State: pass
|
||||
|
||||
def fputs(s: t.CConst | str, stream: bytes) -> t.CInt | t.State: pass
|
||||
|
||||
def fgets(buf: bytes, size: t.CInt, stream: bytes) -> bytes | t.State: pass
|
||||
|
||||
def fflush(stream: bytes) -> t.CInt | t.State: pass
|
||||
|
||||
|
||||
stdin: t.CExtern | bytes
|
||||
stdout: t.CExtern | bytes
|
||||
stderr: t.CExtern | bytes
|
||||
1
Test/CPythonTest/temp/7c5d5ec59c5fb0a8.doc.json
Normal file
1
Test/CPythonTest/temp/7c5d5ec59c5fb0a8.doc.json
Normal file
@@ -0,0 +1 @@
|
||||
{}
|
||||
765
Test/CPythonTest/temp/7c5d5ec59c5fb0a8.pyi
Normal file
765
Test/CPythonTest/temp/7c5d5ec59c5fb0a8.pyi
Normal file
@@ -0,0 +1,765 @@
|
||||
"""
|
||||
Auto-generated Python stub file from cpython.py
|
||||
Module: cpython
|
||||
"""
|
||||
|
||||
|
||||
import t, c
|
||||
|
||||
class PyObject:
|
||||
ob_refcnt: t.CLong
|
||||
ob_type: t.CPtr
|
||||
|
||||
def Py_INCREF(op: PyObject | t.CPtr) -> t.CVoid | t.State: pass
|
||||
|
||||
def Py_DECREF(op: PyObject | t.CPtr) -> t.CVoid | t.State: pass
|
||||
|
||||
def Py_XINCREF(op: PyObject | t.CPtr) -> t.CVoid | t.State: pass
|
||||
|
||||
def Py_XDECREF(op: PyObject | t.CPtr) -> t.CVoid | t.State: pass
|
||||
|
||||
def Py_DecRef(op: PyObject | t.CPtr) -> t.CVoid | t.State: pass
|
||||
|
||||
def Py_Initialize() -> t.CVoid | t.State: pass
|
||||
|
||||
def Py_Finalize() -> t.CVoid | t.State: pass
|
||||
|
||||
def Py_InitializeEx(initsigs: t.CInt) -> t.CVoid | t.State: pass
|
||||
|
||||
def Py_FinalizeEx() -> t.CInt | t.State: pass
|
||||
|
||||
def Py_IsInitialized() -> t.CInt | t.State: pass
|
||||
|
||||
|
||||
class PySTATUS:
|
||||
func: t.CConst | str
|
||||
err_msg: t.CConst | str
|
||||
exitcode: t.CInt
|
||||
class PyPreConfig:
|
||||
_config_version: t.CInt
|
||||
_config_init: t.CInt
|
||||
parse_argv: t.CInt
|
||||
isolated: t.CInt
|
||||
use_environment: t.CInt
|
||||
utf8_mode: t.CInt
|
||||
coerce_c_locale: t.CInt
|
||||
C_locale_warnings: t.CInt
|
||||
allocator: t.CInt
|
||||
dev_mode: t.CInt
|
||||
class PyWideStringList:
|
||||
length: t.CSizeT
|
||||
items: t.CPtr
|
||||
class PyConfig:
|
||||
_config_version: t.CInt
|
||||
_config_init: t.CInt
|
||||
isolated: t.CInt
|
||||
use_environment: t.CInt
|
||||
dev_mode: t.CInt
|
||||
install_signal_handlers: t.CInt
|
||||
use_hash_seed: t.CInt
|
||||
hash_seed: t.CUnsignedLong
|
||||
faulthandler: t.CInt
|
||||
tracemalloc: t.CInt
|
||||
import_time: t.CInt
|
||||
show_ref_count: t.CInt
|
||||
dump_refs: t.CInt
|
||||
dump_refs_file: t.CConst | str
|
||||
malloc_stats: t.CInt
|
||||
filesystem_errors: t.CInt
|
||||
pycache_prefix: t.CConst | str
|
||||
parse_argv: t.CInt
|
||||
argv: PyWideStringList
|
||||
program_name: t.CConst | str
|
||||
xoptions: PyWideStringList
|
||||
warnoptions: PyWideStringList
|
||||
site_import: t.CInt
|
||||
bytes_warning: t.CInt
|
||||
warn_default_encoding: t.CInt
|
||||
inspect: t.CInt
|
||||
interactive: t.CInt
|
||||
optimization_level: t.CInt
|
||||
parser_debug: t.CInt
|
||||
verbose: t.CInt
|
||||
quiet: t.CInt
|
||||
home: t.CConst | str
|
||||
pythonpath_env: t.CConst | str
|
||||
module_search_paths: PyWideStringList
|
||||
module_search_paths_set: t.CInt
|
||||
executable: t.CConst | str
|
||||
base_executable: t.CConst | str
|
||||
prefix: t.CConst | str
|
||||
base_prefix: t.CConst | str
|
||||
exec_prefix: t.CConst | str
|
||||
base_exec_prefix: t.CConst | str
|
||||
platlibdir: t.CConst | str
|
||||
stdio_filename: t.CConst | str
|
||||
|
||||
def PyConfig_InitPythonConfig(config: PyConfig | t.CPtr) -> t.CVoid | t.State: pass
|
||||
|
||||
def PyConfig_InitIsolatedConfig(config: PyConfig | t.CPtr) -> t.CVoid | t.State: pass
|
||||
|
||||
def PyConfig_Clear(config: PyConfig | t.CPtr) -> t.CVoid | t.State: pass
|
||||
|
||||
def PyConfig_Read(config: PyConfig | t.CPtr) -> PySTATUS | t.State: pass
|
||||
|
||||
def Py_InitializeFromConfig(config: PyConfig | t.CPtr) -> PySTATUS | t.State: pass
|
||||
|
||||
def Py_DecodeLocale(s: t.CConst | str) -> str | t.State: pass
|
||||
|
||||
def PyStatus_Exception(status: PySTATUS) -> t.CInt | t.State: pass
|
||||
|
||||
def PyLong_FromLong(v: t.CLong) -> PyObject | t.CPtr | t.State: pass
|
||||
|
||||
def PyLong_FromUnsignedLong(v: t.CUnsignedLong) -> PyObject | t.CPtr | t.State: pass
|
||||
|
||||
def PyLong_FromLongLong(v: t.CLong) -> PyObject | t.CPtr | t.State: pass
|
||||
|
||||
def PyLong_FromUnsignedLongLong(v: t.CUnsignedLong) -> PyObject | t.CPtr | t.State: pass
|
||||
|
||||
def PyLong_FromSsize_t(v: t.CPtrDiffT) -> PyObject | t.CPtr | t.State: pass
|
||||
|
||||
def PyLong_FromSize_t(v: t.CSizeT) -> PyObject | t.CPtr | t.State: pass
|
||||
|
||||
def PyLong_FromDouble(v: t.CDouble) -> PyObject | t.CPtr | t.State: pass
|
||||
|
||||
def PyLong_AsLong(obj: PyObject | t.CPtr) -> t.CLong | t.State: pass
|
||||
|
||||
def PyLong_AsUnsignedLong(obj: PyObject | t.CPtr) -> t.CUnsignedLong | t.State: pass
|
||||
|
||||
def PyLong_AsLongLong(obj: PyObject | t.CPtr) -> t.CLong | t.State: pass
|
||||
|
||||
def PyLong_AsUnsignedLongLong(obj: PyObject | t.CPtr) -> t.CUnsignedLong | t.State: pass
|
||||
|
||||
def PyLong_AsDouble(obj: PyObject | t.CPtr) -> t.CDouble | t.State: pass
|
||||
|
||||
def PyLong_AsSsize_t(obj: PyObject | t.CPtr) -> t.CPtrDiffT | t.State: pass
|
||||
|
||||
def PyLong_AsSize_t(obj: PyObject | t.CPtr) -> t.CSizeT | t.State: pass
|
||||
|
||||
def PyFloat_FromDouble(v: t.CDouble) -> PyObject | t.CPtr | t.State: pass
|
||||
|
||||
def PyFloat_AsDouble(obj: PyObject | t.CPtr) -> t.CDouble | t.State: pass
|
||||
|
||||
def PyFloat_FromString(s: PyObject | t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
|
||||
def PyUnicode_FromString(u: t.CConst | str) -> PyObject | t.CPtr | t.State: pass
|
||||
|
||||
def PyUnicode_FromStringAndSize(u: t.CConst | str, size: t.CSizeT) -> PyObject | t.CPtr | t.State: pass
|
||||
|
||||
def PyUnicode_FromFormat(fmt: t.CConst | str) -> PyObject | t.CPtr | t.State: pass
|
||||
|
||||
def PyUnicode_AsUTF8(obj: PyObject | t.CPtr) -> str | t.State: pass
|
||||
|
||||
def PyUnicode_AsUTF8AndSize(obj: PyObject | t.CPtr, size: t.CPtrDiffT | t.CPtr) -> str | t.State: pass
|
||||
|
||||
def PyUnicode_AsWideChar(obj: PyObject | t.CPtr, wbuf: t.CPtr, bufsize: t.CSizeT) -> t.CSizeT | t.State: pass
|
||||
|
||||
def PyUnicode_GetLength(obj: PyObject | t.CPtr) -> t.CPtrDiffT | t.State: pass
|
||||
|
||||
def PyUnicode_ReadChar(obj: PyObject | t.CPtr, idx: t.CSizeT) -> t.CUInt32T | t.State: pass
|
||||
|
||||
def PyUnicode_WriteChar(obj: PyObject | t.CPtr, idx: t.CSizeT, ch: t.CUInt32T) -> t.CInt | t.State: pass
|
||||
|
||||
def PyUnicode_Compare(l: PyObject | t.CPtr, r: PyObject | t.CPtr) -> t.CInt | t.State: pass
|
||||
|
||||
def PyUnicode_Concat(l: PyObject | t.CPtr, r: PyObject | t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
|
||||
def PyUnicode_Contains(container: PyObject | t.CPtr, element: PyObject | t.CPtr) -> t.CInt | t.State: pass
|
||||
|
||||
def PyUnicode_Format(fmt: PyObject | t.CPtr, args: PyObject | t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
|
||||
def PyUnicode_InternInPlace(s: PyObject | t.CPtr | t.CPtr) -> t.CVoid | t.State: pass
|
||||
|
||||
def PyUnicode_InternFromString(u: t.CConst | str) -> PyObject | t.CPtr | t.State: pass
|
||||
|
||||
def PyBytes_FromString(v: t.CConst | str) -> PyObject | t.CPtr | t.State: pass
|
||||
|
||||
def PyBytes_FromStringAndSize(v: t.CConst | str, size: t.CSizeT) -> PyObject | t.CPtr | t.State: pass
|
||||
|
||||
def PyBytes_AsString(obj: PyObject | t.CPtr) -> str | t.State: pass
|
||||
|
||||
def PyBytes_Size(obj: PyObject | t.CPtr) -> t.CSizeT | t.State: pass
|
||||
|
||||
def PyBytes_FromObject(o: PyObject | t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
|
||||
def PyBytes_FromFormat(fmt: t.CConst | str) -> PyObject | t.CPtr | t.State: pass
|
||||
|
||||
def PyBool_FromLong(v: t.CLong) -> PyObject | t.CPtr | t.State: pass
|
||||
|
||||
|
||||
Py_True: t.CExtern | PyObject | t.CPtr | t.State
|
||||
Py_False: t.CExtern | PyObject | t.CPtr | t.State
|
||||
Py_None: t.CExtern | PyObject | t.CPtr | t.State
|
||||
|
||||
def PyList_New(len: t.CSizeT) -> PyObject | t.CPtr | t.State: pass
|
||||
|
||||
def PyList_Size(lst: PyObject | t.CPtr) -> t.CSizeT | t.State: pass
|
||||
|
||||
def PyList_GetItem(lst: PyObject | t.CPtr, idx: t.CSizeT) -> PyObject | t.CPtr | t.State: pass
|
||||
|
||||
def PyList_SetItem(lst: PyObject | t.CPtr, idx: t.CSizeT, item: PyObject | t.CPtr) -> t.CInt | t.State: pass
|
||||
|
||||
def PyList_Insert(lst: PyObject | t.CPtr, idx: t.CSizeT, item: PyObject | t.CPtr) -> t.CInt | t.State: pass
|
||||
|
||||
def PyList_Append(lst: PyObject | t.CPtr, item: PyObject | t.CPtr) -> t.CInt | t.State: pass
|
||||
|
||||
def PyList_GetSlice(lst: PyObject | t.CPtr, lo: t.CSizeT, hi: t.CSizeT) -> PyObject | t.CPtr | t.State: pass
|
||||
|
||||
def PyList_SetSlice(lst: PyObject | t.CPtr, lo: t.CSizeT, hi: t.CSizeT, items: PyObject | t.CPtr) -> t.CInt | t.State: pass
|
||||
|
||||
def PyList_Sort(lst: PyObject | t.CPtr) -> t.CInt | t.State: pass
|
||||
|
||||
def PyList_Reverse(lst: PyObject | t.CPtr) -> t.CInt | t.State: pass
|
||||
|
||||
def PyList_AsTuple(lst: PyObject | t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
|
||||
def PyTuple_New(len: t.CSizeT) -> PyObject | t.CPtr | t.State: pass
|
||||
|
||||
def PyTuple_Size(tup: PyObject | t.CPtr) -> t.CSizeT | t.State: pass
|
||||
|
||||
def PyTuple_GetItem(tup: PyObject | t.CPtr, idx: t.CSizeT) -> PyObject | t.CPtr | t.State: pass
|
||||
|
||||
def PyTuple_SetItem(tup: PyObject | t.CPtr, idx: t.CSizeT, item: PyObject | t.CPtr) -> t.CInt | t.State: pass
|
||||
|
||||
def PyTuple_GetSlice(tup: PyObject | t.CPtr, lo: t.CSizeT, hi: t.CSizeT) -> PyObject | t.CPtr | t.State: pass
|
||||
|
||||
def PyTuple_Pack(n: t.CSizeT) -> PyObject | t.CPtr | t.State: pass
|
||||
|
||||
def PyDict_New() -> PyObject | t.CPtr | t.State: pass
|
||||
|
||||
def PyDict_GetItem(d: PyObject | t.CPtr, key: PyObject | t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
|
||||
def PyDict_GetItemString(d: PyObject | t.CPtr, key: t.CConst | str) -> PyObject | t.CPtr | t.State: pass
|
||||
|
||||
def PyDict_SetItem(d: PyObject | t.CPtr, key: PyObject | t.CPtr, val: PyObject | t.CPtr) -> t.CInt | t.State: pass
|
||||
|
||||
def PyDict_SetItemString(d: PyObject | t.CPtr, key: t.CConst | str, val: PyObject | t.CPtr) -> t.CInt | t.State: pass
|
||||
|
||||
def PyDict_DelItem(d: PyObject | t.CPtr, key: PyObject | t.CPtr) -> t.CInt | t.State: pass
|
||||
|
||||
def PyDict_DelItemString(d: PyObject | t.CPtr, key: t.CConst | str) -> t.CInt | t.State: pass
|
||||
|
||||
def PyDict_Size(d: PyObject | t.CPtr) -> t.CSizeT | t.State: pass
|
||||
|
||||
def PyDict_Keys(d: PyObject | t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
|
||||
def PyDict_Values(d: PyObject | t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
|
||||
def PyDict_Items(d: PyObject | t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
|
||||
def PyDict_Copy(d: PyObject | t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
|
||||
def PyDict_Clear(d: PyObject | t.CPtr) -> t.CVoid | t.State: pass
|
||||
|
||||
def PyDict_Contains(d: PyObject | t.CPtr, key: PyObject | t.CPtr) -> t.CInt | t.State: pass
|
||||
|
||||
def PyDict_Next(d: PyObject | t.CPtr, pos: t.CPtrDiffT | t.CPtr, key: PyObject | t.CPtr | t.CPtr, val: PyObject | t.CPtr | t.CPtr) -> t.CInt | t.State: pass
|
||||
|
||||
def PyDict_Merge(d: PyObject | t.CPtr, other: PyObject | t.CPtr, override: t.CInt) -> t.CInt | t.State: pass
|
||||
|
||||
def PyDict_Update(d: PyObject | t.CPtr, other: PyObject | t.CPtr) -> t.CInt | t.State: pass
|
||||
|
||||
def PyObject_Str(obj: PyObject | t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
|
||||
def PyObject_Repr(obj: PyObject | t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
|
||||
def PyObject_Type(obj: PyObject | t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
|
||||
def PyObject_IsInstance(obj: PyObject | t.CPtr, cls: PyObject | t.CPtr) -> t.CInt | t.State: pass
|
||||
|
||||
def PyObject_IsSubclass(obj: PyObject | t.CPtr, cls: PyObject | t.CPtr) -> t.CInt | t.State: pass
|
||||
|
||||
def PyObject_HasAttr(obj: PyObject | t.CPtr, name: PyObject | t.CPtr) -> t.CInt | t.State: pass
|
||||
|
||||
def PyObject_HasAttrString(obj: PyObject | t.CPtr, name: t.CConst | str) -> t.CInt | t.State: pass
|
||||
|
||||
def PyObject_GetAttr(obj: PyObject | t.CPtr, name: PyObject | t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
|
||||
def PyObject_GetAttrString(obj: PyObject | t.CPtr, name: t.CConst | str) -> PyObject | t.CPtr | t.State: pass
|
||||
|
||||
def PyObject_SetAttr(obj: PyObject | t.CPtr, name: PyObject | t.CPtr, val: PyObject | t.CPtr) -> t.CInt | t.State: pass
|
||||
|
||||
def PyObject_SetAttrString(obj: PyObject | t.CPtr, name: t.CConst | str, val: PyObject | t.CPtr) -> t.CInt | t.State: pass
|
||||
|
||||
def PyObject_DelAttr(obj: PyObject | t.CPtr, name: PyObject | t.CPtr) -> t.CInt | t.State: pass
|
||||
|
||||
def PyObject_DelAttrString(obj: PyObject | t.CPtr, name: t.CConst | str) -> t.CInt | t.State: pass
|
||||
|
||||
def PyObject_Call(callable: PyObject | t.CPtr, args: PyObject | t.CPtr, kwargs: PyObject | t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
|
||||
def PyObject_CallObject(callable: PyObject | t.CPtr, args: PyObject | t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
|
||||
def PyObject_CallNoArgs(callable: PyObject | t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
|
||||
def PyObject_CallOneArg(callable: PyObject | t.CPtr, arg: PyObject | t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
|
||||
def PyObject_IsTrue(obj: PyObject | t.CPtr) -> t.CInt | t.State: pass
|
||||
|
||||
def PyObject_Not(obj: PyObject | t.CPtr) -> t.CInt | t.State: pass
|
||||
|
||||
def PyObject_RichCompare(o1: PyObject | t.CPtr, o2: PyObject | t.CPtr, opid: t.CInt) -> PyObject | t.CPtr | t.State: pass
|
||||
|
||||
def PyObject_RichCompareBool(o1: PyObject | t.CPtr, o2: PyObject | t.CPtr, opid: t.CInt) -> t.CInt | t.State: pass
|
||||
|
||||
def PyObject_Hash(obj: PyObject | t.CPtr) -> t.CLong | t.State: pass
|
||||
|
||||
def PyObject_Length(obj: PyObject | t.CPtr) -> t.CSizeT | t.State: pass
|
||||
|
||||
def PyObject_GetItem(obj: PyObject | t.CPtr, key: PyObject | t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
|
||||
def PyObject_SetItem(obj: PyObject | t.CPtr, key: PyObject | t.CPtr, val: PyObject | t.CPtr) -> t.CInt | t.State: pass
|
||||
|
||||
def PyObject_DelItem(obj: PyObject | t.CPtr, key: PyObject | t.CPtr) -> t.CInt | t.State: pass
|
||||
|
||||
def PyObject_Dir(obj: PyObject | t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
|
||||
def PyObject_GetIter(obj: PyObject | t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
|
||||
def PyIter_Next(obj: PyObject | t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
|
||||
|
||||
Py_LT: t.CExtern | t.CInt | t.State
|
||||
Py_LE: t.CExtern | t.CInt | t.State
|
||||
Py_EQ: t.CExtern | t.CInt | t.State
|
||||
Py_NE: t.CExtern | t.CInt | t.State
|
||||
Py_GT: t.CExtern | t.CInt | t.State
|
||||
Py_GE: t.CExtern | t.CInt | t.State
|
||||
|
||||
def PyImport_ImportModule(name: t.CConst | str) -> PyObject | t.CPtr | t.State: pass
|
||||
|
||||
def PyImport_Import(name: PyObject | t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
|
||||
def PyImport_ImportModuleLevelObject(name: PyObject | t.CPtr, globs: PyObject | t.CPtr, locs: PyObject | t.CPtr, fromlist: PyObject | t.CPtr, level: t.CInt) -> PyObject | t.CPtr | t.State: pass
|
||||
|
||||
def PyImport_ReloadModule(mod: PyObject | t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
|
||||
def PyImport_AddModule(name: t.CConst | str) -> PyObject | t.CPtr | t.State: pass
|
||||
|
||||
def PyImport_GetModuleDict() -> PyObject | t.CPtr | t.State: pass
|
||||
|
||||
def PyImport_ImportModuleEx(name: t.CConst | str, globs: PyObject | t.CPtr, locs: PyObject | t.CPtr, fromlist: PyObject | t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
|
||||
|
||||
class PyMethodDef:
|
||||
ml_name: t.CConst | str
|
||||
ml_meth: t.CPtr
|
||||
ml_flags: t.CInt
|
||||
ml_doc: t.CConst | str
|
||||
class PyModuleDef_Base:
|
||||
ob_base: PyObject
|
||||
m_init: t.CPtr
|
||||
m_index: t.CSizeT
|
||||
m_copy: PyObject | t.CPtr
|
||||
class PyModuleDef:
|
||||
m_base: PyModuleDef_Base
|
||||
m_name: t.CConst | str
|
||||
m_doc: t.CConst | str
|
||||
m_size: t.CPtrDiffT
|
||||
m_methods: PyMethodDef | t.CPtr
|
||||
m_slots: t.CPtr
|
||||
m_traverse: t.CPtr
|
||||
m_clear: t.CPtr
|
||||
m_free: t.CPtr
|
||||
|
||||
def PyModule_Create(mod: PyModuleDef | t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
|
||||
def PyModule_Create2(mod: PyModuleDef | t.CPtr, ver: t.CInt) -> PyObject | t.CPtr | t.State: pass
|
||||
|
||||
def PyModule_GetName(mod: PyObject | t.CPtr) -> str | t.State: pass
|
||||
|
||||
def PyModule_GetDict(mod: PyObject | t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
|
||||
def PyModule_GetFilenameObject(mod: PyObject | t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
|
||||
def PyModule_AddObject(mod: PyObject | t.CPtr, name: t.CConst | str, val: PyObject | t.CPtr) -> t.CInt | t.State: pass
|
||||
|
||||
def PyModule_AddObjectRef(mod: PyObject | t.CPtr, name: t.CConst | str, val: PyObject | t.CPtr) -> t.CInt | t.State: pass
|
||||
|
||||
def PyModule_AddIntConstant(mod: PyObject | t.CPtr, name: t.CConst | str, val: t.CLong) -> t.CInt | t.State: pass
|
||||
|
||||
def PyModule_AddStringConstant(mod: PyObject | t.CPtr, name: t.CConst | str, val: t.CConst | str) -> t.CInt | t.State: pass
|
||||
|
||||
def PyGILState_Ensure() -> t.CInt | t.State: pass
|
||||
|
||||
def PyGILState_Release(state: t.CInt) -> t.CVoid | t.State: pass
|
||||
|
||||
def PyEval_SaveThread() -> t.CPtr | t.State: pass
|
||||
|
||||
def PyEval_RestoreThread(tstate: t.CPtr) -> t.CVoid | t.State: pass
|
||||
|
||||
def PyEval_AcquireThread(tstate: t.CPtr) -> t.CVoid | t.State: pass
|
||||
|
||||
def PyEval_ReleaseThread(tstate: t.CPtr) -> t.CVoid | t.State: pass
|
||||
|
||||
def PyEval_AcquireLock() -> t.CVoid | t.State: pass
|
||||
|
||||
def PyEval_ReleaseLock() -> t.CVoid | t.State: pass
|
||||
|
||||
def PyEval_ThreadsInitialized() -> t.CInt | t.State: pass
|
||||
|
||||
def PyEval_InitThreads() -> t.CVoid | t.State: pass
|
||||
|
||||
def PyErr_Occurred() -> PyObject | t.CPtr | t.State: pass
|
||||
|
||||
def PyErr_Clear() -> t.CVoid | t.State: pass
|
||||
|
||||
def PyErr_Fetch(tp: PyObject | t.CPtr | t.CPtr, val: PyObject | t.CPtr | t.CPtr, tb: PyObject | t.CPtr | t.CPtr) -> t.CVoid | t.State: pass
|
||||
|
||||
def PyErr_Restore(tp: PyObject | t.CPtr, val: PyObject | t.CPtr, tb: PyObject | t.CPtr) -> t.CVoid | t.State: pass
|
||||
|
||||
def PyErr_NormalizeException(tp: PyObject | t.CPtr | t.CPtr, val: PyObject | t.CPtr | t.CPtr, tb: PyObject | t.CPtr | t.CPtr) -> t.CVoid | t.State: pass
|
||||
|
||||
def PyErr_SetString(tp: PyObject | t.CPtr, msg: t.CConst | str) -> t.CVoid | t.State: pass
|
||||
|
||||
def PyErr_SetObject(tp: PyObject | t.CPtr, val: PyObject | t.CPtr) -> t.CVoid | t.State: pass
|
||||
|
||||
def PyErr_BadArgument() -> t.CPtr | t.State: pass
|
||||
|
||||
def PyErr_NoMemory() -> t.CPtr | t.State: pass
|
||||
|
||||
def PyErr_Print() -> t.CVoid | t.State: pass
|
||||
|
||||
def PyErr_ExceptionMatches(exc: PyObject | t.CPtr) -> t.CInt | t.State: pass
|
||||
|
||||
def PyErr_GivenExceptionMatches(given: PyObject | t.CPtr, exc: PyObject | t.CPtr) -> t.CInt | t.State: pass
|
||||
|
||||
|
||||
PyExc_BaseException: t.CExtern | PyObject | t.CPtr | t.State
|
||||
PyExc_Exception: t.CExtern | PyObject | t.CPtr | t.State
|
||||
PyExc_TypeError: t.CExtern | PyObject | t.CPtr | t.State
|
||||
PyExc_ValueError: t.CExtern | PyObject | t.CPtr | t.State
|
||||
PyExc_RuntimeError: t.CExtern | PyObject | t.CPtr | t.State
|
||||
PyExc_KeyError: t.CExtern | PyObject | t.CPtr | t.State
|
||||
PyExc_IndexError: t.CExtern | PyObject | t.CPtr | t.State
|
||||
PyExc_AttributeError: t.CExtern | PyObject | t.CPtr | t.State
|
||||
PyExc_ImportError: t.CExtern | PyObject | t.CPtr | t.State
|
||||
PyExc_OSError: t.CExtern | PyObject | t.CPtr | t.State
|
||||
PyExc_IOError: t.CExtern | PyObject | t.CPtr | t.State
|
||||
PyExc_ZeroDivisionError: t.CExtern | PyObject | t.CPtr | t.State
|
||||
PyExc_OverflowError: t.CExtern | PyObject | t.CPtr | t.State
|
||||
PyExc_MemoryError: t.CExtern | PyObject | t.CPtr | t.State
|
||||
PyExc_NameError: t.CExtern | PyObject | t.CPtr | t.State
|
||||
PyExc_StopIteration: t.CExtern | PyObject | t.CPtr | t.State
|
||||
PyExc_NotImplementedError: t.CExtern | PyObject | t.CPtr | t.State
|
||||
PyExc_SyntaxError: t.CExtern | PyObject | t.CPtr | t.State
|
||||
PyExc_FileNotFoundError: t.CExtern | PyObject | t.CPtr | t.State
|
||||
PyExc_PermissionError: t.CExtern | PyObject | t.CPtr | t.State
|
||||
PyExc_IsADirectoryError: t.CExtern | PyObject | t.CPtr | t.State
|
||||
PyExc_NotADirectoryError: t.CExtern | PyObject | t.CPtr | t.State
|
||||
|
||||
def Py_BuildValue(fmt: t.CConst | str) -> PyObject | t.CPtr | t.State: pass
|
||||
|
||||
def Py_VaBuildValue(fmt: t.CConst | str, va: t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
|
||||
def PyLong_Check(obj: PyObject | t.CPtr) -> t.CInt | t.State: pass
|
||||
|
||||
def PyFloat_Check(obj: PyObject | t.CPtr) -> t.CInt | t.State: pass
|
||||
|
||||
def PyUnicode_Check(obj: PyObject | t.CPtr) -> t.CInt | t.State: pass
|
||||
|
||||
def PyBytes_Check(obj: PyObject | t.CPtr) -> t.CInt | t.State: pass
|
||||
|
||||
def PyList_Check(obj: PyObject | t.CPtr) -> t.CInt | t.State: pass
|
||||
|
||||
def PyTuple_Check(obj: PyObject | t.CPtr) -> t.CInt | t.State: pass
|
||||
|
||||
def PyDict_Check(obj: PyObject | t.CPtr) -> t.CInt | t.State: pass
|
||||
|
||||
def PyBool_Check(obj: PyObject | t.CPtr) -> t.CInt | t.State: pass
|
||||
|
||||
def PyNone_Check(obj: PyObject | t.CPtr) -> t.CInt | t.State: pass
|
||||
|
||||
def PyMem_Malloc(size: t.CSizeT) -> t.CPtr | t.State: pass
|
||||
|
||||
def PyMem_Realloc(ptr: t.CPtr, size: t.CSizeT) -> t.CPtr | t.State: pass
|
||||
|
||||
def PyMem_Free(ptr: t.CPtr) -> t.CVoid | t.State: pass
|
||||
|
||||
def PyMem_Calloc(nelem: t.CSizeT, elsize: t.CSizeT) -> t.CPtr | t.State: pass
|
||||
|
||||
def PyObject_Malloc(size: t.CSizeT) -> t.CPtr | t.State: pass
|
||||
|
||||
def PyObject_Realloc(ptr: t.CPtr, size: t.CSizeT) -> t.CPtr | t.State: pass
|
||||
|
||||
def PyObject_Free(ptr: t.CPtr) -> t.CVoid | t.State: pass
|
||||
|
||||
def PyObject_Calloc(nelem: t.CSizeT, elsize: t.CSizeT) -> t.CPtr | t.State: pass
|
||||
|
||||
def PyObject_Init(obj: PyObject | t.CPtr, tp: t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
|
||||
def PyObject_InitVar(obj: PyObject | t.CPtr, tp: t.CPtr, size: t.CSizeT) -> PyObject | t.CPtr | t.State: pass
|
||||
|
||||
def PyFile_FromString(filename: t.CConst | str, mode: t.CConst | str) -> PyObject | t.CPtr | t.State: pass
|
||||
|
||||
def PyFile_AsFile(file: PyObject | t.CPtr) -> t.CPtr | t.State: pass
|
||||
|
||||
def PyFile_WriteObject(obj: PyObject | t.CPtr, file: PyObject | t.CPtr, flags: t.CInt) -> t.CInt | t.State: pass
|
||||
|
||||
def PyFile_WriteString(s: t.CConst | str, file: PyObject | t.CPtr) -> t.CInt | t.State: pass
|
||||
|
||||
def Py_CompileString(s: t.CConst | str, filename: t.CConst | str, start: t.CInt) -> PyObject | t.CPtr | t.State: pass
|
||||
|
||||
def PyEval_EvalCode(code: PyObject | t.CPtr, globs: PyObject | t.CPtr, locs: PyObject | t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
|
||||
def PyEval_EvalCodeEx(code: PyObject | t.CPtr, globs: PyObject | t.CPtr, locs: PyObject | t.CPtr, args: PyObject | t.CPtr | t.CPtr, argc: t.CInt, kws: PyObject | t.CPtr | t.CPtr, kwc: t.CInt, defs: PyObject | t.CPtr | t.CPtr, defc: t.CInt, kwdefs: PyObject | t.CPtr, closure: PyObject | t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
|
||||
def PyEval_EvalFrame(frame: t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
|
||||
def PyEval_CallObject(callable: PyObject | t.CPtr, args: PyObject | t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
|
||||
def PyEval_CallFunction(callable: PyObject | t.CPtr, fmt: t.CConst | str) -> PyObject | t.CPtr | t.State: pass
|
||||
|
||||
def PyEval_CallMethod(obj: PyObject | t.CPtr, method: t.CConst | str, fmt: t.CConst | str) -> PyObject | t.CPtr | t.State: pass
|
||||
|
||||
def PyRun_SimpleString(cmd: t.CConst | str) -> t.CInt | t.State: pass
|
||||
|
||||
def PyRun_SimpleFile(fp: t.CPtr, filename: t.CConst | str) -> t.CInt | t.State: pass
|
||||
|
||||
def PyRun_AnyFile(fp: t.CPtr, filename: t.CConst | str) -> t.CInt | t.State: pass
|
||||
|
||||
def PyRun_String(s: t.CConst | str, start: t.CInt, globs: PyObject | t.CPtr, locs: PyObject | t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
|
||||
def PyRun_File(fp: t.CPtr, filename: t.CConst | str, start: t.CInt, globs: PyObject | t.CPtr, locs: PyObject | t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
|
||||
|
||||
Py_single_input: t.CExtern | t.CInt | t.State
|
||||
Py_file_input: t.CExtern | t.CInt | t.State
|
||||
Py_eval_input: t.CExtern | t.CInt | t.State
|
||||
|
||||
def PyCapsule_New(ptr: t.CPtr, name: t.CConst | str, dtor: t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
|
||||
def PyCapsule_GetPointer(cap: PyObject | t.CPtr, name: t.CConst | str) -> t.CPtr | t.State: pass
|
||||
|
||||
def PyCapsule_GetName(cap: PyObject | t.CPtr) -> str | t.State: pass
|
||||
|
||||
def PyCapsule_IsValid(cap: PyObject | t.CPtr, name: t.CConst | str) -> t.CInt | t.State: pass
|
||||
|
||||
def PyCapsule_SetPointer(cap: PyObject | t.CPtr, ptr: t.CPtr) -> t.CInt | t.State: pass
|
||||
|
||||
def PyCapsule_SetName(cap: PyObject | t.CPtr, name: t.CConst | str) -> t.CInt | t.State: pass
|
||||
|
||||
def PyCapsule_SetDestructor(cap: PyObject | t.CPtr, dtor: t.CPtr) -> t.CInt | t.State: pass
|
||||
|
||||
def PySequence_Check(obj: PyObject | t.CPtr) -> t.CInt | t.State: pass
|
||||
|
||||
def PySequence_Size(obj: PyObject | t.CPtr) -> t.CSizeT | t.State: pass
|
||||
|
||||
def PySequence_Length(obj: PyObject | t.CPtr) -> t.CSizeT | t.State: pass
|
||||
|
||||
def PySequence_Concat(o1: PyObject | t.CPtr, o2: PyObject | t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
|
||||
def PySequence_Repeat(obj: PyObject | t.CPtr, count: t.CSizeT) -> PyObject | t.CPtr | t.State: pass
|
||||
|
||||
def PySequence_GetItem(obj: PyObject | t.CPtr, idx: t.CSizeT) -> PyObject | t.CPtr | t.State: pass
|
||||
|
||||
def PySequence_SetItem(obj: PyObject | t.CPtr, idx: t.CSizeT, val: PyObject | t.CPtr) -> t.CInt | t.State: pass
|
||||
|
||||
def PySequence_DelItem(obj: PyObject | t.CPtr, idx: t.CSizeT) -> t.CInt | t.State: pass
|
||||
|
||||
def PySequence_GetSlice(obj: PyObject | t.CPtr, start: t.CSizeT, end: t.CSizeT) -> PyObject | t.CPtr | t.State: pass
|
||||
|
||||
def PySequence_SetSlice(obj: PyObject | t.CPtr, start: t.CSizeT, end: t.CSizeT, val: PyObject | t.CPtr) -> t.CInt | t.State: pass
|
||||
|
||||
def PySequence_DelSlice(obj: PyObject | t.CPtr, start: t.CSizeT, end: t.CSizeT) -> t.CInt | t.State: pass
|
||||
|
||||
def PySequence_Contains(obj: PyObject | t.CPtr, val: PyObject | t.CPtr) -> t.CInt | t.State: pass
|
||||
|
||||
def PySequence_Index(obj: PyObject | t.CPtr, val: PyObject | t.CPtr) -> t.CSizeT | t.State: pass
|
||||
|
||||
def PySequence_Count(obj: PyObject | t.CPtr, val: PyObject | t.CPtr) -> t.CSizeT | t.State: pass
|
||||
|
||||
def PySequence_List(obj: PyObject | t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
|
||||
def PySequence_Tuple(obj: PyObject | t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
|
||||
def PyMapping_Check(obj: PyObject | t.CPtr) -> t.CInt | t.State: pass
|
||||
|
||||
def PyMapping_Size(obj: PyObject | t.CPtr) -> t.CSizeT | t.State: pass
|
||||
|
||||
def PyMapping_Length(obj: PyObject | t.CPtr) -> t.CSizeT | t.State: pass
|
||||
|
||||
def PyMapping_HasKey(obj: PyObject | t.CPtr, key: PyObject | t.CPtr) -> t.CInt | t.State: pass
|
||||
|
||||
def PyMapping_HasKeyString(obj: PyObject | t.CPtr, key: t.CConst | str) -> t.CInt | t.State: pass
|
||||
|
||||
def PyMapping_GetItemString(obj: PyObject | t.CPtr, key: t.CConst | str) -> PyObject | t.CPtr | t.State: pass
|
||||
|
||||
def PyMapping_SetItemString(obj: PyObject | t.CPtr, key: t.CConst | str, val: PyObject | t.CPtr) -> t.CInt | t.State: pass
|
||||
|
||||
def PyMapping_Keys(obj: PyObject | t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
|
||||
def PyMapping_Values(obj: PyObject | t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
|
||||
def PyMapping_Items(obj: PyObject | t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
|
||||
def PyNumber_Add(o1: PyObject | t.CPtr, o2: PyObject | t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
|
||||
def PyNumber_Subtract(o1: PyObject | t.CPtr, o2: PyObject | t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
|
||||
def PyNumber_Multiply(o1: PyObject | t.CPtr, o2: PyObject | t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
|
||||
def PyNumber_MatrixMultiply(o1: PyObject | t.CPtr, o2: PyObject | t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
|
||||
def PyNumber_FloorDivide(o1: PyObject | t.CPtr, o2: PyObject | t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
|
||||
def PyNumber_TrueDivide(o1: PyObject | t.CPtr, o2: PyObject | t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
|
||||
def PyNumber_Modulo(o1: PyObject | t.CPtr, o2: PyObject | t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
|
||||
def PyNumber_Power(o1: PyObject | t.CPtr, o2: PyObject | t.CPtr, o3: PyObject | t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
|
||||
def PyNumber_Negative(obj: PyObject | t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
|
||||
def PyNumber_Positive(obj: PyObject | t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
|
||||
def PyNumber_Absolute(obj: PyObject | t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
|
||||
def PyNumber_Invert(obj: PyObject | t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
|
||||
def PyNumber_Lshift(o1: PyObject | t.CPtr, o2: PyObject | t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
|
||||
def PyNumber_Rshift(o1: PyObject | t.CPtr, o2: PyObject | t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
|
||||
def PyNumber_And(o1: PyObject | t.CPtr, o2: PyObject | t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
|
||||
def PyNumber_Xor(o1: PyObject | t.CPtr, o2: PyObject | t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
|
||||
def PyNumber_Or(o1: PyObject | t.CPtr, o2: PyObject | t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
|
||||
def PyNumber_Index(obj: PyObject | t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
|
||||
def PyNumber_Long(obj: PyObject | t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
|
||||
def PyNumber_Float(obj: PyObject | t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
|
||||
def PyNumber_Check(obj: PyObject | t.CPtr) -> t.CInt | t.State: pass
|
||||
|
||||
def PyWeakref_NewRef(obj: PyObject | t.CPtr, cb: PyObject | t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
|
||||
def PyWeakref_GetObject(ref: PyObject | t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
|
||||
def PyWeakref_Check(obj: PyObject | t.CPtr) -> t.CInt | t.State: pass
|
||||
|
||||
|
||||
class PyGetSetDef:
|
||||
name: t.CConst | str
|
||||
get: t.CPtr
|
||||
set: t.CPtr
|
||||
doc: t.CConst | str
|
||||
closure: t.CPtr
|
||||
class PyMemberDef:
|
||||
name: t.CConst | str
|
||||
type: t.CInt
|
||||
offset: t.CPtrDiffT
|
||||
flags: t.CInt
|
||||
doc: t.CConst | str
|
||||
|
||||
def PySys_GetObject(name: t.CConst | str) -> PyObject | t.CPtr | t.State: pass
|
||||
|
||||
def PySys_SetObject(name: t.CConst | str, val: PyObject | t.CPtr) -> t.CInt | t.State: pass
|
||||
|
||||
def PySys_ResetWarnOptions() -> t.CVoid | t.State: pass
|
||||
|
||||
def PySys_AddWarnOption(s: PyObject | t.CPtr) -> t.CVoid | t.State: pass
|
||||
|
||||
def PySYS_AddXOption(s: PyObject | t.CPtr) -> t.CVoid | t.State: pass
|
||||
|
||||
def PySys_WriteStdout(fmt: t.CConst | str) -> t.CVoid | t.State: pass
|
||||
|
||||
def PySys_WriteStderr(fmt: t.CConst | str) -> t.CVoid | t.State: pass
|
||||
|
||||
def PySys_FormatStdout(fmt: t.CConst | str) -> t.CVoid | t.State: pass
|
||||
|
||||
def PySys_FormatStderr(fmt: t.CConst | str) -> t.CVoid | t.State: pass
|
||||
|
||||
def PyMemoryView_FromObject(obj: PyObject | t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
|
||||
def PyMemoryView_GetContiguous(obj: PyObject | t.CPtr, btype: t.CInt, order: t.CChar) -> PyObject | t.CPtr | t.State: pass
|
||||
|
||||
def PyMemoryView_Check(obj: PyObject | t.CPtr) -> t.CInt | t.State: pass
|
||||
|
||||
def PySet_New(iterable: PyObject | t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
|
||||
def PySet_Add(s: PyObject | t.CPtr, key: PyObject | t.CPtr) -> t.CInt | t.State: pass
|
||||
|
||||
def PySet_Discard(s: PyObject | t.CPtr, key: PyObject | t.CPtr) -> t.CInt | t.State: pass
|
||||
|
||||
def PySet_Contains(s: PyObject | t.CPtr, key: PyObject | t.CPtr) -> t.CInt | t.State: pass
|
||||
|
||||
def PySet_Size(s: PyObject | t.CPtr) -> t.CSizeT | t.State: pass
|
||||
|
||||
def PySet_Clear(s: PyObject | t.CPtr) -> t.CVoid | t.State: pass
|
||||
|
||||
def PySet_Check(obj: PyObject | t.CPtr) -> t.CInt | t.State: pass
|
||||
|
||||
def PyFrozenSet_New(iterable: PyObject | t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
|
||||
def PyFrozenSet_Check(obj: PyObject | t.CPtr) -> t.CInt | t.State: pass
|
||||
|
||||
def PySlice_New(start: PyObject | t.CPtr, stop: PyObject | t.CPtr, step: PyObject | t.CPtr) -> PyObject | t.CPtr | t.State: pass
|
||||
|
||||
def PySlice_GetIndicesEx(sl: PyObject | t.CPtr, length: t.CSizeT, start: t.CSizeT | t.CPtr, stop: t.CSizeT | t.CPtr, step: t.CSizeT | t.CPtr, slicelen: t.CSizeT | t.CPtr) -> t.CInt | t.State: pass
|
||||
|
||||
def PySlice_Unpack(sl: PyObject | t.CPtr, start: t.CPtrDiffT | t.CPtr, stop: t.CPtrDiffT | t.CPtr, step: t.CPtrDiffT | t.CPtr) -> t.CVoid | t.State: pass
|
||||
|
||||
def PySlice_AdjustIndices(length: t.CSizeT, start: t.CPtrDiffT | t.CPtr, stop: t.CPtrDiffT | t.CPtr, step: t.CPtrDiffT) -> t.CSizeT | t.State: pass
|
||||
|
||||
def PySlice_Check(obj: PyObject | t.CPtr) -> t.CInt | t.State: pass
|
||||
|
||||
|
||||
class PyLongObj:
|
||||
ptr: PyObject | t.CPtr
|
||||
def __new__(self: PyLongObj) -> 'PyLongObj' | t.CPtr: pass
|
||||
@staticmethod
|
||||
def from_long(val: t.CLong) -> 'PyLongObj' | t.CPtr: pass
|
||||
def __add__(self: PyLongObj, other: PyLongObj | t.CPtr) -> 'PyLongObj' | t.CPtr: pass
|
||||
def __sub__(self: PyLongObj, other: PyLongObj | t.CPtr) -> 'PyLongObj' | t.CPtr: pass
|
||||
def __mul__(self: PyLongObj, other: PyLongObj | t.CPtr) -> 'PyLongObj' | t.CPtr: pass
|
||||
def __neg__(self: PyLongObj) -> 'PyLongObj' | t.CPtr: pass
|
||||
def to_long(self: PyLongObj) -> t.CLong: pass
|
||||
def __str__(self: PyLongObj) -> PyObject | t.CPtr: pass
|
||||
def dec_ref(self: PyLongObj) -> t.CInt: pass
|
||||
class PyFloatObj:
|
||||
ptr: PyObject | t.CPtr
|
||||
def __new__(self: PyFloatObj) -> 'PyFloatObj' | t.CPtr: pass
|
||||
@staticmethod
|
||||
def from_double(val: t.CDouble) -> 'PyFloatObj' | t.CPtr: pass
|
||||
def __add__(self: PyFloatObj, other: PyFloatObj | t.CPtr) -> 'PyFloatObj' | t.CPtr: pass
|
||||
def __sub__(self: PyFloatObj, other: PyFloatObj | t.CPtr) -> 'PyFloatObj' | t.CPtr: pass
|
||||
def __mul__(self: PyFloatObj, other: PyFloatObj | t.CPtr) -> 'PyFloatObj' | t.CPtr: pass
|
||||
def __truediv__(self: PyFloatObj, other: PyFloatObj | t.CPtr) -> 'PyFloatObj' | t.CPtr: pass
|
||||
def __neg__(self: PyFloatObj) -> 'PyFloatObj' | t.CPtr: pass
|
||||
def to_double(self: PyFloatObj) -> t.CDouble: pass
|
||||
def __str__(self: PyFloatObj) -> PyObject | t.CPtr: pass
|
||||
def dec_ref(self: PyFloatObj) -> t.CInt: pass
|
||||
class PyUnicodeObj:
|
||||
ptr: PyObject | t.CPtr
|
||||
def __new__(self: PyUnicodeObj) -> 'PyUnicodeObj' | t.CPtr: pass
|
||||
@staticmethod
|
||||
def from_string(s: t.CChar | t.CPtr) -> 'PyUnicodeObj' | t.CPtr: pass
|
||||
def __add__(self: PyUnicodeObj, other: PyUnicodeObj | t.CPtr) -> 'PyUnicodeObj' | t.CPtr: pass
|
||||
def __len__(self: PyUnicodeObj) -> t.CPtrDiffT: pass
|
||||
def as_utf8(self: PyUnicodeObj) -> t.CChar | t.CPtr: pass
|
||||
def __str__(self: PyUnicodeObj) -> PyObject | t.CPtr: pass
|
||||
def dec_ref(self: PyUnicodeObj) -> t.CInt: pass
|
||||
class PyListObj:
|
||||
ptr: PyObject | t.CPtr
|
||||
def __new__(self: PyListObj) -> 'PyListObj' | t.CPtr: pass
|
||||
@staticmethod
|
||||
def new() -> 'PyListObj' | t.CPtr: pass
|
||||
def __getitem__(self: PyListObj, idx: t.CSizeT) -> PyObject | t.CPtr: pass
|
||||
def __setitem__(self: PyListObj, idx: t.CSizeT, val: PyObject | t.CPtr) -> t.CInt: pass
|
||||
def __len__(self: PyListObj) -> t.CSizeT: pass
|
||||
def append(self: PyListObj, item: PyObject | t.CPtr) -> t.CInt: pass
|
||||
def dec_ref(self: PyListObj) -> t.CInt: pass
|
||||
class PyDictObj:
|
||||
ptr: PyObject | t.CPtr
|
||||
def __new__(self: PyDictObj) -> 'PyDictObj' | t.CPtr: pass
|
||||
@staticmethod
|
||||
def new() -> 'PyDictObj' | t.CPtr: pass
|
||||
def __getitem__(self: PyDictObj, key: PyObject | t.CPtr) -> PyObject | t.CPtr: pass
|
||||
def __setitem__(self: PyDictObj, key: PyObject | t.CPtr, val: PyObject | t.CPtr) -> t.CInt: pass
|
||||
def __len__(self: PyDictObj) -> t.CSizeT: pass
|
||||
def get_string(self: PyDictObj, key: t.CChar | t.CPtr) -> PyObject | t.CPtr: pass
|
||||
def set_string(self: PyDictObj, key: t.CChar | t.CPtr, val: PyObject | t.CPtr) -> t.CInt: pass
|
||||
def dec_ref(self: PyDictObj) -> t.CInt: pass
|
||||
100
Test/CPythonTest/temp/7e529fe7a078cfef.pyi
Normal file
100
Test/CPythonTest/temp/7e529fe7a078cfef.pyi
Normal file
@@ -0,0 +1,100 @@
|
||||
"""
|
||||
Auto-generated Python stub file from w32.win32base.py
|
||||
Module: w32.win32base
|
||||
"""
|
||||
|
||||
import c
|
||||
|
||||
|
||||
import t
|
||||
from stdint import *
|
||||
|
||||
HANDLE: t.CTypedef = VOIDPTR
|
||||
LPCSTR: t.CTypedef = t.CConst | t.CChar | t.CPtr
|
||||
LPCWSTR: t.CTypedef = t.CConst | t.CUnsignedShort | t.CPtr
|
||||
INVALID_HANDLE_VALUE: t.CDefine = t.CVoid(-1)
|
||||
NULL: t.CDefine = 0
|
||||
TRUE: t.CDefine = 1
|
||||
FALSE: t.CDefine = 0
|
||||
INFINITE: t.CDefine = 0xFFFFFFFF
|
||||
WAIT_FAILED: t.CDefine = 0xFFFFFFFF
|
||||
WAIT_OBJECT_0: t.CDefine = 0
|
||||
WAIT_TIMEOUT: t.CDefine = 258
|
||||
WAIT_ABANDONED: t.CDefine = 0x80
|
||||
MAX_PATH: t.CDefine = 260
|
||||
ERROR_SUCCESS: t.CDefine = 0
|
||||
ERROR_FILE_NOT_FOUND: t.CDefine = 2
|
||||
ERROR_ACCESS_DENIED: t.CDefine = 5
|
||||
ERROR_INSUFFICIENT_BUFFER: t.CDefine = 122
|
||||
|
||||
class SECURITY_ATTRIBUTES:
|
||||
nLength: ULONG
|
||||
lpSecurityDescriptor: VOIDPTR
|
||||
bInheritHandle: BOOL
|
||||
class OVERLAPPED:
|
||||
Internal: ULONGLONG
|
||||
InternalHigh: ULONGLONG
|
||||
Offset: ULONG
|
||||
OffsetHigh: ULONG
|
||||
hEvent: HANDLE
|
||||
class FILETIME:
|
||||
dwLowDateTime: DWORD
|
||||
dwHighDateTime: DWORD
|
||||
class SYSTEMTIME:
|
||||
wYear: WORD
|
||||
wMonth: WORD
|
||||
wDayOfWeek: WORD
|
||||
wDay: WORD
|
||||
wHour: WORD
|
||||
wMinute: WORD
|
||||
wSecond: WORD
|
||||
wMilliseconds: WORD
|
||||
class GUID:
|
||||
Data1: DWORD
|
||||
Data2: WORD
|
||||
Data3: WORD
|
||||
Data4: BYTEPTR
|
||||
class LARGE_INTEGER:
|
||||
QuadPart: LONGLONG
|
||||
class ULARGE_INTEGER:
|
||||
QuadPart: ULONGLONG
|
||||
|
||||
def GetLastError() -> ULONG | t.State: pass
|
||||
|
||||
def SetLastError(dwErrCode: ULONG) -> t.State: pass
|
||||
|
||||
def CloseHandle(hObject: HANDLE) -> BOOL | t.State: pass
|
||||
|
||||
def GetProcAddress(hModule: HANDLE, lpProcName: LPCSTR) -> VOIDPTR | t.State: pass
|
||||
|
||||
def GetModuleHandleA(lpModuleName: LPCSTR) -> HANDLE | t.State: pass
|
||||
|
||||
def GetModuleHandleW(lpModuleName: LPCWSTR) -> HANDLE | t.State: pass
|
||||
|
||||
def LoadLibraryA(lpLibFileName: LPCSTR) -> HANDLE | t.State: pass
|
||||
|
||||
def LoadLibraryW(lpLibFileName: LPCWSTR) -> HANDLE | t.State: pass
|
||||
|
||||
def FreeLibrary(hLibModule: HANDLE) -> BOOL | t.State: pass
|
||||
|
||||
def GetSystemTime(lpSystemTime: SYSTEMTIME | t.CPtr) -> t.State: pass
|
||||
|
||||
def GetLocalTime(lpSystemTime: SYSTEMTIME | t.CPtr) -> t.State: pass
|
||||
|
||||
def FileTimeToSystemTime(lpFileTime: FILETIME | t.CPtr, lpSystemTime: SYSTEMTIME | t.CPtr) -> BOOL | t.State: pass
|
||||
|
||||
def SystemTimeToFileTime(lpSystemTime: SYSTEMTIME | t.CPtr, lpFileTime: FILETIME | t.CPtr) -> BOOL | t.State: pass
|
||||
|
||||
def QueryPerformanceCounter(lpPerformanceCount: LARGE_INTEGER | t.CPtr) -> BOOL | t.State: pass
|
||||
|
||||
def QueryPerformanceFrequency(lpFrequency: LARGE_INTEGER | t.CPtr) -> BOOL | t.State: pass
|
||||
|
||||
def Sleep(dwMilliseconds: ULONG) -> t.State: pass
|
||||
|
||||
def SleepEx(dwMilliseconds: ULONG, bAlertable: BOOL) -> ULONG | t.State: pass
|
||||
|
||||
def GetTickCount() -> ULONG | t.State: pass
|
||||
|
||||
def GetTickCount64() -> ULONGLONG | t.State: pass
|
||||
|
||||
def GetCommandLineA() -> CHARPTR | t.State: pass
|
||||
1
Test/CPythonTest/temp/_phase1_manifest.json
Normal file
1
Test/CPythonTest/temp/_phase1_manifest.json
Normal file
@@ -0,0 +1 @@
|
||||
{"D:\\Users\\TermiNexus\\Desktop\\TransPyC\\Test\\CPythonTest\\App\\cpython.py": {"sha1": "7c5d5ec59c5fb0a8", "mtime": 1781613876.1585274, "size": 39169}, "D:\\Users\\TermiNexus\\Desktop\\TransPyC\\Test\\CPythonTest\\App\\main.py": {"sha1": "fb6cea4f70fade7a", "mtime": 1782403889.06048, "size": 13919}, "D:\\Users\\TermiNexus\\Desktop\\TransPyC\\includes\\stdint.py": {"sha1": "f5522571bcce7bcb", "mtime": 1782383975.8824987, "size": 4356}, "D:\\Users\\TermiNexus\\Desktop\\TransPyC\\includes\\stdio.py": {"sha1": "6f62fe05c5ea1ceb", "mtime": 1783239556.0959673, "size": 714}, "D:\\Users\\TermiNexus\\Desktop\\TransPyC\\includes\\testcheck.py": {"sha1": "dd3002730623424b", "mtime": 1783927513.1159866, "size": 1818}, "D:\\Users\\TermiNexus\\Desktop\\TransPyC\\includes\\w32\\win32base.py": {"sha1": "7e529fe7a078cfef", "mtime": 1782488356.7736557, "size": 2662}, "D:\\Users\\TermiNexus\\Desktop\\TransPyC\\includes\\w32\\win32console.py": {"sha1": "bbdf3bbd4c3bc28c", "mtime": 1781200703.5338137, "size": 5604}}
|
||||
7
Test/CPythonTest/temp/_sha1_map.txt
Normal file
7
Test/CPythonTest/temp/_sha1_map.txt
Normal file
@@ -0,0 +1,7 @@
|
||||
6f62fe05c5ea1ceb:includes/stdio.py
|
||||
7c5d5ec59c5fb0a8:cpython.py
|
||||
7e529fe7a078cfef:includes/w32\win32base.py
|
||||
bbdf3bbd4c3bc28c:includes/w32\win32console.py
|
||||
dd3002730623424b:includes/testcheck.py
|
||||
f5522571bcce7bcb:includes/stdint.py
|
||||
fb6cea4f70fade7a:main.py
|
||||
BIN
Test/CPythonTest/temp/_shared_sym.json
Normal file
BIN
Test/CPythonTest/temp/_shared_sym.json
Normal file
Binary file not shown.
138
Test/CPythonTest/temp/bbdf3bbd4c3bc28c.pyi
Normal file
138
Test/CPythonTest/temp/bbdf3bbd4c3bc28c.pyi
Normal file
@@ -0,0 +1,138 @@
|
||||
"""
|
||||
Auto-generated Python stub file from w32.win32console.py
|
||||
Module: w32.win32console
|
||||
"""
|
||||
|
||||
import c
|
||||
|
||||
|
||||
import t
|
||||
from stdint import *
|
||||
from w32.win32base import *
|
||||
|
||||
ENABLE_PROCESSED_INPUT: t.CDefine = 0x0001
|
||||
ENABLE_LINE_INPUT: t.CDefine = 0x0002
|
||||
ENABLE_ECHO_INPUT: t.CDefine = 0x0004
|
||||
ENABLE_WINDOW_INPUT: t.CDefine = 0x0008
|
||||
ENABLE_MOUSE_INPUT: t.CDefine = 0x0010
|
||||
ENABLE_INSERT_MODE: t.CDefine = 0x0020
|
||||
ENABLE_QUICK_EDIT_MODE: t.CDefine = 0x0040
|
||||
ENABLE_EXTENDED_FLAGS: t.CDefine = 0x0080
|
||||
ENABLE_PROCESSED_OUTPUT: t.CDefine = 0x0001
|
||||
ENABLE_WRAP_AT_EOL_OUTPUT: t.CDefine = 0x0002
|
||||
ENABLE_VIRTUAL_TERMINAL_PROCESSING: t.CDefine = 0x0004
|
||||
DISABLE_NEWLINE_AUTO_RETURN: t.CDefine = 0x0008
|
||||
ENABLE_LVB_GRID_WORLDWIDE: t.CDefine = 0x0010
|
||||
FOREGROUND_BLUE: t.CDefine = 0x0001
|
||||
FOREGROUND_GREEN: t.CDefine = 0x0002
|
||||
FOREGROUND_RED: t.CDefine = 0x0004
|
||||
FOREGROUND_INTENSITY: t.CDefine = 0x0008
|
||||
BACKGROUND_BLUE: t.CDefine = 0x0010
|
||||
BACKGROUND_GREEN: t.CDefine = 0x0020
|
||||
BACKGROUND_RED: t.CDefine = 0x0040
|
||||
BACKGROUND_INTENSITY: t.CDefine = 0x0080
|
||||
KEY_EVENT: t.CDefine = 0x0001
|
||||
MOUSE_EVENT: t.CDefine = 0x0002
|
||||
WINDOW_BUFFER_SIZE_EVENT: t.CDefine = 0x0004
|
||||
MENU_EVENT: t.CDefine = 0x0008
|
||||
FOCUS_EVENT: t.CDefine = 0x0010
|
||||
|
||||
class COORD:
|
||||
X: SHORT
|
||||
Y: SHORT
|
||||
class SMALL_RECT:
|
||||
Left: SHORT
|
||||
Top: SHORT
|
||||
Right: SHORT
|
||||
Bottom: SHORT
|
||||
class CONSOLE_SCREEN_BUFFER_INFO:
|
||||
dwSize: COORD
|
||||
dwCursorPosition: COORD
|
||||
wAttributes: WORD
|
||||
srWindow: SMALL_RECT
|
||||
dwMaximumWindowSize: COORD
|
||||
class CONSOLE_CURSOR_INFO:
|
||||
dwSize: ULONG
|
||||
bVisible: BOOL
|
||||
class CHAR_INFO:
|
||||
UnicodeChar: WCHAR
|
||||
Attributes: WORD
|
||||
class KEY_EVENT_RECORD:
|
||||
bKeyDown: BOOL
|
||||
wRepeatCount: WORD
|
||||
wVirtualKeyCode: WORD
|
||||
wVirtualScanCode: WORD
|
||||
uChar: WCHAR
|
||||
dwControlKeyState: ULONG
|
||||
class MOUSE_EVENT_RECORD:
|
||||
dwMousePosition: COORD
|
||||
dwButtonState: ULONG
|
||||
dwControlKeyState: ULONG
|
||||
dwEventFlags: ULONG
|
||||
class WINDOW_BUFFER_SIZE_RECORD:
|
||||
dwSize: COORD
|
||||
class INPUT_RECORD:
|
||||
EventType: WORD
|
||||
Event: KEY_EVENT_RECORD
|
||||
|
||||
def SetConsoleOutputCP(codepage: UINT) -> BOOL | t.State: pass
|
||||
|
||||
def SetConsoleCP(codepage: UINT) -> BOOL | t.State: pass
|
||||
|
||||
def GetConsoleCP() -> UINT | t.State: pass
|
||||
|
||||
def GetConsoleOutputCP() -> UINT | t.State: pass
|
||||
|
||||
def GetConsoleScreenBufferInfo(hConsoleOutput: HANDLE, lpConsoleScreenBufferInfo: CONSOLE_SCREEN_BUFFER_INFO | t.CPtr) -> BOOL | t.State: pass
|
||||
|
||||
def SetConsoleScreenBufferSize(hConsoleOutput: HANDLE, dwSize: COORD) -> BOOL | t.State: pass
|
||||
|
||||
def SetConsoleCursorPosition(hConsoleOutput: HANDLE, dwCursorPosition: COORD) -> BOOL | t.State: pass
|
||||
|
||||
def GetConsoleCursorInfo(hConsoleOutput: HANDLE, lpConsoleCursorInfo: CONSOLE_CURSOR_INFO | t.CPtr) -> BOOL | t.State: pass
|
||||
|
||||
def SetConsoleCursorInfo(hConsoleOutput: HANDLE, lpConsoleCursorInfo: CONSOLE_CURSOR_INFO | t.CPtr) -> BOOL | t.State: pass
|
||||
|
||||
def SetConsoleTextAttribute(hConsoleOutput: HANDLE, wAttributes: WORD) -> BOOL | t.State: pass
|
||||
|
||||
def FillConsoleOutputCharacterA(hConsoleOutput: HANDLE, cCharacter: t.CChar, nLength: ULONG, dwWriteCoord: COORD, lpNumberOfCharsWritten: ULONG | t.CPtr) -> BOOL | t.State: pass
|
||||
|
||||
def FillConsoleOutputCharacterW(hConsoleOutput: HANDLE, cCharacter: WCHAR, nLength: ULONG, dwWriteCoord: COORD, lpNumberOfCharsWritten: ULONG | t.CPtr) -> BOOL | t.State: pass
|
||||
|
||||
def FillConsoleOutputAttribute(hConsoleOutput: HANDLE, wAttribute: WORD, nLength: ULONG, dwWriteCoord: COORD, lpNumberOfAttrsWritten: ULONG | t.CPtr) -> BOOL | t.State: pass
|
||||
|
||||
def WriteConsoleA(hConsoleOutput: HANDLE, lpBuffer: t.CConst | VOIDPTR, nNumberOfCharsToWrite: ULONG, lpNumberOfCharsWritten: ULONG | t.CPtr, lpReserved: VOIDPTR) -> BOOL | t.State: pass
|
||||
|
||||
def WriteConsoleW(hConsoleOutput: HANDLE, lpBuffer: t.CConst | VOIDPTR, nNumberOfCharsToWrite: ULONG, lpNumberOfCharsWritten: ULONG | t.CPtr, lpReserved: VOIDPTR) -> BOOL | t.State: pass
|
||||
|
||||
def ReadConsoleA(hConsoleInput: HANDLE, lpBuffer: VOIDPTR, nNumberOfCharsToRead: ULONG, lpNumberOfCharsRead: ULONG | t.CPtr, pInputControl: VOIDPTR) -> BOOL | t.State: pass
|
||||
|
||||
def ReadConsoleW(hConsoleInput: HANDLE, lpBuffer: VOIDPTR, nNumberOfCharsToRead: ULONG, lpNumberOfCharsRead: ULONG | t.CPtr, pInputControl: VOIDPTR) -> BOOL | t.State: pass
|
||||
|
||||
def GetConsoleMode(hConsoleHandle: HANDLE, lpMode: ULONG | t.CPtr) -> BOOL | t.State: pass
|
||||
|
||||
def SetConsoleMode(hConsoleHandle: HANDLE, dwMode: ULONG) -> BOOL | t.State: pass
|
||||
|
||||
def ReadConsoleInputA(hConsoleInput: HANDLE, lpBuffer: INPUT_RECORD | t.CPtr, nLength: ULONG, lpNumberOfEventsRead: ULONG | t.CPtr) -> BOOL | t.State: pass
|
||||
|
||||
def ReadConsoleInputW(hConsoleInput: HANDLE, lpBuffer: INPUT_RECORD | t.CPtr, nLength: ULONG, lpNumberOfEventsRead: ULONG | t.CPtr) -> BOOL | t.State: pass
|
||||
|
||||
def GetNumberOfConsoleInputEvents(hConsoleInput: HANDLE, lpNumberOfEvents: ULONG | t.CPtr) -> BOOL | t.State: pass
|
||||
|
||||
def FlushConsoleInputBuffer(hConsoleInput: HANDLE) -> BOOL | t.State: pass
|
||||
|
||||
def SetConsoleTitleA(lpConsoleTitle: LPCSTR) -> BOOL | t.State: pass
|
||||
|
||||
def SetConsoleTitleW(lpConsoleTitle: LPCWSTR) -> BOOL | t.State: pass
|
||||
|
||||
def GetConsoleTitleA(lpConsoleTitle: CHARPTR, nSize: ULONG) -> ULONG | t.State: pass
|
||||
|
||||
def GetConsoleTitleW(lpConsoleTitle: WCHARPTR, nSize: ULONG) -> ULONG | t.State: pass
|
||||
|
||||
def AllocConsole() -> BOOL | t.State: pass
|
||||
|
||||
def FreeConsole() -> BOOL | t.State: pass
|
||||
|
||||
def SetConsoleWindowInfo(hConsoleOutput: HANDLE, bAbsolute: BOOL, lpConsoleWindow: SMALL_RECT | t.CPtr) -> BOOL | t.State: pass
|
||||
|
||||
def ScrollConsoleScreenBufferA(hConsoleOutput: HANDLE, lpScrollRectangle: SMALL_RECT | t.CPtr, lpClipRectangle: SMALL_RECT | t.CPtr, dwDestinationOrigin: COORD, lpFill: CHAR_INFO | t.CPtr) -> BOOL | t.State: pass
|
||||
31
Test/CPythonTest/temp/dd3002730623424b.pyi
Normal file
31
Test/CPythonTest/temp/dd3002730623424b.pyi
Normal file
@@ -0,0 +1,31 @@
|
||||
"""
|
||||
Auto-generated Python stub file from testcheck.py
|
||||
Module: testcheck
|
||||
"""
|
||||
|
||||
|
||||
import t, c
|
||||
import stdio
|
||||
from w32.win32console import SetConsoleOutputCP, SetConsoleCP
|
||||
|
||||
CP_UTF8: t.CDefine = 65001
|
||||
_pass_count: t.CExtern | t.CInt
|
||||
_fail_count: t.CExtern | t.CInt
|
||||
_total_pass: t.CExtern | t.CInt
|
||||
_total_fail: t.CExtern | t.CInt
|
||||
|
||||
def begin(name: str) -> t.CInt: pass
|
||||
|
||||
def section(name: str) -> t.CInt: pass
|
||||
|
||||
def ok(msg: str) -> t.CInt: pass
|
||||
|
||||
def fail(msg: str) -> t.CInt: pass
|
||||
|
||||
def check(cond: t.CInt, ok_msg: str, fail_msg: str) -> t.CInt: pass
|
||||
|
||||
def info(msg: str) -> t.CInt: pass
|
||||
|
||||
def end() -> t.CInt: pass
|
||||
|
||||
def summary() -> t.CInt: pass
|
||||
100
Test/CPythonTest/temp/f5522571bcce7bcb.pyi
Normal file
100
Test/CPythonTest/temp/f5522571bcce7bcb.pyi
Normal file
@@ -0,0 +1,100 @@
|
||||
"""
|
||||
Auto-generated Python stub file from stdint.py
|
||||
Module: stdint
|
||||
"""
|
||||
|
||||
import c
|
||||
|
||||
|
||||
import t
|
||||
|
||||
INT: t.CTypedef = t.CInt
|
||||
INTPTR: t.CTypedef = t.CInt | t.CPtr
|
||||
BOOL: t.CTypedef = t.CInt
|
||||
UINT: t.CTypedef = t.CUnsignedInt
|
||||
UINTPTR: t.CTypedef = UINT | t.CPtr
|
||||
BYTE: t.CTypedef = t.CUnsignedChar
|
||||
BYTEPTR: t.CTypedef = BYTE | t.CPtr
|
||||
WORD: t.CTypedef = t.CUInt16T
|
||||
DWORD: t.CTypedef = t.CUInt32T
|
||||
QWORD: t.CTypedef = t.CUInt64T
|
||||
TCHAR: t.CTypedef = t.CChar
|
||||
CHARLIST: t.CTypedef = str | t.CPtr
|
||||
VOID: t.CTypedef = t.CVoid
|
||||
SHORT: t.CTypedef = t.CShort
|
||||
SHORTPTR: t.CTypedef = t.CShort | t.CPtr
|
||||
USHORT: t.CTypedef = t.CUnsignedShort
|
||||
USHORTPTR: t.CTypedef = t.CUnsignedShort | t.CPtr
|
||||
LONGLONG: t.CTypedef = t.CLongLong
|
||||
ULONGLONG: t.CTypedef = t.CUnsignedLongLong
|
||||
LONG: t.CTypedef = t.CLong
|
||||
ULONG: t.CTypedef = t.CUnsignedLong
|
||||
WCHAR: t.CTypedef = WORD
|
||||
WCHARPTR: t.CTypedef = WORD | t.CPtr
|
||||
CHARPTR: t.CTypedef = t.CChar | t.CPtr
|
||||
FSIZE_t: t.CTypedef = DWORD
|
||||
LBA_t: t.CTypedef = DWORD
|
||||
VOIDPTR: t.CTypedef = t.CVoid | t.CPtr
|
||||
FLOAT: t.CTypedef = t.CFloat
|
||||
DOUBLE: t.CTypedef = t.CDouble
|
||||
FLOAT8: t.CTypedef = t.CFloat8T
|
||||
FLOAT16: t.CTypedef = t.CFloat16T
|
||||
FLOAT32: t.CTypedef = t.CFloat32T
|
||||
FLOAT64: t.CTypedef = t.CFloat64T
|
||||
FLOAT128: t.CTypedef = t.CFloat128T
|
||||
INT8: t.CTypedef = t.CInt8T
|
||||
INT16: t.CTypedef = t.CInt16T
|
||||
INT32: t.CTypedef = t.CInt32T
|
||||
INT64: t.CTypedef = t.CInt64T
|
||||
UINT8: t.CTypedef = t.CUInt8T
|
||||
UINT16: t.CTypedef = t.CUInt16T
|
||||
UINT32: t.CTypedef = t.CUInt32T
|
||||
UINT64: t.CTypedef = t.CUInt64T
|
||||
INT8PTR: t.CTypedef = t.CInt8T | t.CPtr
|
||||
INT16PTR: t.CTypedef = t.CInt16T | t.CPtr
|
||||
INT32PTR: t.CTypedef = t.CInt32T | t.CPtr
|
||||
INT64PTR: t.CTypedef = t.CInt64T | t.CPtr
|
||||
UINT8PTR: t.CTypedef = t.CUInt8T | t.CPtr
|
||||
UINT16PTR: t.CTypedef = t.CUInt16T | t.CPtr
|
||||
UINT32PTR: t.CTypedef = t.CUInt32T | t.CPtr
|
||||
UINT64PTR: t.CTypedef = t.CUInt64T | t.CPtr
|
||||
CHAR8: t.CTypedef = t.CChar8T
|
||||
CHAR16: t.CTypedef = t.CChar16T
|
||||
CHAR32: t.CTypedef = t.CChar32T
|
||||
CHAR8PTR: t.CTypedef = t.CChar8T | t.CPtr
|
||||
CHAR16PTR: t.CTypedef = t.CChar16T | t.CPtr
|
||||
CHAR32PTR: t.CTypedef = t.CChar32T | t.CPtr
|
||||
i8: t.CTypedef = t.CInt8T
|
||||
i16: t.CTypedef = t.CInt16T
|
||||
i32: t.CTypedef = t.CInt32T
|
||||
i64: t.CTypedef = t.CInt64T
|
||||
u8: t.CTypedef = t.CUInt8T
|
||||
u16: t.CTypedef = t.CUInt16T
|
||||
u32: t.CTypedef = t.CUInt32T
|
||||
u64: t.CTypedef = t.CUInt64T
|
||||
SIZE_T: t.CTypedef = t.CSizeT
|
||||
SSIZE_T: t.CTypedef = t.CPtrDiffT
|
||||
PTRDIFF_T: t.CTypedef = t.CPtrDiffT
|
||||
int8_t: t.CTypedef = t.CInt8T
|
||||
int16_t: t.CTypedef = t.CInt16T
|
||||
int32_t: t.CTypedef = t.CInt32T
|
||||
int64_t: t.CTypedef = t.CInt64T
|
||||
uint8_t: t.CTypedef = t.CUInt8T
|
||||
uint16_t: t.CTypedef = t.CUInt16T
|
||||
uint32_t: t.CTypedef = t.CUInt32T
|
||||
uint64_t: t.CTypedef = t.CUInt64T
|
||||
size_t: t.CTypedef = t.CSizeT
|
||||
ssize_t: t.CTypedef = t.CPtrDiffT
|
||||
ptrdiff_t: t.CTypedef = t.CPtrDiffT
|
||||
intptr_t: t.CTypedef = t.CIntPtrT
|
||||
uintptr_t: t.CTypedef = t.CUIntPtrT
|
||||
wchar_t: t.CTypedef = t.CWCharT
|
||||
char8_t: t.CTypedef = t.CChar8T
|
||||
char16_t: t.CTypedef = t.CChar16T
|
||||
char32_t: t.CTypedef = t.CChar32T
|
||||
float8_t: t.CTypedef = t.CFloat8T
|
||||
float16_t: t.CTypedef = t.CFloat16T
|
||||
float32_t: t.CTypedef = t.CFloat32T
|
||||
float64_t: t.CTypedef = t.CFloat64T
|
||||
float128_t: t.CTypedef = t.CFloat128T
|
||||
_Bool: t.CTypedef = t.CBool
|
||||
1
Test/CPythonTest/temp/fb6cea4f70fade7a.doc.json
Normal file
1
Test/CPythonTest/temp/fb6cea4f70fade7a.doc.json
Normal file
@@ -0,0 +1 @@
|
||||
{}
|
||||
29
Test/CPythonTest/temp/fb6cea4f70fade7a.pyi
Normal file
29
Test/CPythonTest/temp/fb6cea4f70fade7a.pyi
Normal file
@@ -0,0 +1,29 @@
|
||||
"""
|
||||
Auto-generated Python stub file from main.py
|
||||
Module: main
|
||||
"""
|
||||
|
||||
|
||||
import t, c
|
||||
from t import CInt, CLong, CDouble, CPtr, CSizeT
|
||||
from stdio import printf
|
||||
import cpython
|
||||
import testcheck
|
||||
|
||||
def test_init_finalize() -> t.CInt: pass
|
||||
|
||||
def test_long_operations() -> t.CInt: pass
|
||||
|
||||
def test_string_operations() -> t.CInt: pass
|
||||
|
||||
def test_list_operations() -> t.CInt: pass
|
||||
|
||||
def test_dict_operations() -> t.CInt: pass
|
||||
|
||||
def test_pyrun_string() -> t.CInt: pass
|
||||
|
||||
def test_import_module() -> t.CInt: pass
|
||||
|
||||
def test_operator_overload() -> t.CInt: pass
|
||||
|
||||
def main() -> CInt | t.CExport: pass
|
||||
Reference in New Issue
Block a user