MCPcopy Index your code
hub / github.com/go-python/gopy / isPyCompatType

Function isPyCompatType

bind/symbols.go:116–130  ·  view source on GitHub ↗

isPyCompatType checks if type is compatible with python

(typ types.Type)

Source from the content-addressed store, hash-verified

114
115// isPyCompatType checks if type is compatible with python
116func isPyCompatType(typ types.Type) error {
117 typ = typ.Underlying()
118 if ptyp, isPtr := typ.(*types.Pointer); isPtr {
119 if _, isBasic := ptyp.Elem().(*types.Basic); isBasic {
120 return fmt.Errorf("gopy: type is pointer to basic type")
121 }
122 }
123 if isErrorType(typ) {
124 return fmt.Errorf("gopy: type is error type")
125 }
126 if _, isChan := typ.(*types.Chan); isChan {
127 return fmt.Errorf("gopy: type is channel type")
128 }
129 return nil
130}
131
132// isPyCompatField checks if field is compatible with python
133func isPyCompatField(f *types.Var) (*symbol, error) {

Callers 1

isPyCompatFuncFunction · 0.85

Calls 1

isErrorTypeFunction · 0.85

Tested by

no test coverage detected