示例#1
0
文件: module.go 项目: MogeiWang/py
func (mod *Module) Filename() (string, error) {
	ret := C.PyModule_GetFilename(mod.c())
	if ret == nil {
		return "", exception()
	}
	return C.GoString(ret), nil
}
示例#2
0
// char* PyModule_GetFilename(PyObject *module)
// Return the name of the file from which module was loaded using module‘s __file__ attribute. If this is not defined, or if it is not a string, raise SystemError and return NULL.
func PyModule_GetFilename(self *PyObject) string {
	c_name := C.PyModule_GetFilename(topy(self))
	// we do not own c_name...
	return C.GoString(c_name)
}