cl: TestPython; build: PkgLinkExtern

This commit is contained in:
xushiwei
2024-05-12 13:05:15 +08:00
parent 2e3cc49782
commit acecbf587d
9 changed files with 38 additions and 62 deletions

View File

@@ -22,18 +22,13 @@ import (
"github.com/goplus/llgo/c"
)
// Module represents a Python module object.
type Module struct {
Object
}
// -----------------------------------------------------------------------------
// This is a wrapper around py.Import which takes a const char* as an argument
// instead of an Object.
//
//go:linkname ImportModule C.PyImport_ImportModule
func ImportModule(name *c.Char) *Module
func ImportModule(name *c.Char) *Object
// This is a higher-level interface that calls the current “import hook function” (with
// an explicit level of 0, meaning absolute import). It invokes the __import__() function
@@ -43,7 +38,7 @@ func ImportModule(name *c.Char) *Module
// This function always uses absolute imports.
//
//go:linkname Import C.PyImport_Import
func Import(name *Object) *Module
func Import(name *Object) *Object
// Return the dictionary object that implements modules namespace; this object is the same
// as the __dict__ attribute of the module object. If module is not a module object (or a
@@ -52,7 +47,7 @@ func Import(name *Object) *Module
// It is recommended extensions use other Module and Object functions rather than directly
// manipulate a modules __dict__.
//
// llgo:link (*Module).GetDict C.PyModule_GetDict
func (m *Module) GetDict() *Object { return nil }
// llgo:link (*Object).ModuleGetDict C.PyModule_GetDict
func (m *Object) ModuleGetDict() *Object { return nil }
// -----------------------------------------------------------------------------