This commit is contained in:
xushiwei
2024-05-12 11:11:19 +08:00
parent 64c13fa9ae
commit 0912f1f509
13 changed files with 140 additions and 41 deletions

View File

@@ -79,6 +79,10 @@ func Gen(pkgPath, inFile string, src any) string {
ret, err := cl.NewPackage(prog, ssaPkg, files)
check(err)
if prog.NeedPyInit() { // call PyInit if needed
ret.PyInit()
}
return ret.String()
}

View File

@@ -82,6 +82,10 @@ func GenFrom(fileOrPkg string) string {
ret, err := cl.NewPackage(prog, ssaPkg, pkg.Syntax)
check(err)
if prog.NeedPyInit() { // call PyInit if needed
ret.PyInit()
}
return ret.String()
}