Add PyDict_Next

master
Rémi Calixte 2018-12-12 18:46:20 -05:00 committed by Maxime Mouial
parent 9207ba0f00
commit a6de78a63f
1 changed files with 15 additions and 0 deletions

15
dict.go
View File

@ -122,6 +122,21 @@ func PyDict_Size(p *PyObject) int {
return int(C.PyDict_Size(toc(p)))
}
//PyDict_Next : https://docs.python.org/3/c-api/dict.html#c.PyDict_Next
func PyDict_Next(p *PyObject, ppos *int, pkey, pvalue **PyObject) bool {
cpos := C.long(*ppos)
ckey := toc(*pkey)
cvalue := toc(*pvalue)
res := C.PyDict_Next(toc(p), &cpos, &ckey, &cvalue) != 0
*ppos = int(cpos)
*pkey = togo(ckey)
*pvalue = togo(cvalue)
return res
}
//PyDict_ClearFreeList : https://docs.python.org/3/c-api/dict.html#c.PyDict_ClearFreeList
func PyDict_ClearFreeList() int {
return int(C.PyDict_ClearFreeList())