Skip to content
This repository was archived by the owner on Aug 10, 2022. It is now read-only.

Commit a6de78a

Browse files
remicalixtehush-hush
authored andcommitted
Add PyDict_Next
1 parent 9207ba0 commit a6de78a

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

dict.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,21 @@ func PyDict_Size(p *PyObject) int {
122122
return int(C.PyDict_Size(toc(p)))
123123
}
124124

125+
//PyDict_Next : https://docs.python.org/3/c-api/dict.html#c.PyDict_Next
126+
func PyDict_Next(p *PyObject, ppos *int, pkey, pvalue **PyObject) bool {
127+
cpos := C.long(*ppos)
128+
ckey := toc(*pkey)
129+
cvalue := toc(*pvalue)
130+
131+
res := C.PyDict_Next(toc(p), &cpos, &ckey, &cvalue) != 0
132+
133+
*ppos = int(cpos)
134+
*pkey = togo(ckey)
135+
*pvalue = togo(cvalue)
136+
137+
return res
138+
}
139+
125140
//PyDict_ClearFreeList : https://docs.python.org/3/c-api/dict.html#c.PyDict_ClearFreeList
126141
func PyDict_ClearFreeList() int {
127142
return int(C.PyDict_ClearFreeList())

0 commit comments

Comments
 (0)