MCPcopy Create free account
hub / github.com/rabbitstack/fibratus / PyArgsParseKeywords

Function PyArgsParseKeywords

pkg/filament/cpython/object.go:120–146  ·  view source on GitHub ↗

PyArgsParseKeywords parses tuple and keywords arguments.

(args PyArgs, kwargs PyKwargs, kwlist []string)

Source from the content-addressed store, hash-verified

118
119// PyArgsParseKeywords parses tuple and keywords arguments.
120func PyArgsParseKeywords(args PyArgs, kwargs PyKwargs, kwlist []string) (string, string, string, []string) {
121 var (
122 ob1 *C.PyObject
123 ob2 *C.PyObject
124 ob3 *C.PyObject
125 ob4 *C.PyObject
126 )
127
128 klist := make([]*C.char, len(kwlist)+1)
129
130 for i, k := range kwlist {
131 klist[i] = C.CString(k)
132 defer C.free(unsafe.Pointer(klist[i]))
133 }
134
135 C.PyArg_ParseKeywords(
136 (*C.PyObject)(unsafe.Pointer(args)),
137 (*C.PyObject)(unsafe.Pointer(kwargs)),
138 &klist[0],
139 (**C.PyObject)(unsafe.Pointer(&ob1)),
140 (**C.PyObject)(unsafe.Pointer(&ob2)),
141 (**C.PyObject)(unsafe.Pointer(&ob3)),
142 (**C.PyObject)(unsafe.Pointer(&ob4)),
143 )
144
145 return fromRawOb(ob1).String(), fromRawOb(ob2).String(), fromRawOb(ob3).String(), fromRawOb(ob4).StringSlice()
146}
147
148// PyObject is the main abstraction for manipulating the native CPython objects.
149type PyObject struct {

Callers 1

emitAlertFnMethod · 0.92

Calls 3

fromRawObFunction · 0.85
StringSliceMethod · 0.80
StringMethod · 0.65

Tested by

no test coverage detected