Skip to content

Commit 405231c

Browse files
committed
py: func KwargsToDict
1 parent 186aaac commit 405231c

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

py/call.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,4 +122,14 @@ func (o *Object) VectorcallMethod(name *Object, args **Object, nargs uintptr, kw
122122
return nil
123123
}
124124

125+
type Kwargs map[string]*Object
126+
127+
func KwargsToDict(kw Kwargs) *Object {
128+
dict := NewDict()
129+
for k, v := range kw {
130+
dict.DictSetItem(FromGoString(k), v)
131+
}
132+
return dict
133+
}
134+
125135
// -----------------------------------------------------------------------------

0 commit comments

Comments
 (0)